Friday, January 14, 2011

Miscellaneous Functions for AS3

Here are some miscellaneous functions for AS3, I made them myself, list :
- rangedIntRandom
   //returns a random integer from rangeLow up to (and including) rangeHigh
- rangedFloatRandom
   //returns a random float from rangeLow up to (and including) rangeHigh
- myAddEventSimple
   //adds an event to an object, similar to myAddEvent in my another post, but this is the essential version
- movieClipAsButton
   //treat a movie clip as a button.. moves to frame 2 when mouse over, to frame 3 when mouse pressed
- trim
   //removes leading and trailing space or enter/return characters from a String
- randomOrderInArray
   //random the elements in an array.. for example (0,1,3,4) becomes (1,4,0,3)
- myGetBounds
   //return a detail coordinate of an object : xMin, yMin, xMax, yMax, xMid, yMid
- formatDecimal
   //cuts the number count after comma in a float, as you like, you can set how many number after comma
- myRemoveMovieClip
   //removes a movie clip which is attached using script,similar to my another post in this blog
- myAttachMovie
   //attach a movie clip from the library, similar to my another post in this blog

Download the FLA file here : (I added the usage example in the file also)
   http://www.mediafire.com/?85zxf7kbdawaxfl

No comments:

Post a Comment