While we all like AS3 for consistency, better performance and OOP, many of us hate it for its verbose nature. If you share this view, then you will find this session helpful in your day-to-day development tasks, be it an agency interactive or a complex application. There are micro frameworks like SimpleAS3, as3Query (ported from jQuery) and Short that attempt to reduce the verboseness of the language. This session will explore such frameworks and other tips and tricks to simplify the language for us.
1 of 23
Downloaded 48 times
More Related Content
Less Verbose ActionScript 3.0 - Write less and do more!
12. SimpleAS3 Author: Josh Tynjala
Twitter: @joshtynjala
Inspired by ActionScript 1.0
Works with Flash IDE (only)
Brings back onClick style
event handling
Has many helper methods
Injects itself through
Document Class
Uses JSFL to setup a project
13. SimpleAS3 Author: Josh Tynjala
Twitter: @joshtynjala
// ActionScript 3 Before SimpleAS3
var imageLoader:Loader = new Loader();
this.addChild( imageLoader );
var request:URLRequest = new URLRequest("images/button.png");
imageLoader.load( request );
loader.addEventListener( MouseEvent.CLICK, imageClickHandler );
function imageClickHandler( event:MouseEvent ):void
{
var request:URLRequest = new URLRequest("http://www.example.com/");
navigateToURL( request, "_self" );
}
14. SimpleAS3 Author: Josh Tynjala
Twitter: @joshtynjala
// ActionScript 3 with SimpleAS3
var loader=this.loadChild("images/button.png");
loader.onClick(function(){
getURL("http://www.example.com/", "_self");
});
15. Short Author: Arul Kumaran
Twitter: @Luracast
Short syntax for long statements
Inspired by SimpleAS3
Will be released a week after Adobe Flash Platform Summit :)
Does almost the same thing as SimpleAS3. But
It is lightweight
It also works with Flex SDK, thus any IDE
No need to turn off strict mode, no JSFL Needed
Distributed as .SWC
16. Short Author: Arul Kumaran
Twitter: @Luracast
// Short Usage
_.to=this;
_.onEnterFrame=function():void
{
trace('enter frame once manually');
delete _.onEnterFrame;
}
_.stage.onceMouseMove=function():void
{
trace('listen to mouse move only once');
}
_.onMouseClick=function(e:MouseEvent):void
{
trace('listen to mouse click and get the event object');
}
17. FDOT Author: Ted Patrick
Twitter: @__ted__
a collection of ActionScript 3
classes that make hard things
easier.
f.net.Load - Load text to binary
with one method call and one
callback.
f.net.Message - Simple callback
messaging for classes.
f.data.ObjectStore - Simple object
database for storing anything
20. Usage Modeling - Generated Class
package f.model
{
import f.model.Parent;
[Event(name="myEvent", type="flash.events.Event")]
public class Sample extends Parent
{
public static const PROGRESS:String = "f.events.LoadEvent.PROGRESS";
public var bytesAvailable:int = 56;
public var bytesLoaded:Array = [];
public var bytesTotal:int = 56;
public var data:Object = {};
public var error:String = "woops";
public var loader:Object = {};
public var percent:Number = 0.75;
public var status:String = "status 23";
public function Sample(param1:int=3, param2:String="abc", param3:Object=null){
//TODO: implement method
}
public function foo(param1:int=1, param2:int=2, param3:int=3):void{
//TODO: implement method
}
}
}
21. as3Query Author: Nitoyon
Twitter: @nitoyon
Inspired by jQuery.
Ported from jQuery 1.2.1
Brings lambda chain decorating to
AS3
Supports CSS Selectors
Supports creating instance, and
setting its properties in one line
Enables simple Event Listeners
Has addTween method to play with
Tweener library