Question
Controling a loaded swf with another loaded swf
I have a blank stage with only AS that loads an swf
addChildAt(0) and a second one addChildAt(1). This works. When the
user interacts with (1) it calls another addChild (not indexed) and
possibly that one loads another, depending on the choices made by
the user. How can I get any of these to control that very first
child that was loaded at (0)? I have run out of ideas.
Some of the code:
(on the main swf, nothing on the stage, only code that loads the next two)
addChildAt(pHolder, 0);
pLoader.load(pURLReq);
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, pLoaded);
and for the second:
addChildAt(mHolder, 1);
mLoader.load(mURLReq);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, mLoaded);
On the child of childAt(1), I have:
function replaceSWF(e:MouseEvent):void
{
pLoader = new Loader();
pLoader.load(new URLRequest("p.swf"));
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, placeNewClip);
}
function placeNewClip(e:Event):void
{
removeChildAt(0);
addChildAt(e.target.content, 0);
}
If I use this exact same code from that very first swf, the one that loads the first two external swfs, it works, but once I put it on one of hte other loadeds and sub loaded swfs, I can't get it to work. In the current state (0) it just makes everything on the stage disappear, so I figured then using the index of (1) would do it, but that or any other number results in absoluly nothing.
Help! I am really out of ideas here.
(the stacking looks like this) ---
sub second loaded SWF <==== needs to tell first loaded SWF to unload then load a new swf at same index
second loaded SWF <==== loads the next one above
first loaded SWF <=== needs to be removed and another swf loaded at the same index
mainSWF (loads two others) <=== code placed here works for first loaded SWF
Some of the code:
(on the main swf, nothing on the stage, only code that loads the next two)
addChildAt(pHolder, 0);
pLoader.load(pURLReq);
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, pLoaded);
and for the second:
addChildAt(mHolder, 1);
mLoader.load(mURLReq);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, mLoaded);
On the child of childAt(1), I have:
function replaceSWF(e:MouseEvent):void
{
pLoader = new Loader();
pLoader.load(new URLRequest("p.swf"));
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, placeNewClip);
}
function placeNewClip(e:Event):void
{
removeChildAt(0);
addChildAt(e.target.content, 0);
}
If I use this exact same code from that very first swf, the one that loads the first two external swfs, it works, but once I put it on one of hte other loadeds and sub loaded swfs, I can't get it to work. In the current state (0) it just makes everything on the stage disappear, so I figured then using the index of (1) would do it, but that or any other number results in absoluly nothing.
Help! I am really out of ideas here.
(the stacking looks like this) ---
sub second loaded SWF <==== needs to tell first loaded SWF to unload then load a new swf at same index
second loaded SWF <==== loads the next one above
first loaded SWF <=== needs to be removed and another swf loaded at the same index
mainSWF (loads two others) <=== code placed here works for first loaded SWF
