Importing SWF, layers and Actionscript mask question

Hi All,

I am trying to attach an animation I created in another swf. The movie attaches itself fine (see code sample 1). However an actionscrip mask I have used (please look at sample code 2) does not display at all. The animation works, but the mask (pre-built into the animation) is not working. Now I am pretty sure it has something to do with layers.

Any help would be appreciated.

// CODE SAMPLE 1

function createLoad()

{

        trace("attempting to load movie");

        this.attachMovie("loads", "loads_1", 1);

        loads_1._x = 60;

        loads_1._y = 340;



        trace("playing movie loading");

}

// CODE SAMPLE 2

onClipEvent (load) {

        _level_0.snowy.setmask(_root.hole);

}

Thanks,

Obelisk

Its not _level_0, its _level0

And if that doesn’t work, just try _root.

Oh, and why are you using attachMovie?

attachMovie is for pulling symbols out of the library. According to what you are saying, you are loading in an external .swf file.

That would use loadMovie(); or loadMovieNum();

Sorry i pasted the wrong function. Here is the correct function.

function createLoad()
{
trace(“attempting to load movie”);
this.attachMovie(“loads”, “loads_1”, 0);
loads_1._x = 60;
loads_1._y = 340;

trace("playing movie loading");

}

The movie animation plays fine on tis own. The mask works.

However when the movie is loaded into myh main swf, the mask does not work. I am pretty sure it has something to do with the way it is set.

sorry CORRECT function is CreateNewLoad()

function createNewLoad(){
trace(“attempting to create a new container”);
_root.createEmptyMovieClip(“container”, 0);
loadMovie(“snow.swf”, “container”);
container._x = 60;
container._y = 340;
}

Here is the animation in question. Perhaps this will help.

Change…

[AS]onClipEvent (load) {
_level0.snowy.setmask(_level0.hole);
}[/AS]

To…

[AS]onClipEvent (load) {
_parent.snowy.setMask(this);
}[/AS]

Reason: When loading a movie into another movie, the _root of the loaded movie becomes the _root of the main movie you are loading into, so _level0 and _root won’t work for targeting. Instead you need to use _parent to go to the parent timeline. And as for the “this” part, since the actions are on that clip, you can use “this” as a target.

Dude you rock… that fix the issue.

Sometimes it’s hard to think straight when you got Java CFMX, Remoting, Actionscript, Javascript and ASP in your head.

Thanks again.