Re: [flexcoders] how to use the setInterval() in flex actionscript ?

2005-05-25 Thread dave buhler




 Abdul Qabiz 
<[EMAIL PROTECTED]> to flexcoders
 More options  Apr 23

Hi,
>However, I'm still unable to do the following:>Call a setInterval within a class. Have the setInterval pass over a
>number. And the function called increment that number. Pass this new>number to a textfield object.>If I call:>setInterval(this,"somefunction", 1000, 5)
>function somefunction ( e : Number) {> e++>mx.controls.Alert.show(e)>// shows 6>}
I think, it would trace "6" repeatedly over the interval. And I feel that
there is no reason it won't work.

I just created a sample to verify if my feelings are right :)

This sample is demonstrating setInterval(..) inside a class. Look at the
attached files or code later in this mail.

Hope that helps...

-abdul


1) ##Counter.as##

import mx.core.UIObject;

[Event("start")]
[Event("increment")]
[Event("stop")]

class Counter extends UIObject
{

    var counterIntervalId:Number;
    var __delay:Number = 50;
    var __min:Number = 0;
    var __max:Number = 100;
    var __count:Number = 0;
    var running:Boolean = false;

    function Counter(delay:Number, min:Number, max:Number)
    {

        __min = min ? min : 0;
        __max = max ? max : 100;
        __delay = delay ? delay : 50;
    }

    function startCounter():Void
    {

        __count = 0;
        running = true;
        dispatchEvent({type:"start"});
         counterIntervalId = setInterval(this,"incrementCou
nt", __delay,__min);        //you can also do this:        //counterIntervalId =setInterval(mx.utils.Delegate.create(this,incrementCount), __delay, __min);
    }    function incrementCount(num):Void    {          if(__count < __max)          {             //un-comment the following to see setInterval
(..) passes samenumber agian and again           // mx.controls.Alert.show(num.toString());            __count++;            dispatchEvent({type:"increment"});          }          else
          {              stopCounter();          }    }    function stopCounter():Void    {        clearInterval(counterIntervalId);        __count = 0;        running = false        dispatchEvent({type:"stop"});
    }    function get min():Number    {        return __min;    }    function set min(newValue:Number):Void    {        __min = newValue;    }    function get max():Number
    {        return __max;    }    function set max(newValue:Number):Void    {        __max = newValue;    }    function get value():Number    {        return __count;    }}
2) ##setIntervalExample.mxml##xmlns:mx="
http://www.macromedia.com/2003/mxml"  initialize="onAppInit()">            
                height="150" />        
        enabled="{!counter.running}"/>        enabled="{counter.running}"/>                       toolTipPlacement="top"               thumbCount="2"
               labels="['min', 'max']"               values="[0, 100]"               snapInterval="1"               change="changeLimit();"               allowTrackClick="true"
               maximum="1000"               minimum="0"/>
On 5/25/05, Erik Westra <[EMAIL PROTECTED]> wrote:
The documentation seems not correct here:setInterval(objectName:Object, methodName:Function, interval:Number [,param1:Object, param2, ..., paramN]) : NumberI thought methodName should be of type string when using an object as
1th parameter.Greetz Erik-Original Message-From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com
] OnBehalf Of loveewindSent: woensdag 25 mei 2005 13:52To: flexcoders@yahoogroups.comSubject: [flexcoders] how to use the setInterval() in flex actionscript
?the code run normally in swf,ActionScript:function checkOut(){ TextToCheck = spellCheck_txt.text; url_string = "_javascript_:SpellCheck();"; getURL(url_string, "");
 checkOut_interval = setInterval(function () {  if (spellResult != undefined)  {   spellCheck_txt.text = spellResult;   clearInterval(checkOut_interval);
  } // end if }, 100);}and how to use setInterval() in flex actionscriptas referred in flex actionscript reference:setInterval(functionName:Function, interval:Number [, param1:Object,
param2, ..., paramN]) : Number setInterval(objectName:Object,methodName:Function, interval:Number [, param1:Object, param2, ...,paramN]) : Number Parameters functionName A function name or a referenceto an anonymous function.
interval The time in milliseconds between calls to the functionName ormethodName parameter.param1, param2, ..., paramN Optional parameters passed to thefunctionName or methodName parameter.
objectName An object containing the method methodName. You must includethis parameter when using se

RE: [flexcoders] how to use the setInterval() in flex actionscript ?

2005-05-25 Thread Erik Westra
The documentation seems not correct here:

setInterval(objectName:Object, methodName:Function, interval:Number [,
param1:Object, param2, ..., paramN]) : Number 

I thought methodName should be of type string when using an object as
1th parameter.


Greetz Erik

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of loveewind
Sent: woensdag 25 mei 2005 13:52
To: flexcoders@yahoogroups.com
Subject: [flexcoders] how to use the setInterval() in flex actionscript
?

the code run normally in swf,

ActionScript:
function checkOut()
{
 TextToCheck = spellCheck_txt.text;
 url_string = "javascript:SpellCheck();";
 getURL(url_string, "");
 checkOut_interval = setInterval(function ()
 {
  if (spellResult != undefined)
  {
   spellCheck_txt.text = spellResult;
   clearInterval(checkOut_interval);
  } // end if
 }, 100);
}




and how to use setInterval() in flex actionscript

as referred in flex actionscript reference:

setInterval(functionName:Function, interval:Number [, param1:Object,
param2, ..., paramN]) : Number setInterval(objectName:Object,
methodName:Function, interval:Number [, param1:Object, param2, ...,
paramN]) : Number Parameters functionName A function name or a reference
to an anonymous function.

interval The time in milliseconds between calls to the functionName or
methodName parameter.

param1, param2, ..., paramN Optional parameters passed to the
functionName or methodName parameter.

objectName An object containing the method methodName. You must include
this parameter when using setInterval() in an  block in Flex
applications.



thanks



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] how to use the setInterval() in flex actionscript ?

