mdk
03-17-2009, 09:17 PM
I'm brand new to AS/Flex/Flash and to this forum, so hello everybody :)
Currently I'm working on some kind of data visualisation application. Flex is primary development environment and the app heavily uses external SWFs created in Flash. Basic requirement is that the external SWFs cannot be linked into application, they have to be loaded at runtime. The SWFs are various objects used as data visualisation objects (LEDs, gauges, knobs), so I need to talk to them. Each object may consist of several smaller objects (movieclips) and there is a class describing its behavior. For example, LED has its state (on/off), color, and methods to change these properties.
The first idea is to use SWFLoader and create a wrapper class, something like:
public class SWFWrapper
{
public var swf:SWFLoader;
public var object:IObject; // I'll access internal SWF properties through interface
public function SWFWrapper(path:String)
{
swf = new SWFLoader();
this.path = path;
}
public function loadSWF() {...}
}
However, with this approach I need to have an instance of SWFLoader for each created object.
I've also read about Flash Component Kit, which allows me to create flash components and use them in Flex. However, I'm not sure what about the runtime load requirement. But I suppose there would be less overhead (I don't need SWFLoaders) and the code would be cleaner.
Are there any performance issues with approach 1? What are pros/cons of both methods?
Thank you,
mdk
Currently I'm working on some kind of data visualisation application. Flex is primary development environment and the app heavily uses external SWFs created in Flash. Basic requirement is that the external SWFs cannot be linked into application, they have to be loaded at runtime. The SWFs are various objects used as data visualisation objects (LEDs, gauges, knobs), so I need to talk to them. Each object may consist of several smaller objects (movieclips) and there is a class describing its behavior. For example, LED has its state (on/off), color, and methods to change these properties.
The first idea is to use SWFLoader and create a wrapper class, something like:
public class SWFWrapper
{
public var swf:SWFLoader;
public var object:IObject; // I'll access internal SWF properties through interface
public function SWFWrapper(path:String)
{
swf = new SWFLoader();
this.path = path;
}
public function loadSWF() {...}
}
However, with this approach I need to have an instance of SWFLoader for each created object.
I've also read about Flash Component Kit, which allows me to create flash components and use them in Flex. However, I'm not sure what about the runtime load requirement. But I suppose there would be less overhead (I don't need SWFLoaders) and the code would be cleaner.
Are there any performance issues with approach 1? What are pros/cons of both methods?
Thank you,
mdk