// RUN function runOnce ( id ) { trace( arguments ); }
// CHECK function runCheck ( id ) { if ( doneOnce [ '_' + id ] == undefined ) { doneOnce [ '_' + id ] = true; doneOnce.func.apply (null, arguments); } } // STORE doneOnce = {}; doneOnce.func = mx.utils.Delegate.create (this, runOnce); // TEST runCheck ( 1, 1 ); runCheck ( 1 ); runCheck ( 1 ); runCheck ( 'a', 1, 'arg1', 'arg2', 'arg3' ); runCheck ( 'a', 2 ); runCheck ( 'a', 3 ); runCheck ( 'b', 1 ); runCheck ( 'b', 2 ); _____________________________ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _____________________________ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Helmut Granda Sent: Tuesday, April 03, 2007 12:30 PM To: Flashcoders mailing list Subject: [Flashcoders] If statements combined into one insted of : bigFunction() { once1 = true; if (once1 == true) { dothisonce(); once1 = false; } once2 = true; if (once2 == true) { dothisonce(); once2 = false; } once3 = true; if (once3 == true) { dothisonce(); once3 = false; } } What I am trying to do is take the if statements out into its own function like bigFunction() { test(one); test(two); test(three); test(var1 ) { once = true; if (once == true) { apply.var1(this); once = false; } } The tricky part is that this functions are being triggered constantly so each function has to fire only once each time is called... Any good ideas? _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com