Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DuplicateMovieClip Question 2

Status
Not open for further replies.

wikfx

IS-IT--Management
Dec 16, 2001
196
MT
Hi all I am using Flash Pro 8 I am trying to do something like this:

Code:
MyButton.onRelease = function(){
 B = B + 1
 duplicateMovieClip("Green", "Green"+B, getNextHighestDepth)
 _root["Green"+B]._x = _root["Green"+(B-1)] + 20
}

what I want this to do is duplicate the movie called Green, if possible O would like to use the attachMovie instead but anyway I would like to duplicate the movie everytime the button is pressed but in flash 8 it seemd to duplicate it but replace the one that was duplicated?????? can someone help me out on this I have seen it done I think in flash 5.

thanks

W i K
 
Shouldn't it be something more like...
Code:
MyButton.onRelease = function(){
 	B = B + 1;
 	duplicateMovieClip("Green", "Green"+B, this.getNextHighestDepth());
 	_root["Green"+B]._x = _root["Green"+(B-1)]._x + 20;
};

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
my problem OldNewbie is that the movie only duplicates once. for some odd reason it wont keep duplicating everytime the button is pressed???? any solutions?

W i K
 
It seems using getNextHighestDepth()in this case, is what would cause the problem...

Using this works fine...

var B:Number = 0;

MyButton.onRelease = function(){
B = B + 1;
duplicateMovieClip("Green", "Green"+B, B);
//Or this works as well...
//attachMovie("Green", "Green"+B, B);
_root["Green"+B]._x = B*44;
};

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
thank you so much man this worked GREAT :) !! thanks

W i K
 
Hey Oldnewbie....

I just found this and it worked fine in my need too. I am wondering why didn't 'this.getNextHighestDepth' work in this instance? (Cause it didn't work for my either.)

But setting the variable and then setting depth equal to an increment of that variable did work.

Dave

(have a star)

"Credit belongs to the man who is actually in the arena - T.Roosevelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top