Copy link to clipboard
Copied
I need to load an external swf in to a movieclip and use setMask() to mask another movieclip. This is not working. Is it possible to do this in AS2?
example:
loadMovie("http://www.example.com/swfFile.swf", _root.mc1_mc.mc2_mc); //this external swf's instance name is clip1
abc_btn.onRelease=function(){
_root.mc1_mc.mc2_mc.createEmptyMovieClip("clip0", _root.mc1_mc.mc2_mc.getNextHighestDepth());
_root.mc1_mc.mc2_mc.clip0.setMask( _root.mc1_mc.mc2_mc.clip1);
}
you can use attachMovie in the loaded swf. i'm not sure what you'll try and do after that.
Copy link to clipboard
Copied
that will work, but it doesn't make much sense and probably does not do what you want. ie, you're masking an empty movieclip. so, you would expect to see clip1 'disappear' when it's set as a mask and nothing revealed because clip0 is an empty movieclip.
what is it that you want to do?
Copy link to clipboard
Copied
Yes, you're correct 'clip0' is empty in my sample code. I'm using the empty movieclip with attachMovie() to tile a background.
This is what I want to be able to do. This works if I manually add the "clip1" movieclip instead of using loadMovie()
But I want to use loadMovie to import external swfs
loadMovie("http://www.example.com/swfFile.swf", _root.mc1_mc.mc2_mc); //this external swf's instance name is clip1
abc_btn.onRelease=function(){
NuX = NuY = 0;
for(j=0;j<296;j++){
if(NuX>=650){
NuX=0;
NuY=NuY+50;
}
_root.mc1_mc.mc2_mc.createEmptyMovieClip("clip0", _root.mc1_mc.mc2_mc.getNextHighestDepth());
_root.mc1_mc.mc2_mc.clip0.attachMovie(attX[this.pvar], "tileB"+j, _root.mc1_mc.mc2_mc.clip0.getNextHighestDepth(), {_x:NuX, _y:NuY});
//trace(_root.mc1_mc.mc2_mc.clip0["tileB"+j]) //undefined when loadMovie() is used.
NuX=NuX+50;
if(j==296){
_root.mc1_mc.mc2_mc.clip0.setMask( _root.mc1_mc.mc2_mc.clip1);
}
}
Copy link to clipboard
Copied
you can't use attachMovie applied to a load target or child of a load target.
Copy link to clipboard
Copied
Thanks Kglad.
Instead of using attachMovie() to the load target will it work if I apply the attachMovie() within the loadMovie() swf? so once it's loaded the tile effect could be achieved?
Copy link to clipboard
Copied
you can use attachMovie in the loaded swf. i'm not sure what you'll try and do after that.
Copy link to clipboard
Copied
Thanks Kglad.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now