|
|
|
#1 |
|
Matthew Wallace Web Developmen
Join Date: Jul 2007
Location: Spring Hill, TN
Posts: 3
|
K,
I am switching to AS3 and I need some help understanding something. I normally like to have an empty MC that I load external swf files into when I am working on a project. In AS2 I would do it like this. myButton.onRelease = function(){ myemptyMC.loadMovie("myswf.swf"); } Now the cool thing about that was if I loaded a different swf file into the empty movieclip it would just replace the swf that was loaded in before it. No in as the to load a swf I have to create a new loader and URLRequest. I totally understand how to do that. My problem is that using addChild() does not replace the swf that is already loaded into the empty MC it just places another instance of the new swf file that is being loaded in on top of the swf file that is there. so if I do myemptyMC.addChild(mySwfLoader); does not replace the content of that movieclip. How do I do that or how do I remove the content of the movieclip in order to load in my new swf file? thank |
|
|
|
|
|
#2 |
|
Member
Join Date: Jun 2006
Location: Florida, USA
Posts: 78
|
There is a very simple solution for this!
![]() create a variable that does not get destroyed(global kinda). If your using the CS3 interface just place it in the actionscript part of the stage. If your using the sdk to compile just make it a private var in your class. After setting it for the first time add it to the myemptyMC object. when you want to make that variable something else just reference it(set it) to another object. Example Code:
var child:Object=mySwfLoader; myEmptyMC.addChild(child); //this changes it to a new thing because I'm setting child which is already added to the MovieClip to something new child=new Object(); ![]() If not just ask about what you don't understand. |
|
|
|
|
|
#3 |
|
Matthew Wallace Web Developmen
Join Date: Jul 2007
Location: Spring Hill, TN
Posts: 3
|
That should work
Thanks I will give that a try. That should work.
thanks, Matthew
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jan 2006
Location: USA
Posts: 383
|
Let's say your Loader object is called loader.
I'm pretty sure you could just do: PHP Code:
|
|
|
|
|
|
#5 |
|
Matthew Wallace Web Developmen
Join Date: Jul 2007
Location: Spring Hill, TN
Posts: 3
|
most likely I will give each suggestion a try. What would be great is to be able to load the new content in place of the old content without having to do an extra step. In this case the unload and then load again, but that may be the only way you can do it.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|