PDA

View Full Version : controlling multiple movie clips


charter
12-31-2002, 07:24 PM
I wish to control multiple MOVIE CLIPS on i click of a button within another movie clip.

I know how to control 1 other mc. but I wish to make 1 mc start and another to return to it's original position

The code I have to control 2 MCs that I have is

on (release) {
play ();
}
on (release) {
_root.mc50.play();
}

I also wish to make another mc go back to it's original position.
This mc instance is mc60. Anyone any ideas how to do this?

I have zipped up a file to show what I mean

All help much appreciated

HAPPY NEW YEAR!!

boyzdynasty
12-31-2002, 07:41 PM
i have some ideas....

but i'm not sure wat you want exactly....

ok...i d/l the

the MC at the top is m60

and the one on the left has no instance name...but I guess its
m50?

so.....
Which MC is doin' what when clicked and which MC is suppose to go back to original position?

boyzdynasty
12-31-2002, 07:50 PM
here's what i did....

the mc60 when clicked plays itself and mc50

when clicked again it just plays....

the way you have your mcs set up is....

mc60 plays ---> then stops --->when play again....->it goes backwards.

same scenerio w/ mc50

.....

Not sure if your a newbie...but I ....

to view the code....click on mc60 and then view Action
and you;'lll see where i placed the script.

All i did was but this script on mc60

onClipEvent(enterFrame)
{
this.onRelease = function()
{
this.play();
_root.mc50.play();
} // End of onRelease
}

boyzdynasty
12-31-2002, 07:51 PM
i hope that gives you some ideas on how to go about w/ your project.

Good Luck.

And have a great NewYear

charter
01-01-2003, 09:32 AM
Hi

The MC on the left has NAVIGATION as the instance and there are 2 MCs at the top which are MC50 and MC60.

As there is some confusion about the left MC instance is I have resent the .fla

Eventually there will be more MCs at the top named mc70, mc80 and so on.

What I am looking to do for example is that is from the naviation the 1960s button has been clicked and the mc60 has dropped down, and then another button on the navigation is clicked say 1950s then the mc60 would go back to its original position and the mc50 would drop down.

So that means that which ever button on the navigation is clicked the appropriate MC drops down and I wish to make it then that which ever of the other MCs is already down that it returns to it's original position.

Many Thanks!!!

boyzdynasty
01-01-2003, 03:10 PM
ooo...ooo....
ok. I understand now.

I'll take a look at it later tonight. Gonna head out.
Its New Years!!

You shouldn't be workin' too hard. :D

bembino
01-01-2003, 05:39 PM
What you need is a function that tracks what era is open...or selected and then open and close them accordingly. Place the following code in frame one of the main timeline:
stop();

//variables used to track selected eras
curEra = null;
prevEra = null;

//function to change eras
_global.changeEra = function(eraToOpen) {

//update era variables
prevEra = curEra;
curEra = eraToOpen;

//don't do anything if the user
//clicked the same button twice
if(prevEra != curEra) {
prevEra.play();
curEra.play();
}

}
Also be sure to send your era mc's back to frame one for looping. Open your era mc's (mc50, mc60, etc...) and change the code on the last frame to:
gotoAndStop(1);
Then revise the code on your navigation buttons so that they call the changeEra function:
on (release) {
play ();
changeEra(_root.mc50);
}
So now you can just call the changeEra function and pass the path of the movieclip you want to open through the function and you should be all set.

charter
01-02-2003, 10:16 AM
Hi Bembino

I have tried this putting all the code on the appropriate buttons and frames like you said.

Problem now is that when I click on one of the navigation buttons nothing at all happens. No MC drops down.

Also I do not understand the last paragraph in your reply.

(So now you can just call the changeEra function and pass the path of the movieclip you want to open through the function and you should be all set.)

I am a complete newbie at actionscripting.

Happy New Year.

bembino
01-02-2003, 03:19 PM
I'm attaching a working FLA. Sorry I can't explain right now. I'm a little pressed for time.

charter
01-02-2003, 05:01 PM
Sorry Bembino

I have just run your .fla file and when I click on 1950s or 1960s in the navigation mc nothing happens.
Neither of the mc (50 or 60) will drop down.

Could this be anything to do with the fact that i'm still using Flash 5.

bembino
01-02-2003, 08:16 PM
Oh...yeah...that would have everything to do with it. I was using _global and that is new to MX. Revise teh code as follows:

On Buttons
on (release) {
play ();
_root.changeEra(_root.mc60);
}
On Frame One
stop();

//variables used to track selected eras
curEra = null;
prevEra = null;

//function to change eras
_root.changeEra = function(eraToOpen) {

//update era variables
prevEra = curEra;
curEra = eraToOpen;

//don't do anything if the user
//clicked the same button twice
if(prevEra != curEra) {
prevEra.play();
curEra.play();
}

}
Give that a shot!

charter
01-04-2003, 08:17 PM
Hi Bembino

Many Thanks

This coding has worked.

I would consider upgrading to MX but the Macromedia software is quite expensive here in the UK.

Flash MX is around $700

HAPPY NEW YEAR

boyzdynasty
01-05-2003, 03:37 AM
dag....*sorry*

totally forgot.

Thanx for looking out "B"!!