Skip to content


AS3 Playground Library

playground is aimed at designers who have at least some familiarity with programming. The library aims to take care of the tedius and make sketching easier for the designer.

While you got

 
var rect:Sprite = new Sprite();
rect.graphics.beginFill(0x44dd77,.8);
rect.graphics.drawRect(20,20,40,80);
rect.graphics.endFill();
addChild(rect);
 

in the Flash drawing API, in playground you get

 
var rect:SimpleRectangle = new SimpleRectangle(20,20,40,80,0x44dd77,.8);
addChild(rect);
 

playground will be available soon - as soon as I get some examples and basic documentation up.

-Loop.as
Loop class lets you create one ENTER_FRAME event handler to handle everything. The idea comes from VortixGameStudio's BPE.

Instead of having a seperate ENTER_FRAME event handler for each object that needs it, you have one event handler to which you can add and remove functions. The use is pretty straightforward, you call the addTask() method of the Loop instance and pass in 2 parameters. First one being the function, the second one being a unique ID for the function (String). If you want to remove a function, you call the removeTask() method with one parameter - that unique ID you passed in before.

Just create a new Loop object like this

var loop:Loop = new Loop()

and

 addTask(function name, "function ID")

to add a function to the main loop and

 removeTask("function ID")

to remove one from the loop.

example:

 
private function rotateRectangle():void{
    _rectangle.rotation++;
}
 
 
var loop:Loop = new Loop();
addChild(loop);
loop.addTask(rotateRectangle,"rotateRectangleID");
 

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. playground library is somewhat usable – servetulas.com/blog linked to this post on May 21, 2010

    [...] AS3 Playground Library [...]



Some HTML is OK

or, reply to this post via trackback.