Another workaround that I've been using is to use the loading swf as wrapper for the movieClip I ultimately want to display on the stage.

Create the content you want to use as movieClip symbol in your swf, export for actionscript, no need to put it on the stage, and give it a class name. Now you can load the wrapper swf. As soon as you do all the classes in that wrapper will be available throughout your project and you can access them by name. Untested e-mail code:

loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, loaderInit);
var request:URLRequest = new URLRequest(pageSource);
loader.load(request);

private function loaderInit(event:Event):void{
  var myClass:Class = getDefinitionByName("myClassInMySwf") as Class;
  var newClip:MovieClip = new myClass();
  newClip.name = "test";
  addChild(newClip);
}

This way you can create a library of swfs that you can load in and use as required. If you make two libraries with the class internally named the same then you can change up your app just by loading in a different "library" swf.

Rob

On Thu, 07 Jun 2007 13:39:48 -0400, Patrick Matte|BLITZ <[EMAIL PROTECTED]> wrote:

I want to rename the content because I need to be able to access it later using getChildByName("test");

But since its not possible, I think I'll have to make my classes dynamic and do this instead :

private function loaderInit(event:Event):void{
        event.target.removeEventListener(Event.INIT, loaderInit);
        this["test"] = event.target.content;
        addChild( this["test"] );
}



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to