Link to home
Start Free TrialLog in
Avatar of simophat
simophat

asked on

Transitioning between content MC's in AS3?

Hi, im currently trying to make the jump from as2 to as3...which happens to be not so easy; who would have thought.So my question is:

i have multiple menu buttons on the stage: btn_home, btn_contact etc
and each btn relates to a content movie clip: mc_home, mc_contact ... these movie clips have  'animateON' & 'animateOFF' sections which are marked by frame labels inside the MC's.

when a menu button is pressed i need the current MC on the stage to play through its 'animateOFF' section, and on completion, the content MC relating to the menu button which was pressed to begin playing through it's 'animateON' section. This way the content MC's will seem to transition between each other.

Seems to me like a pretty generic question but as of yet i have not been able to find any tutorials or resources in regards to AS3?
Cheers.
Avatar of asaivan
asaivan
Flag of United States of America image

What's your AS2 look like?  I can help translate.
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of simophat
simophat

ASKER

Thanks for your help guys, i found a tutorial on dorklessons.com (for real) and the script read as below.

Also on the last frame inside each content MC (ie. menu1, menu2) there was the code to call the next intro after the current outro had finished playing:

var theRoot:MovieClip = MovieClip(root);
theRoot.current.gotoAndPlay("intro");

now all i have to do is incorporate some deep linking in with this code and i will be good to go...


var current:MovieClip = menu1;
current.gotoAndPlay("intro");
 
button.addEventListener(MouseEvent.CLICK, clickHandler);
button2.addEventListener(MouseEvent.CLICK, clickHandler);
 
function clickHandler(e:MouseEvent):void
{
	current.gotoAndPlay("outro");
	switch(e.target.name)
	{
	case"button":
	current = menu1;
	break;
	
	case"button2":
	current = menu2;
	break;
	}
}
	
	

Open in new window

When you say deep linking are you talking about browser integration.