Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-07-2012, 08:59 AM   #1
Tedeee
Senior Member
 
Join Date: Mar 2009
Posts: 250
Default Level problem

i have make a button inside a movie clip , once i click it it bing inside to 3 level .

Code:

Cu.pic1.Newbtn.addEventListener(MouseEvent.CLICK. set1)

this button effect bring my flash into pic1 level , is there any way to return to main time line level?

i dont know how to explain , hope you guys understand ,let me know if you guys dont ><"
Tedeee is offline   Reply With Quote
Old 07-07-2012, 09:20 AM   #2
acolyte
Senior Member
 
acolyte's Avatar
 
Join Date: Feb 2005
Posts: 532
Default

ActionScript Code:
event.currentTarget.parent.parent
should do the trick

because parent of pic1 is Cu and parent of Cu is the mainTimeline
__________________
>>I know my english sucks, ... but I speak german.
(this Signature was stolen from some french guy)
acolyte is offline   Reply With Quote
Old 07-07-2012, 10:07 AM   #3
Tedeee
Senior Member
 
Join Date: Mar 2009
Posts: 250
Default thank for reply~

so i will type like this ? event.currentTarget.Cu.pic1
Tedeee is offline   Reply With Quote
Old 07-07-2012, 10:18 AM   #4
acolyte
Senior Member
 
acolyte's Avatar
 
Join Date: Feb 2005
Posts: 532
Angry

No - event.currentTarget.parent.parent

RTFM
__________________
>>I know my english sucks, ... but I speak german.
(this Signature was stolen from some french guy)
acolyte is offline   Reply With Quote
Old 07-08-2012, 04:01 AM   #5
Tedeee
Senior Member
 
Join Date: Mar 2009
Posts: 250
Default it didt work ><

i tryed it didt work , is there any other way to bring me back to the main time line level ?
Tedeee is offline   Reply With Quote
Old 07-08-2012, 04:22 AM   #6
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,331
Default

What does the set1 function do?
(post the set1 code)
[afz]snickelfitz is offline   Reply With Quote
Old 07-08-2012, 04:30 AM   #7
Tedeee
Senior Member
 
Join Date: Mar 2009
Posts: 250
Wink thank for reply

function set1(event:MouseEvent):void{
if(offN == false){
if(Cn1b == true){
p1.gotoAndStop(Cu.currentFrame+Cn1)
Bg.gotoAndStop(p1.currentFrame)
p3.gotoAndStop(p1.currentFrame)
offN = true
}
}
}

i dont think is the Mouse function got problem ,because if it put the the the button at stage,it wont have a problem with my function.

i think is the button bring me it inside the other movie clip level , but once i have a click on stage it work again, so i think i was in pic level but i need to bring it back to main time line level. hope you understand and thank for reply.
Tedeee is offline   Reply With Quote
Old 07-08-2012, 05:39 AM   #8
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,331
Default

If you need to call a function on the main timeline, dispatch an Event from wherever you are, and listen for that event on the main timeline.
That way, you don't have to worry too much about the hierarchical relationship between the child and the main timeline.

Events are a bit tricky to master, but well worth the effort.
Play around with it, and use trace statements to validate your code.
Keep it simple until you understand how it works.
ActionScript Code:
// from a movieclip someplace on the displaylist in your application: dispatchEvent(new Event("do something", true));

main timeline:
ActionScript Code:
addEventListener("do something", eventHandler); function eventHandler(e:Event):void {     trace(e.target.name); }
[afz]snickelfitz is offline   Reply With Quote
Old 07-08-2012, 03:08 PM   #9
Tedeee
Senior Member
 
Join Date: Mar 2009
Posts: 250
Default thank guys i found the solution

thank ,i learn new skill in action strip ,thank for teaching , i love you guys , long live Programming .
Tedeee 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 04:22 AM.

///
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.