Flash Gordon
08-20-2007, 11:46 PM
Where to begin....
I have to create these "InfoModules" that are manufactured by an .swf file. The modules textual appearance changes by an xml. Which InfoModule loads at run time I don't know as that is also determined by the xml file and a factory. The same InfoModule has be able to have additional "decorations" to it (see first image attached and both are a representation of InfoModule1) depending on which .swf manufactures it. In the module on the left, there is 1 additional visual element added, that is a line. In the module on the right, there are 3 additional visual elements added: 2 lines and a grey box. However, there may be no visual elements added as this is to be determined by the .swf that makes the InfoModules. For instance, if InfoModule2 is instantiated, no decorations are needed.
Here is how the modules are being manufactured:
private function onXML(event:Event):void
{
_xml = XML(event.currentTarget.data);
_module = infoModuleFactory(_xml.@module);
addChild(_module);
}
private function infoModuleFactory(def:String):InfoModule
{
// dynamically get class instance from xml doc
var ModuleReference:Class = getDefinitionByName(def) as Class;
return new ModuleReference(_xml);
}
a diagram of the Modules is also attached.
I just don't know how to add these visual elements. I was thinking of getting rid of the getDefinitionByName way of doing this, and making each "template" .swf file have its own factory and when InfoModule1 is created in the factory, adding those visual elements. If InfoModule2 is create, no visual elements...etc. The problem with this is when I add a new InfoModuleNth, I will have to go back through all the "template" factories and include this new InfoModule. Maybe that just comes with the territory....
:confused:
I have to create these "InfoModules" that are manufactured by an .swf file. The modules textual appearance changes by an xml. Which InfoModule loads at run time I don't know as that is also determined by the xml file and a factory. The same InfoModule has be able to have additional "decorations" to it (see first image attached and both are a representation of InfoModule1) depending on which .swf manufactures it. In the module on the left, there is 1 additional visual element added, that is a line. In the module on the right, there are 3 additional visual elements added: 2 lines and a grey box. However, there may be no visual elements added as this is to be determined by the .swf that makes the InfoModules. For instance, if InfoModule2 is instantiated, no decorations are needed.
Here is how the modules are being manufactured:
private function onXML(event:Event):void
{
_xml = XML(event.currentTarget.data);
_module = infoModuleFactory(_xml.@module);
addChild(_module);
}
private function infoModuleFactory(def:String):InfoModule
{
// dynamically get class instance from xml doc
var ModuleReference:Class = getDefinitionByName(def) as Class;
return new ModuleReference(_xml);
}
a diagram of the Modules is also attached.
I just don't know how to add these visual elements. I was thinking of getting rid of the getDefinitionByName way of doing this, and making each "template" .swf file have its own factory and when InfoModule1 is created in the factory, adding those visual elements. If InfoModule2 is create, no visual elements...etc. The problem with this is when I add a new InfoModuleNth, I will have to go back through all the "template" factories and include this new InfoModule. Maybe that just comes with the territory....
:confused: