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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript that will replace one Movie Clip for another. 2

Status
Not open for further replies.

spook007

Programmer
May 22, 2002
259
US
I would like to load a new movie clip everytime a user rolls over a specific button. I would like to have the new movie clip replace the old movie clip that was displayed when the last button was accessed.

Does anyone have any suggestions for me... Thanks
 
either have specific images for each button rollover with each image loading into the same clipholder or have a random function to decide which image is to be loaded.

for the former

on (rollOver){
loadMovie("some.jpg",holder);
}

holder the instance name of the empty clip
 
You could have a number of numbered movie clips (mc1, mc2, mc3, etc...) stacked one over the other, all set to be invisible to start with, then simply use a counter variable to cycle through each one of those movie clips to make one of them visible on a press of the button...

count = 1;
previous_mc = 0;

on(release){
_root["mc"+previous_mc]._visible = false;
_root["mc"+count]._visible = true;
previous_mc = count;
count +=1;
if (count > 5){
count = 1;
}
}

This would cycle through 5 movie clips, turning off the visibility of the previously displayed movie clip, and turning on the visibility of the next movie clip in line.

Regards,

cubalibre2.gif
 
Thank you for the quick response. I like the cycle approach. What I thought of doing was placing a function on the root that would receive an identifier for the active button. It would then run a loop that would make all the other MC invisible exept for the one that called the function.

Here is the URL for my flash movie. Unfortunately I cannot get the loop to work, I'm trying to debug it, but it will not go into the loop. I don't get an error so I'm not sure what I've done wrong.

 
function screenChange(active) {
for (counter=0; counter<5; counter++) {
_root[&quot;mc&quot;+counter]._visible = false;
}
_root[&quot;mc&quot;+active]._visible = true;

}


thats it
 
Thank you guys... I appreciate you time and patience...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top