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

duplicate 2 attach 1 and mask attached?

Participant ,
Jun 05, 2014 Jun 05, 2014

My AS2 code (not working):

var btnX:Array=[gpat_btn0, gpat_btn1, gpat_btn2];

var attX:Array=["pat0","pat1","pat2"];

for(i=0;i<btnX.length;i++){

  btnX.pvar=i;

  btnX.onRelease = function(){

  for(s=0;s<2;s++){

  _root.movieC1.movieC2.C2.duplicateMovieClip(_root.movieC1.movieC2["clip"+s], _root.movieC1.movieC2.getNextHighestDepth());

  }

  _root.movieC1.movieC2.clip0.attachMovie(attX[this.pvar], attX[this.pvar], _root.movieC1.movieC2.C2.getNextHighestDepth());

  _root.movieC1.movieC2.clip1.setMask(_root.movieC1.movieC2.clip0);

  }

}

I want to create 2 duplicates of [ _root.movieC1.movieC2.C2 ] inside the same movieclip [ _root.movieC1.movieC2 ].

Attach a [ attX ] in one of the duplicates created.

Mask the above attached movieclip with the other duplicate.

TOPICS
ActionScript
338
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 05, 2014 Jun 05, 2014

again, you can't reparent a duplicated movieclip.  your duplicate will have a parent that is the timeline that contains the duplicateMovieClip code.

so, you could use code in _root.movieC1.movieC2;

function duplicateC2():MovieClip{

return this.C2.duplicateMovieClip("c2dup",this.getNextHighestDepth());

}

Translate
Community Expert ,
Jun 05, 2014 Jun 05, 2014

you can create duplicates (using a string for the name) but you can't reparent using as2 with attachMovie or otherwise.

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 05, 2014 Jun 05, 2014

Thanks but I don't need to reparent the duplicate movieclips, I want to be able to duplicate the movieclips within the same original movieclip.

Eg:

Original movieclip is C2. resides in _root.movieC1.movieC2

Duplicates to be created are clip0 and clip1 inside _root.movieC1.movieC2

Any suggestions how I can achieve my requirement?

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 05, 2014 Jun 05, 2014

again, you can't reparent a duplicated movieclip.  your duplicate will have a parent that is the timeline that contains the duplicateMovieClip code.

so, you could use code in _root.movieC1.movieC2;

function duplicateC2():MovieClip{

return this.C2.duplicateMovieClip("c2dup",this.getNextHighestDepth());

}

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 05, 2014 Jun 05, 2014

Great as always! thanks.

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 05, 2014 Jun 05, 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