I'd like to be able to load a swf that has many movieclip assets in it,
then instantiate those assets (icons) throughout the application.

What I'm doing now is:

     private function handleSwfLoaded(e:Event):void{
         for each(var mc:MovieClip in e.currentTarget.content){
             var ui:UIComponent = new UIComponent();
             ui.addChild(mc);
             ui.height = mc.height;
             mc.y = 0;
             mc.x = 0;
             this.addChild(ui);
         }
     }

This code will get all of the child items of a loaded swf (those items
on the canvas that were named) and add them to the current app.

What I want to do is to instantiate new objects, so something more
similar to:

     private function handleSwfLoaded(e:Event):void{
         for each(var mc:MovieClip in e.currentTarget.content){
             var clipClass:Class =
getDefinitionByName(getQualifiedName(mc));
             var newClip:MovieClip = new clipClass();
             var ui:UIComponent = new UIComponent();
             ui.addChild(newClip);
             ui.height = newClip.height;
             newClip.y = 0;
             newClip.x = 0;
             this.addChild(ui);
         }
     }

Unfortunately, this throws the error:
ReferenceError: Error #1065: Variable icon_regactions_print is not
defined.
     at global/flash.utils::getDefinitionByName()

Which is particularly interesting, as I'm feeding it
'getQualifiedClassName()'.

One suggestion floating around is that I should just serialize the
object with ByteArray then deserialize it into another object. I'm
hoping that there is something I'm just missing.

(And yes, for the record, I am exporting all classes on first frame and
exporting for runtime sharing)

Reply via email to