2005-05-25 Thread JesterXL
Same, just put in a  tag, or link to the external .as file in 
your script tag.

- Original Message - 
From: "loveewind" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, May 25, 2005 7:51 AM
Subject: [flexcoders] how to use the setInterval() in flex actionscript ?


the code run normally in swf,

ActionScript:
function checkOut()
{
 TextToCheck = spellCheck_txt.text;
 url_string = "javascript:SpellCheck();";
 getURL(url_string, "");
 checkOut_interval = setInterval(function ()
 {
  if (spellResult != undefined)
  {
   spellCheck_txt.text = spellResult;
   clearInterval(checkOut_interval);
  } // end if
 }, 100);
}




and how to use setInterval() in flex actionscript

as referred in flex actionscript reference:

setInterval(functionName:Function, interval:Number [, param1:Object,
param2, ..., paramN]) : Number
setInterval(objectName:Object, methodName:Function, interval:Number
[, param1:Object, param2, ..., paramN]) : Number
Parameters
functionName A function name or a reference to an anonymous function.

interval The time in milliseconds between calls to the functionName
or methodName parameter.

param1, param2, ..., paramN Optional parameters passed to the
functionName or methodName parameter.

objectName An object containing the method methodName. You must
include this parameter when using setInterval() in an 
block in Flex applications.



thanks





Yahoo! Groups Links







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] how to use the setInterval() in flex actionscript ?

2005-05-25 Thread loveewind
the code run normally in swf,

ActionScript:
function checkOut()
{
 TextToCheck = spellCheck_txt.text;
 url_string = "javascript:SpellCheck();";
 getURL(url_string, "");
 checkOut_interval = setInterval(function ()
 {
  if (spellResult != undefined)
  {
   spellCheck_txt.text = spellResult;
   clearInterval(checkOut_interval);
  } // end if
 }, 100);
}




and how to use setInterval() in flex actionscript

as referred in flex actionscript reference:

setInterval(functionName:Function, interval:Number [, param1:Object, 
param2, ..., paramN]) : Number
setInterval(objectName:Object, methodName:Function, interval:Number 
[, param1:Object, param2, ..., paramN]) : Number
Parameters
functionName A function name or a reference to an anonymous function.

interval The time in milliseconds between calls to the functionName 
or methodName parameter.

param1, param2, ..., paramN Optional parameters passed to the 
functionName or methodName parameter.

objectName An object containing the method methodName. You must 
include this parameter when using setInterval() in an  
block in Flex applications.



thanks




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/