Is that using my code?  If so, yes, otherwise can I see your code before
you open a bug?

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Clint Modien
Sent: Tuesday, October 23, 2007 12:32 PM
To: [email protected]
Subject: Re: [flexcoders] passing variables to Timer handler routine

 

Sorry... I guess I should have specified that I'm running this in Flex
Builder 3...

The error I get is:

Severity and Description    Path    Resource    Location    Creation
Time    Id
1203: No default constructor found in base class flash.utils:Timer.
TestMyTimer.as/src    MyTimer.as    line 1    1193166906625    478

I don't see it in the bugbase
http://www.google.com/search?hl=en&rlz=1B3GGGL_en___US232&q=site%3Abugs.
adobe.com%2Fjira%2F+extends+timer&btnG=Search
<http://www.google.com/search?hl=en&rlz=1B3GGGL_en___US232&q=site%3Abugs
.adobe.com%2Fjira%2F+extends+timer&btnG=Search> 

Should I add it?



On 10/23/07, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

Subclassing worked for me:

 

<mx:Script>

<![CDATA[

            private var timer:MyTimer;

 

            public function init():void

            {

                        timer = new MyTimer(1000);

                        timer.bar = "foobar";

                        timer.addEventListener(TimerEvent.TIMER,
handler);

                        timer.start();

            }

 

            public function handler(event:Event):void

            {

                        trace(MyTimer(event.target).bar);

            }

]]>

 

MyTimer.as:

 

package

{

            import flash.utils.Timer;

 

            public class MyTimer extends Timer

            {

                        

                        private var foo:String = "foo";

 

                        public var bar:String = "bar"

                        

                        public function MyTimer(delay:Number,
repeatCount:int = 0)

                        {

                                    super(delay, repeatCount);

                        }

                        

            }

}

 

________________________________

From: [email protected] [mailto: flexcoders@
<mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] On
Behalf Of Clint Modien
Sent: Tuesday, October 23, 2007 2:30 AM


To: [email protected]
Subject: Re: [flexcoders] passing variables to Timer handler routine

 

Here was the only workaround...

public static function doSomething(param:Number=0):void {
            var t:Timer = new Timer( 300, 1 );
            //I can't pass arguments/parameters to my timer method??? 
            var f:Function = function():void{
                callTheRealFunc( param);
            }            
            t.addEventListener( TimerEvent.TIMER, f );
            t.start();
        }

On 10/23/07, Clint Modien <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> wrote:

Looks like this solution is broken.

 

On 10 Apr 2007 12:29:19 -0700, Gordon Smith < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

You could also subclass Timer and store any additional data you want on
MyTimer.

 

- Gordon

 

________________________________

From: [email protected] [mailto:flexcoders@ yahoogroups.com
<http://yahoogroups.com> ] On Behalf Of Erik Price
Sent: Tuesday, April 10, 2007 10:53 AM
To: [email protected]
Subject: Re: [flexcoders] passing variables to Timer handler routine

On 4/10/07, dougco2000 <[EMAIL PROTECTED] <mailto:doug%40dougco.com> >
wrote:

> But since Timer calls a new function, how to best pass along any
> objects or strings that it will need, other than have these as global
> vars?

Excellent question. It's answered here:
http://flexblog.faratasystems.com/?p=125
<http://flexblog.faratasystems.com/?p=125> 

e






 

 

 

Reply via email to