Just an idea - you could use TweenLite with an onUpdate to do something like:

var frequency:Number = 0.05; //number between 0 and 1 indicating how often your 
function should get called over the course of time

var myObject:Object = {progress:0};
var nextTrigger:Number = frequency;
TweenLite.to(myObject, 5, {progress:1, ease:Strong.easeIn, 
onUpdate:checkProgress});

function checkProgress():void {
        if (myObject.progress >= nextTrigger) {
                myFunction();
                nextTrigger = myObject.progress + frequency;
        }
}

Then you can swap out the easing equation with whichever one you want. Or build 
a custom ease with something like http://blog.greensock.com/customease/. And in 
the example, the tween lasts 5 seconds, but obviously change that to whatever 
you need.

Warning: The updates are based on the frame rate, so this method does not 
guarantee that the function will get called at precise increments, nor does it 
guarantee that the function will be called a certain number of times, but since 
your stuff doesn't render inbetween frames anyway, I believe it should 
generally produce the results you're after (easing the time between function 
calls). If not, ignore this post - it was just an idea I had off the top of my 
head :)

Jack

-----Original Message-----
From: Eric E. Dolecki [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 06, 2008 5:13 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Easing a selection

I use TweenLite daily, but I am not tweening the properties on a
DisplayObject, I am "easing" the call of methods over time.
I believe that a timer, setting the delay after each call, and based on a
number of times to call might serve me well.

On Thu, Nov 6, 2008 at 5:44 PM, sebastian <[EMAIL PROTECTED]> wrote:

> Oh do you mean easing? So as it approaches its destination it moves slower
> and slower?
>
> If so, there are many packages that already do this for you, so no need to
> reinvent the wheel. All you need to do is call it.
>
> One such package is TweenLite:
>
> http://blog.greensock.com/tweenliteas3/
>
> Just set the easing equation to what ever curve you require, there is even
> a little flash app. that lets you pick parameters to copy-paste.
>
> Peace,
>
> Seb.
>
>
> Eric E. Dolecki wrote:
>
>> I am after tweening events more than the actual position of a selector.
>> ie. class.increment(); <short pause> class.increment(); <slightly longer
>> pause> class.increment(); <even longer pause>... until stop
>>
>> So I would be providing a UI of selected items via visual easing.
>>
>> I think I have this nailed down... just wanted to get some other ideas on
>> how best to approach it.
>>
>> On Thu, Nov 6, 2008 at 4:38 PM, sebastian <[EMAIL PROTECTED]> wrote:
>>
>>  Erm, I am not sure I understand; so let me paraphrase:
>>>
>>> You want to scroll one area based on the position of a mouse in another,
>>> right?
>>>
>>> If so, just measure the bounds [x/y difference] from some center range
>>> and
>>> apply a Tween to the area you want to scroll.
>>>
>>> BTW: I would generally always recommend against using timers to apply
>>> movements; I've seen far too much code written that uses timers
>>> incorrectly
>>> and it's a real pain in the *** Stick to simple tween calls; like:
>>> TweenLite.
>>>
>>> With kind,
>>>
>>> Sebastian.
>>>




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to