| Package | ishwest.mioc |
| Class | public class ConfigReader |
See also
| Method | Defined by | ||
|---|---|---|---|
|
readConfigXml(aConfigXml:XML, aMiocFacade:MiocFacade):void
Reads config from a "live" XML object.
| ConfigReader | ||
|
readEmbeddedConfig(aEmbeddedConfig:Class, aMiocFacade:MiocFacade):void
Reads config from an XML file that is embedded into the SWF as
an asset.
| ConfigReader | ||
| Constant | Defined by | ||
|---|---|---|---|
| ATTRIBUTE_NAME : String = "mioc" [static]
The name of MIoC-specific attribute, used in Flex config file.
| ConfigReader | ||
| instance : ConfigReader
[static]
The (one and only) ConfigReader instance.
| ConfigReader | ||
| readConfigXml | () | method |
public function readConfigXml(aConfigXml:XML, aMiocFacade:MiocFacade):voidReads config from a "live" XML object. Comes handy in MXML files.
ParametersaConfigXml:XML — Flex config XML
|
|
aMiocFacade:MiocFacade — The facade of a framework where the classes
must be registered.
|
| readEmbeddedConfig | () | method |
public function readEmbeddedConfig(aEmbeddedConfig:Class, aMiocFacade:MiocFacade):voidReads config from an XML file that is embedded into the SWF as an asset. Check out the sample in the example section below.
ParametersaEmbeddedConfig:Class — An embedded XML asset
|
|
aMiocFacade:MiocFacade — The facade of a framework where the classes
must be registered.
|
| ATTRIBUTE_NAME | constant |
public static const ATTRIBUTE_NAME:String = "mioc"The name of MIoC-specific attribute, used in Flex config file.
| instance | constant |
public static const instance:ConfigReaderThe (one and only) ConfigReader instance.
<?xml version="1.0" encoding="utf-8"?>
<flex-config>
<includes>
<symbol mioc="yes">some.package:DefineMorphShape2Parser</symbol>
<symbol mioc="yes">some.package:DefineShape4Parser</symbol>
<symbol mioc="yes">some.package:DefineScalingGridParser</symbol>
<symbol mioc="yes">some.package:GenericTagParser</symbol>
<symbol mioc="yes">some.package:SwfParser</symbol>
</includes>
<compiler>
<keep-as3-metadata>
<name>MIoC</name>
</keep-as3-metadata>
</compiler>
</flex-config>
import flash.utils.IDataInput;
import ishwest.mioc.MiocFacade;
import ishwest.mioc.ConfigReader;
import some.package.SwfParser;
import some.package.Swf;
public function parseSwf(aSwfBytes : IDataInput) : Swf {
var miocFacade : MiocFacade = new MiocFacade();
[Embed(source="mioc-config.xml",mimeType="application/octet-stream")]
var configXmlAsset : Class;
ConfigReader.instance.readEmbeddedConfig(configXmlAsset, miocFacade);
var parser : SwfParser = miocFacade.getInstanceByClassName("some.package.SwfParser");
return parser.parse(aSwfBytes);
}
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:XML id="f_MiocConfig" source="mioc-config.xml" />
<mx:Script>
<![CDATA[
import flash.utils.IDataInput;
import ishwest.mioc.MiocFacade;
import ishwest.mioc.ConfigReader;
import some.package.SwfParser;
import some.package.Swf;
public function parseSwf(aSwfBytes : IDataInput) : Swf {
var miocFacade : MiocFacade = new MiocFacade();
ConfigReader.instance.readConfigXml(f_MiocConfig, miocFacade);
var parser : SwfParser =
miocFacade.getInstanceByClassName("some.package.SwfParser");
return parser.parse(aSwfBytes);
}
]]>
</mx:Script>
</mx:Application>