Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bunch of handy prototypes to make actionscript development easier. Inspired by ruby, rails and jQuery etc.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 leanUnit
Octocat-spinner-32 prototypes
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Array.as
Octocat-spinner-32 MovieClip.as
Octocat-spinner-32 Number.as
Octocat-spinner-32 Object.as
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 String.as
Octocat-spinner-32 TODO
Octocat-spinner-32 XMLNode.as
Octocat-spinner-32 proto.as
README.rdoc

Description

Sweet prototypes for actionscript that extend core classes with stuff to make your life easier.

In need of documentation and is under quite heavy development.

Usage

Move the prototypes directory over to your .fla directory or add a classpath so your compiler can find it.

Import the namespace before including:

import prototypes.*

Include everything with:

Prototype.includeAll()

Include all functions from a specific prototype by:

MovieClipPrototype.includeAll()

Include a specific function from a specific prototype by:

MovieClipPrototype.include( "isMouseOver" )

The last one remains quite untested at the moment so can't promise that it works.

Gotchas

To use the extensions on Number directly on a number without using a variable you need to enclose it in parenthesis or the compiler will shoot syntax errors at you.

// Syntax error
trace( 1.day.ago )

// Works just fine!
trace( (1).day.ago )

// Also works
var n = 1
trace( n.day.ago )

Sometimes you might want to use each on a non variableized array. The flash compiler has some truly weird behaviour when it comes to this. Here's the breakdown.

// Silent failure with adobe compiler, works with MTASC given that you specifically ended the previous line with a ;
['asdf', 'qwer'].each( function(element) { trace(element) } )

// Enclosing the whole thing in parenthesis makes it work on both compilers
(['asdf', 'qwer'].each( function(element) { trace(element) } )) 

// Works with the adobe compiler but not with MTASC
new Array('asdf', 'qwer').each( function(element) { trace(element) } ) 

// Pre assigning the array to a variable always works
var a = ['asdf', 'qwer]
a.each( function(element) { trace(element) } )
Something went wrong with that request. Please try again.