Re: [Flashcoders] Private var not accessible?
Hello :) more information about vegas in the projects page : - http://code.google.com/p/vegas/ And you can see the event model tutorials in this page : http://code.google.com/p/vegas/wiki/VegasTutorialsEvents EKA+ :) 2007/6/8, JOR [EMAIL PROTECTED]: Oh cool, I never saw the VEGAS framework before. Looks interesting, I'll check it out. Thanks, James eka wrote: Hello :) i have the same implementation in VEGAS inspired of the flash.util.Timeclass : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/Timer.as http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/FrameTimer.as For me it's a better solution to use this implementation :) I prefere the dom2/3 of the W3C event model to manage my intervals too ;) EKA+ :) ___ 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 ___ 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
[Flashcoders] Private var not accessible?
I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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
Re: SPAM-LOW: [Flashcoders] Private var not accessible?
You'd run into the same issue with setInterval. When you specify a function reference like this there is no scope for that function, so the private var is not within the scope of the function. Use the alternative call for setTimeout: var delay = _global.setTimeout(this, 'delayedFunc', 1000 ); Or use Delegate: var delay = _global.setTimeout( Delegate.create(this, delayedFunc), 1000 ); In both cases you are providing the scope for which the function will have. Derek Vadneau - Original Message - From: eric e. dolecki To: Flashcoders mailing list Sent: Thursday, June 07, 2007 1:17 PM Subject: SPAM-LOW: [Flashcoders] Private var not accessible? I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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
RE: [Flashcoders] Private var not accessible?
I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. Is this a case for Delegate? Looks to me like you've lost scope as a result of going to _global. Danny ___ 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
Re: [Flashcoders] Private var not accessible?
There is no difference between setInterval() and setTimeout() in this aspect. The function invoked by any of them has no object context (this is undefined inside the function), so use Delegate to set the scope. Attila eed I have a simple class and I can't access a private var after using eed setTimeout... I typed this up to show whats happening: eed eed class foo extends MovieClip eed { eed private var nTime:Number = 0.75; eed private var delay:Number; eed eed function foo() eed { eed // stuff eed }; eed eed public function doSomething():Void eed { eed trace( nTime ); // works fine [0.75] eed var delay = _global.setTimeout( delayedFunc, 1000 ); eed }; eed eed private function delayedFunc():Void eed { eed trace( nTime ); //undefined ? eed }; eed } eed eed ?? I could use setInterval and kill it after the first fire, but setTimeout eed is nicer. This is AS2 obviously. ___ 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
Re: [Flashcoders] Private var not accessible?
inside a class i have to use _global.setTimeout since its not in the intrinsics, maybe use Delegate, but that car should be available from anywhere within the class, no? eric On 6/7/07, Danny Kodicek [EMAIL PROTECTED] wrote: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. Is this a case for Delegate? Looks to me like you've lost scope as a result of going to _global. Danny ___ 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 ___ 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
Re: [Flashcoders] Private var not accessible?
Hello :) you must use the second notation of the method : var delay = _global.setTimeout( this, delayedFunc, 1000 ); EKA+ :) 2007/6/7, eric e. dolecki [EMAIL PROTECTED]: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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 ___ 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
Re: SPAM-LOW: Re: [Flashcoders] Private var not accessible?
Looks to me like you've lost scope as a result of going to _global. Nope. _global is simply an object and has nothing to do with scope in this case. but that car should be available from anywhere within the class, no? No. When you specify a function reference in setInterval or setTimeout the function's scope only includes local and _global. It does NOT include where the function is defined. In AS3 it would because of function closure, but that's not the case in AS1/AS2. That's why there's the alternative arguments for setInterval and setTimeout. Or you can use Delegate if you want compile-time checking of the function reference. Derek Vadneau - Original Message - From: eric e. dolecki To: flashcoders@chattyfig.figleaf.com Sent: Thursday, June 07, 2007 3:38 PM Subject: SPAM-LOW: Re: [Flashcoders] Private var not accessible? inside a class i have to use _global.setTimeout since its not in the intrinsics, maybe use Delegate, but that car should be available from anywhere within the class, no? eric ___ 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
Re: [Flashcoders] Private var not accessible?
thanks all :) I appreciate it. - eric On 6/7/07, eka [EMAIL PROTECTED] wrote: Hello :) you must use the second notation of the method : var delay = _global.setTimeout( this, delayedFunc, 1000 ); EKA+ :) 2007/6/7, eric e. dolecki [EMAIL PROTECTED]: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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 ___ 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 ___ 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
Re: [Flashcoders] Private var not accessible?
Eka, was right about the notation being the problem but I thought I would mention something small I noticed. You declare delay as a private property of the class but then declare it again as a local variable inside your doSomething() method. If you don't need to access the value of delay outside of the doSomething() method I would remove it at a private property of the class. Otherwise, if you do need it outside of the doSomething method I would remove the var keyword from in front of the assignment so that you are assigning to the class' property and not creating a new local variable. You might also want to be consistant with your variable names. You prefix Time with n for a Number but don't do so with delay. Also, you can check out my Timer class for something like this: http://www.jamesor.com/2006/10/18/as2-timer-class/ James O'Reilly — Consultant Adobe Certified Flash Expert http://www.jamesor.com Design • Code • Train eric e. dolecki wrote: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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 ___ 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
Re: [Flashcoders] Private var not accessible?
that was a typo - did that on the fly not copy pasted. nice catch though. My private vars get a leading _ on them. - eric On 6/7/07, JOR [EMAIL PROTECTED] wrote: Eka, was right about the notation being the problem but I thought I would mention something small I noticed. You declare delay as a private property of the class but then declare it again as a local variable inside your doSomething() method. If you don't need to access the value of delay outside of the doSomething() method I would remove it at a private property of the class. Otherwise, if you do need it outside of the doSomething method I would remove the var keyword from in front of the assignment so that you are assigning to the class' property and not creating a new local variable. You might also want to be consistant with your variable names. You prefix Time with n for a Number but don't do so with delay. Also, you can check out my Timer class for something like this: http://www.jamesor.com/2006/10/18/as2-timer-class/ James O'Reilly — Consultant Adobe Certified Flash Expert http://www.jamesor.com Design • Code • Train eric e. dolecki wrote: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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 ___ 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 ___ 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
Re: [Flashcoders] Private var not accessible?
Hello :) i have the same implementation in VEGAS inspired of the flash.util.Timeclass : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/Timer.as http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/FrameTimer.as For me it's a better solution to use this implementation :) I prefere the dom2/3 of the W3C event model to manage my intervals too ;) EKA+ :) 2007/6/8, JOR [EMAIL PROTECTED]: Eka, was right about the notation being the problem but I thought I would mention something small I noticed. You declare delay as a private property of the class but then declare it again as a local variable inside your doSomething() method. If you don't need to access the value of delay outside of the doSomething() method I would remove it at a private property of the class. Otherwise, if you do need it outside of the doSomething method I would remove the var keyword from in front of the assignment so that you are assigning to the class' property and not creating a new local variable. You might also want to be consistant with your variable names. You prefix Time with n for a Number but don't do so with delay. Also, you can check out my Timer class for something like this: http://www.jamesor.com/2006/10/18/as2-timer-class/ James O'Reilly — Consultant Adobe Certified Flash Expert http://www.jamesor.com Design • Code • Train eric e. dolecki wrote: I have a simple class and I can't access a private var after using setTimeout... I typed this up to show whats happening: class foo extends MovieClip { private var nTime:Number = 0.75; private var delay:Number; function foo() { // stuff }; public function doSomething():Void { trace( nTime ); // works fine [0.75] var delay = _global.setTimeout( delayedFunc, 1000 ); }; private function delayedFunc():Void { trace( nTime ); //undefined ? }; } ?? I could use setInterval and kill it after the first fire, but setTimeout is nicer. This is AS2 obviously. - eric ___ 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 ___ 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 ___ 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
Re: [Flashcoders] Private var not accessible?
Oh cool, I never saw the VEGAS framework before. Looks interesting, I'll check it out. Thanks, James eka wrote: Hello :) i have the same implementation in VEGAS inspired of the flash.util.Timeclass : http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/Timer.as http://svn1.cvsdude.com/osflash/vegas/AS2/trunk/src/vegas/util/FrameTimer.as For me it's a better solution to use this implementation :) I prefere the dom2/3 of the W3C event model to manage my intervals too ;) EKA+ :) ___ 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