I have a problem with OOP with Flash, actionscript 3. This is a personal project, and I'm looking for a design template or workaround for this problem, and my goal is to learn new things.
I created the Chain class. I created this util class to simplify the deferred function procedure. You can create a chain of functions by adding them with a delay in milliseconds. This chain can be executed several times, even in reverse order. This class has functions that return themselves. This allows you to use jQuery-style syntax, for example:
var chain:Chain = new Chain();
chain.wait(100).add(myFunction1,300).wait(300).add(myFunction2,100);
As an example, I left a lot of functions to demonstrate the problem. The Chain class is basically pure for adding functions and starting / stopping the chain.
public class Chain
{
function wait(delay:int = 0):Chain
{
return this;
}
public function add(func:Function, delay:Number = 0):Chain
{
list.push( new ChainItem(func, delay) );
return this;
}
}
ChainTween. , , ChainTween . tweenengine, Chain. . Chain Chain, Chain.
public class ChainTween extends Chain
{
function animate(properties:Object = null, duration:Number = 0, easing:Function = null):ChainTween
{
return this;
}
}
: , wait() Chain, Chain .
var chain:ChainTween = new ChainTween();
chain.wait(100).animate({x:200}, 100).wait(250);
wait() add() ChainTween, .
chain.wait(100) ChainTween, , . - ChainTween Chain ( ), , . , , , .
Chain ChainTween, , public , .
, ?