Go Back   kirupaForum > Flash > Flash IDE

Reply
 
Thread Tools Display Modes
Old 03-19-2010, 07:50 PM   #1
sebastienjb
Registered User
Trying to understand how the AS works.

I'm at my wits end,

I attached a code to "frame 1" in a movie clip, and the movie stops on frame 16, yet the rollover script is still running on frame 16.

How do I make sure it only runs when its on frame 1? or whatever set of frames it's in?

so it looks like this
LAYER FRAMES
SCRIPT |1|
BUTTON |1------------------16|

But the code in "script" is still active and running way passed frame 1, I don't get it.

is their way to stop the code from running outside its assigned frame? like a stop command? I even used "if" conditions and it still runs the code.

And their is a stop command on frame 16 that so it's not looping back to
frame 1.

Thanks for reading, I'm really getting annoyed, haha.
sebastienjb is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?

Old 03-20-2010, 02:15 AM   #2
raghu_thejus
Registered User

try removing listener using removeEventListener in second frame like:

Code:
mc.removeEventListener(MouseEvent.ROLL_OVER,buttonRollOver);
i suppose mc is name of m\your movieclip.

if u add a listener to a movieclip it wil b present for that movieclip until it is removed using removeEventListener.if it is a Enter_Frame event then even if u remove the object from stage also the listener wil be active,in such cases if u dnt want listener remove it using removeEventListener.

__________________
Learn from your mistakes/fault.Never make any mistake/fault....
raghu_thejus is offline   Reply With Quote
Old 03-21-2010, 02:08 PM   #3
sebastienjb
Registered User
hey, thanks! while your answer didn't fix my problem, it lead me to learn this.

delete (this.onRollOver);

which solved the problem, now i'm trying to understand how to loop a code, I found some loop tutorials but their talking about things that are way over my head at this level, like "++i" which i don't understand.

right now I'm trying to make the buttons, when they are on their "on state" constantly check a variable called "page" so if it changes it goes back to "off state" I put it the code on the last frame of the movie clip and it looks like this.

---
stop();
trace("ON TEST 1")
trace(_root.page);
if (_root.page!=1){
gotoAndPlay(1);
}
----

I know it's not working because if it was it would constantly say "ON TEST 1" in the box so I know its constantly running the code, so I need to find out how to loop that code. any ideas?

I wish I could just use labels in the code and make it jump back to a certain point in the code.
sebastienjb is offline   Reply With Quote
Old 03-21-2010, 02:16 PM   #4
sebastienjb
Registered User
hmm, do you guys think if I add an event that sent the movie clip back to the same frame it would run the code again? or should i create an identical set of frames that jump back and forth between each other until the page number changes?

I know their is probably more efficient ways of doings this, I'm still learning and i really want to understand everything instead of just putting in code that magically works, you know?

edit: well that just crashed my flash -.-

Last edited by sebastienjb; 03-21-2010 at 02:20 PM..
sebastienjb is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 -4. The time now is 04:01 AM.

SHARE:

SUPPORTERS:

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com