Developed a SWF using AS3 which provides displays for the following (Wiki links give better explanations of each display than I could provide).
1. 7 Segment LED
2. Dot Matrix Display
3. Digital LED Clock
The same SWF provides each of the displays. A unique XML file is loaded for each instance of the SWF which contains the settings for the display.
How to do this:
1. Add the following to the html for flash object:
<param name=FlashVars value="xmlFileName=Clock.xml">
The FlashVars parameters are parameters you can name and set values for in the webpage that are passed to the SWF on initial load. Excellent for configuring the SWF. In this case, only one FlashVar parameter is set (name=xmlFileName, value=”Clock.xml”).
2. In your main file of the AS3 project, add the code to unpack the FlashVar parameter:
var flashVars:Object = LoaderInfo(this.loaderInfo).parameters; // this get the FlashVar collection
var xmlFilePath:String = flashVars.xmlFileName;
Note: this gets a little tricky when you’re working in Flash CS4 since the FlashVars are not setup. Either comment out or check to see whether the FlashVars are valid.
3. Now load in the XML file and get the configuration parameters:
var loader = new URLLoader(new URLRequest(xmlFilePath));
loader.addEventListener(Event.COMPLETE, XMLFileLoadedHandler);
private function XMLFileLoadedHandler(e:Event):void
{
_xml = XML (e.target.data);
}
Flash
Flash CS4, AS3