-
1. Re: Weird timeline loop in entire flash site?
dmeN Mar 19, 2010 11:54 AM (in response to TorQue[MoD])It's not Flash, I can guarantee that. It's your code... you have to remove listeners from objects. If you add a second listener, calling a different function - then both listeners will execute... likely it's that you just need to remove prior listeners, before adding new ones. Add some trace statements in your listener functions to show the problem.
-
2. Re: Weird timeline loop in entire flash site?
TorQue[MoD] Mar 19, 2010 12:03 PM (in response to dmeN)Yeah, I figured it wasn't flash, its just very frustrating with the little understanding I do have of the program.So the problem is in using the same button to call multiple listeners at different points in the timeline without first removing the old one?How does one go about removing a listener? I'm completely new to AS3 and flash code in general.Is there a better way to tell a button to move to a new place in the timeline without creating a listener? This is the only way I know how to get a button to function.Thank you. -
3. Re: Weird timeline loop in entire flash site?
dmeN Mar 19, 2010 12:04 PM (in response to TorQue[MoD])No, you have to use a listener.
To remove you just do like: right_btn.removeEventListener(MouseEvent.CLICK, clickRight1);
-
4. Re: Weird timeline loop in entire flash site?
TorQue[MoD] Mar 19, 2010 12:35 PM (in response to dmeN)So then my new code would be as follows? :Code //This is the Trailer Page
stop();//remove previous listeners
right_btn.removeEventListener(MouseEvent.CLICK, clickRight1);
left_btn.removeEventListener(MouseEvent.CLICK, clickLeft1);//handle button events
left_btn.addEventListener(MouseEvent.CLICK, clickLeft2);
right_btn.addEventListener(MouseEvent.CLICK, clickRight2);function clickLeft2(evtObj:MouseEvent){
import flash.media.SoundMixer;
SoundMixer.stopAll();
gotoAndPlay ("trailer_leave");
}
function clickRight2(evtObj:MouseEvent){
SoundMixer.stopAll();
gotoAndPlay ("workshop_start");
}If this works you'll be my hero! -
5. Re: Weird timeline loop in entire flash site?
dmeN Mar 19, 2010 12:38 PM (in response to TorQue[MoD])Well, from what you described I think that looks good. And like I mentioned, you can use trace statements in your listener functions to see that they're executing - ie you'd see two traces go off if you haven't removed... FWIW, sometimes two listeners on the same button can be really helpful.
-
6. Re: Weird timeline loop in entire flash site?
TorQue[MoD] Mar 19, 2010 1:07 PM (in response to dmeN)Oh yeah, I WAS using traces before, and I DID see two go off at the same time, I just didn't know what it meant!Thank you so much dmennenoh! The problems are now completely fixed! I've been struggling with this for weeks and didn't have a clue what was going on! Sure wish that lynda.com tutorial actually mentioned needing to remove listen events if you add them to the same button, but I guess his website didn't use that format, so why would he think to?You are now my Hero and have renewed my faith in Flash!Thank you thank you thank you!

