Copy link to clipboard
Copied
loadMovie() loads SWFs into _root.mc1.mc2, and I use the below method to be able to identify the selected movieclip. It works when I load the first SWF but when the second SWF is been loaded it dosen't work. What may be the cause for this.
I tried unloadMovie() and removeMovieClip() to clear the movieclip before loading the new file, but no success.
function traceName():Void {
trace(this._name);
}
for (i=0; i<5; i++) {
_root.mc1.mc2["color"+i].onRelease = traceName;
}
Copy link to clipboard
Copied
What does the loading code look like?
Copy link to clipboard
Copied
callItems_btn.onRelease = function () {
for(i=0; i<3; i++) {
unloadMovie(_root.mc.mc2)
}
senderLoad.sendAndLoad("www.web.com/the.php",receiveLoad,"POST");
};
receiveLoad.onData = function(src) {
item_text = src;
for(i=0; i<3; i++) {
prototypeLDR.loadClip("www.web.com/"+i+"/new/item.swf, _root.mc.mc2);
}
}
prototypeLDR.addListener(prototypeLO);
var swfsLoaded:Number=0;
var prototypeLDR:MovieClipLoader = new MovieClipLoader();
var prototypeLO:Object = {}; prototypeLDR.addListener(prototypeLO);
prototypeLO.onLoadInit = function(targetMC:MovieClip){
swfsLoaded++;
if(swfsLoaded==3){
trace ("loaded")
}
}
Copy link to clipboard
Copied
Unless you have an array named "mc" that has mc0 thru mc2 in it, your use of
_root.mc.mc2
is not going to target the object you identified in first posting that you specified as
_root.mc1.mc2
basically, _root.mc.mc2 will not be _root.mc1.mc2
You would want to be writing that as _root["mc"+i].mc2
Copy link to clipboard
Copied
Thanks Ned. But I've got an array named mc
var mc:Array = [mc1, mc2, mc3];
I'm loading the below code as an external swf as well. Could that be causing this issue?
function traceName():Void {
trace(this._name);
}
for (i=0; i<5; i++) {
_root.mc1.mc2["color"+i].onRelease = traceName;
}
Copy link to clipboard
Copied
It could be. That code should be getting assigned by the main file that does all of the loading, and it should happen after each time a new set of files is loaded.
Copy link to clipboard
Copied
Thanks Ned.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now