Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-23-2009, 08:56 PM   #1
dynasty_four
Registered User
 
Join Date: Jul 2009
Posts: 10
Default linking to a parent frame

i know how to make a link to a parent frame in AS3

about_btn.addEventListener(MouseEvent.CLICK, aboutClick);

function aboutClick(event:MouseEvent):void{
MovieClip(parent).gotoAndStop("about");
}

thats what i use.. works great. But how to I go up two movie clips, becuase the code above only goes up one movie clip. I'm trying to go up two movie clips instead of one now. any help would greatly be appreciated. Thanks!
dynasty_four is offline   Reply With Quote
Old 11-23-2009, 09:03 PM   #2
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,410
Default

By simply using parent.parent.gotoAndStop("about"); although, this is not a good practice but it will / should work and "get the job done". Good luck.
Barna Biro is offline   Reply With Quote
Old 11-23-2009, 09:58 PM   #3
dynasty_four
Registered User
 
Join Date: Jul 2009
Posts: 10
Default

whats a good practice to do then. is this way frowned apon or something?
dynasty_four is offline   Reply With Quote
Old 11-23-2009, 10:09 PM   #4
maskedMan
Obfuscated Coder
 
maskedMan's Avatar
 
Join Date: Apr 2008
Posts: 1,571
Default

Quote:
Originally Posted by dynasty_four View Post
whats a good practice to do then. is this way frowned apon or something?
It's better to have the function handled in the parent itself. So the parent listens for the button click and then sends itself to the correct frame.
__________________
http://www.scriptocalypse.com - It's not the end of the world. It's just Actionscript!

man.mask = mask_mc;
maskedMan is offline   Reply With Quote
Old 11-23-2009, 10:19 PM   #5
dynasty_four
Registered User
 
Join Date: Jul 2009
Posts: 10
Default

how exactly would that look? have the code in the parent and it looking for the button in the other frame?
dynasty_four is offline   Reply With Quote
Old 11-23-2009, 10:42 PM   #6
Barna Biro
Senior Member
 
Barna Biro's Avatar
 
Join Date: Nov 2009
Location: LU, Switzerland
Posts: 1,410
Default

I'd suggest you stick to the parent.parent solution for the moment. The stuff we would post will surely just confuse you more and it will do more harm then good. The solution described by maskedMan is a better solution than parent.parent but also that solution could be taken a few steps higher by introducing different manager classes that would handle the moving and stuff... Ideally objects don't have to directly know about each other.

Just stick with the parent.parent solution for the moment and once you get more experienced with the technology and OOP then you can try to solve such problems in a more correct manner.

Jusy my 2 cents,
Cheers.

Last edited by Barna Biro; 11-23-2009 at 11:05 PM.
Barna Biro is offline   Reply With Quote
Old 11-23-2009, 10:56 PM   #7
dynasty_four
Registered User
 
Join Date: Jul 2009
Posts: 10
Default

thanks guys, it definately worked.
dynasty_four is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:40 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.