Re: OT THANK YOU: Re: [Flashcoders] How to call functions in sequence
Fuse, the animation engine from mosessupposes.com has a build-in Sequence class. I't easy to add commands to this sequence like method calls. You might want to look into it. Bart 2006/1/30, Kevin Cannon [EMAIL PROTECTED]: On Sun, Jan 29, 2006 at 10:04:22AM +0100, Sander wrote: If your functions are motion-based, have a look at Fuse. It's a set of Tween classes that lets you execute a lot of tweens in sequence. 2 can fire off when 1 finished if you want. You can tween position, alpha, rotation and many more. You could also use setInterval to call the functions. Also, there's Sequence classses out there that are useful too: http://proto.layer51.com/d.aspx?f=1417 - Kevin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: OT THANK YOU: Re: [Flashcoders] How to call functions in sequence
On Sun, Jan 29, 2006 at 10:04:22AM +0100, Sander wrote: If your functions are motion-based, have a look at Fuse. It's a set of Tween classes that lets you execute a lot of tweens in sequence. 2 can fire off when 1 finished if you want. You can tween position, alpha, rotation and many more. You could also use setInterval to call the functions. Also, there's Sequence classses out there that are useful too: http://proto.layer51.com/d.aspx?f=1417 - Kevin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: OT THANK YOU: Re: [Flashcoders] How to call functions in sequence
If your functions are motion-based, have a look at Fuse. It's a set of Tween classes that lets you execute a lot of tweens in sequence. 2 can fire off when 1 finished if you want. You can tween position, alpha, rotation and many more. http://www.mosessupposes.com/fuse/ Sample code from Moses website: var f = new Fuse( { start_alpha:0, start_x:150, start_y:10, ease:'easeOutQuint', seconds:1 }, { scale:200, x:'200', tint:0x123456, tintPercent:75 }, { rotation:'-50', scale:0, ease:'easeOutBounce', seconds:1.5 } // counter-clockwise rotation ); f.target = box_mc; f.start(true); // passing true sets all start-props before running the sequence. S Trying to cut down on hundreds of lines of repeated code with functions, but I have a real newbie question: What is the best way to get functions to fire in sequence. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How to call functions in sequence
Trying to cut down on hundreds of lines of repeated code with functions, but I have a real newbie question: What is the best way to get functions to fire in sequence. (have function 1 wait until function 2 is finished etc.) Right now the functions below all fire at the same time. function1 () function2 () function3() Thanks, --dan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to call functions in sequence
function1() { function2(); } function2() { function3(); } You could also use onEnterFrame to conditionally check for flags indicating the progress of execution: var f1Fired = false; var f2Fired = false; var f3Fired = false; this.onEnterFrame = function() { if (f1Fired) { trace(f1Fired); function2(); } else if (f2Fired) { trace(f2Fired); function3(); } else if (f3Fired) { trace(f3Fired); } else { function1(); } } function1() { f1Fired = true; } function2() { f2Fired = true; } function3() { f3Fired = true; } Or setInterval could be employed, but it sounds like you need sequential executions of your functions, in which case setInterval is inappropriate. hth Mike ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to call functions in sequence
Thanks! I can tell right away that functions are going to save me a ton of troubleshooting! Do you know if they speed up player performance as well? --dan function1() { function2(); } function2() { function3(); } You could also use onEnterFrame to conditionally check for flags indicating the progress of execution: var f1Fired = false; var f2Fired = false; var f3Fired = false; this.onEnterFrame = function() { if (f1Fired) { trace(f1Fired); function2(); } else if (f2Fired) { trace(f2Fired); function3(); } else if (f3Fired) { trace(f3Fired); } else { function1(); } } function1() { f1Fired = true; } function2() { f2Fired = true; } function3() { f3Fired = true; } Or setInterval could be employed, but it sounds like you need sequential executions of your functions, in which case setInterval is inappropriate. hth Mike ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to call functions in sequence
The more of them you use, the slower the performance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to call functions in sequence
That's a drag! Well, I'll use them sparingly -- they helped alot in this project. Thanks Again! --dan The more of them you use, the slower the performance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] How to call functions in sequence
Nooo, don't start thinking functions are slow. They're just slower than inline code. Functions are the first step in making more reusable code, use liberally! :O) Ade -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of dls Sent: 28 January 2006 22:20 To: Flashcoders mailing list Subject: Re: [Flashcoders] How to call functions in sequence That's a drag! Well, I'll use them sparingly -- they helped alot in this project. Thanks Again! --dan The more of them you use, the slower the performance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to call functions in sequence
Yes, don't think in terms of avoiding functions. If something needs to be repeated, it's a candidate for a function. Performance is important for a game, but if an app's object-orientated design makes it a millisecond slower than procedural (inline) code, that's acceptable if you get the benefits of reusable code (more functions). Sorry if I gave you the wrong impression. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders