Archive for the ‘AS 3.0’ Category

CASA Lib – An Open Source Code Library for Actionscript 2.0 & 3.0

Posted on the September 16th, 2010 under AS 3.0, utility Classes by Vipin

Another cool AS 3.0 library which solves your common needs. It gives a core set of classes, interfaces and utilities to get your common tasks done in a fast and reliable way. Doesn’t have any framework dependency (read Flex) so can be used with Flex and Flash projects.

Home Page

Below are some of the cool stuff in the library.

org.casalib.time package has some very useful classes.

EnterFrame – creates a centralized EnterFrame event, even if your class is not a Display Object.

FrameDelay – registers a callback method after specified number of frame executions (Read as advanced callLater() method of Flex)

Inactivity – Determine user inactivity based on Mouse movement and key press. Detects inactivity and ‘back to active’ events.

Interval – Simplified Timer() class.

Sequence – Registers functions and executes them in sequence.

org.casalib.load – has a list of load classes for various file types.

org.casalib.collection has two List data structure implementations. List is similar to any Java List class. There is another UniqueList class which will only allow unique values to be stored in it; which will be quite handy.

org.casalib.utils package has a collection of very good utility classes which will difintely help you.

Short – Simplifying Actionscript for Designers

Posted on the September 15th, 2010 under AS 3.0, flash by Vipin

Here is a nice library from Arul, which is made to remove the verboseness of Action Script 3.0.

Short

When Action Script 3.0 was introduced with Adobe Flash CS3, it was a game changer and it definitely changed the way applications are coded in Flash. We moved to true Object Oriented Programming and the complexities and beauties of Software Engineering.

That’s the developer part of the story. Designers? This change left the designers in a complex web of codes which was too verbose and I have seen people getting lost, or they didn’t want to add those simple scripts (or actions) they used to add to the movies.

For adding an action to a button you could do below prior to CS3 release.

On the button itself:


onClick{

}

or on the frame


buttonInstance.onClick(){

}

But see what is required to do the same in CS3 or later releases of Flash:

on the frame (and only on the frame. No script is allowed on the button or movie clip):


buttonInstance.addEventListener(MouseEvent.CLICK,buttonClickHandler);

function buttonClickHandler(e:Event)

{

//Code here...

}

Here is what you should do to add an enterFrame event and animate an object.


this.addEventListener(Event.ENTER_FRAME, eventHandler);

function eventHandler(e:Event):void

{

//Code here...

}

Here is where Short comes in as a great help. Short tries to simplify things again and put that smile back on Designer’s face, to some extend.

The above tasks simplifies to:

on the frame:


_.to = this;

_.button.onClick=function(){

//

}

or even simpler, as you used to do before:


$(instance).onClick=function() { }

//For enterFrame checks
$(stage).onEnterFrame=function(){ }

//Roll over
$(instance).onRollOver=function(){}

Only additional thing you are adding is just the $(..), which way easier than the ‘Flash’’s native coding.

Now, on to how to configure the Flash IDE for using Short. Head to the Google Code page of Short and grab the latest SWC (Short.swc) from the download page.

If you are a designer and needs to use this in all the work you are doing, it make sense to add the library permanently. Follow below steps.

1. Download the SWC
2. Go to the folder <installation Directory>\Common\Configuration\ActionScript 3.0\libs\ and copy the SWC here. The path looked like below on my Windows XP machine with Flash CS5

C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\ActionScript 3.0\libs

Now open up Flash IDE and start writing ‘Short’ codes.

If you want to add the SWC on a project basis, follow below steps.

  • Select ‘File’ from menu.
  • Choose Publish Settings
  • Click the Flash tab
  • Select Flash Player 10 and ActionScript 3.0
  • Click Settings
  • Select the Library path tab
  • Add Short.swc

Good to go.

If you are using Short with Flex/Flash Builder(I dont know one will use this with Flex/Flash Builder), you can copy the SWC to the ‘libs’ folder or add using property panel of the project.

More details in the Google Code home page for Short. Short was demoed at the Adobe Flash Platform Summit 2010.

AS 3.0 Dropbox API

Posted on the September 4th, 2010 under AS 3.0 by Vipin

Here is the Actionscript 3.0 API for the Drop box service. The library works only with AIR, as there is no crossdomain.xml file in the Drop box servers and Flash Player will not allow the communication due to cross domain security policy (That would have been cool).

Haven’t seen any implementation of the library (what the official app cannot do) so far.

Google Code Home Page

AudioPhile – AS3 Sound Generation and Visualization

Posted on the July 20th, 2010 under AS 3.0 by Vipin

AudioPhile is a collection of projects for audio generation and visualization. There are two projects under it.

Audiophile – An AS3 library for generating dynamic audio in Flash Player 10

Audiovision – An AS3 library for visualizing audio in Flash Player 10

Here is a link to an example

Google Code Home Page

Worth noting that its a FP 10 only library.

AsWing – ActionScript Application Development Framework

Posted on the May 25th, 2010 under AS 3.0, Frameworks by Vipin

AsWing is an Open Source ActionScript 2.0/ActionScript 3.0  GUI framework and library. Its a UI centric library, and is similar to Java Swing in implementation. You can either use this library to build your application, or get only what you need.

Here is the link: AsWing

Here are some applications built using AsWing of which the Flash Mini Builder is an interesting project.

AS3 Game Gears – Libraries for game development

Posted on the May 7th, 2010 under AS 3.0, game development by Vipin

Here is a collection few open source libraries targeted at Game Development.

AS3.0 Gears

AS3 Utils – Collection of reusable package-level functions that solve common problems

Posted on the May 5th, 2010 under AS 3.0 by Vipin

Here  is a collection of utilities provided as package level functions by John Lindquist.  Here is a list of utility packages:

  • array
  • color
  • conversions
  • date
  • event
  • garbage collection
  • html
  • number
  • string
  • validation
  • and more…

There are many more like bringToFront(), sendBackward() for display objects, Array shuffle (using the Fisher Yates algorithm etc)

Visit the GitHub Page here.

AS3 Dotted Line Class

Posted on the March 11th, 2010 under AS 3.0 by sahana

Here is an ActionScript 3 class I use all the time to draw pixel perfect dotted lines in Flash. Free for any use other than reselling. It uses the good old bitmap filling.

Download

ActionScript Mouse Gesture Library

Posted on the March 6th, 2010 under AS 3.0 by Vipin

A very easy to use Mouse Gesture class for AS 3.0 projects. The gesture is based on the mouse movements as shown below:

Mouse Gestures

Then you go on defining your gestures as a progression of these numbers. On to code:

Instantiate it. Pass the stage reference, or wherever you want it to work.

mg  = new MouseGesture(this.stage);

Add a gesture. Param 1: A string constant as an identifier. Param 2: The gesture number itself (above numbers) Here it is just a single action which will be ‘click and drag to right’ (see image)

mg.addGesture(PLAY,"0"); 

Add a complex gesture as a progression of above numbers. (Guess what it is)

mg.addGesture(STEP_BACKWARD,"65432"); 

Now add the listener.

mg.addEventListener(GestureEvent.GESTURE_MATCH,matchHandler);  

Now your listener.

private function matchHandler(event:GestureEvent):void

{

switch(event.datas)

{

case PLAY:

// DO whatever you want

break;

case GESTURE_MATCH:

// DO whatever you want. Yes again...

break;

}

}

Bingo! Easy, isn’t it?

Home Page

Download

Samples:

At ByteArray.org

RobotLegs AS3.0 Application Development Framework

Posted on the March 6th, 2010 under AS 3.0, Flex, Frameworks by Vipin

Robotlegs is an AS 3.0 micro-architecture (or call it framework) to use with your AS 3.0 or Flex Projects. Its just an extension of PureMVC and adds Dependency Injection to it. Didnt try it personally but says it reduces the amount of boilerplate code to be written to setup a PureMVC application. It also avoids Singletons and static constants from your projects. It supports Modules (It has to, as PureMVC does it).

Home Page

Download