Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

setMask() using loadMovie()

Participant ,
Jun 17, 2014 Jun 17, 2014

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);

}

TOPICS
ActionScript
564
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 17, 2014 Jun 17, 2014

you can use attachMovie in the loaded swf.  i'm not sure what you'll try and do after that.

Translate
Community Expert ,
Jun 17, 2014 Jun 17, 2014

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 17, 2014 Jun 17, 2014

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);

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2014 Jun 17, 2014

you can't use attachMovie applied to a load target or child of a load target.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 17, 2014 Jun 17, 2014

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2014 Jun 17, 2014

you can use attachMovie in the loaded swf.  i'm not sure what you'll try and do after that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 17, 2014 Jun 17, 2014

Thanks Kglad.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2014 Jun 18, 2014
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines