Jump to content
Search Community

How to get from with in a MC to a parent MC

Procise test
Moderator Tag

Recommended Posts

Ive done this before but for some reason its not working on this project...

 

I have a MC that im trying to tell to bring the user back a page..

 

Ive attached a zip with the project if anyone has the time to check it out it would be very appreciated.

Link to comment
Share on other sites

JoelCS5.5.zipOk so Ive uploaded a new file hope it works. Also Im using your mall map code from your site. But Instead of onRollOver Im using on Click commands so that way you can go deeper into the MC's.

 

Like so:

 

 

function mapOver(e:MouseEvent):void{

var mapItem:MovieClip = e.target as MovieClip;

trace(mapItem.name);

description.gotoAndStop(mapItem.name);

}

 

then I have a MC within the description MC called Kennel:

 

 

 

kennel.addEventListener(MouseEvent.CLICK, kennelOver);

 

 

function kennelOver(e:MouseEvent):void{

var mapitem:MovieClip = e.target as MovieClip;

trace(mapitem.name);

kennel.gotoAndStop(mapitem.name);

help.alpha= 0;

}

 

Then within kennel MC I have a MC called back which Im trying to tell to bring the user back to the description MC on the services label. A simple back button is what Im trying to achieve.

 

what code would achieve this ? Thanks for your help

Link to comment
Share on other sites

Hi.

 

this code will work on the "kennel" frame of the kennel timeline

 

function backhome(e:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(1);
//due to the way your movie clips are nested inside each other you need to avoid sending the CLICK to other display objects
//if the following line is removed the functionality will still work, but there will be an error
e.stopImmediatePropagation();
   }

Link to comment
Share on other sites

interesting thank you..what would be a better way to set this type of project up? instead of nesting mc's like I did.

 

 

 

 

what is this doing?

 

e.stopImmediatePropagation();

Edited by Procise
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...