Skip to content

Instantly share code, notes, and snippets.

View jacksonkr's full-sized avatar

Jackson jacksonkr

View GitHub Profile
@jacksonkr
jacksonkr / gist:1239861
Created September 24, 2011 21:06
Static Listeners in Action Script 3
/**
 * MyPlayer class
 */
 
package {
  public class MyPlayer extends MovieClip {
    /**
     * This static variable will hold our pending listeners for the class.
     * They will be instantiated once the constructor runs.
     */
@jacksonkr
jacksonkr / gist:1239830
Created September 24, 2011 20:37
AS3 Frame Change (by label) Listener
import flash.events.Event;
var _lastFrame:String = this.currentLabel;
function enterFrameHandler(event:Event):void {
if(this.currentLabel != _lastFrame) {
_lastFrame = this.currentLabel; // set this equal to this.currentFrame to listen for any frame changes instead.
dispatchEvent(new Event(Event.CHANGE));
}
}
@jacksonkr
jacksonkr / gist:1239417
Created September 24, 2011 14:56
print_r For Actionscript3
package com.jacksonkr.utils {
/**
* mimics the php print_r function
* jacksonkr.com <rollins.jackson@gmail.com>
*/
public
function print_r(obj: * ,
lvl: int = 0): String {
var str: String = '';
var sp = space(lvl);