Skip to main content
Inspiring
January 14, 2009
Question

Using AS3 To Load External SWF Files

  • January 14, 2009
  • 11 replies
  • 4000 views
I'm making the transition to AS3 and can not figure out how to do something that I used to do easily in AS2. I have a "master" flash file (master.swf). I've set up a loader to load a second flash file into it (home.swf). I'm using the attached code on the master.swf.

All good so far. Now I want to create a navigation menu on the "home.swf" so I can add and replace more swfs into the overall layout. It would seem to make the most sense to use the loader I've already created in the "master.swf" to do this. But I can't figure out how to access and use that loader. I tried the attached code, hoping that the loader would replace the "home.swf" located in level 1 with a new swf ("bio.swf"). But it doesn't work and throws an error. I'm guessing that the button I've created in the "home.swf" to load the "bio.swf" doesn't know about the "myLoader" loader I created in the "master.swf."

Any advice or direction would be very welcome. Thank you.
This topic has been closed for replies.

11 replies

kglad
Community Expert
Community Expert
January 14, 2009
don't (try) to reuse the same loader. instead of thinking about the loader as an abstract swf loader, think about it as your loaded swf. you should remove that swf (if it's no longer needed) when you're ready to load another swf into your master swf. (and not only should you remove it but you should stop all streams in the loaded swf and ready it for gc.)