Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-6 of 6 total  RSS 

sys font alpha in as3

// apply a filter to a system font in order to adjust alpha

myTextField.filters = [new BlurFilter(0,0,0)];
myTextField.alpha = 0.5;

Single-Line commenting in Actionscript with Textmate

- open the bundle editor and select the Actionscript bundle
- use the add button to make a new preference item, give it a scope of source.actionscript
- name it whatever
- paste in the following:

{   shellVariables = (
        {   name = 'TM_COMMENT_START';
            value = '// ';
        },
    );
}


- that's it! got these instructions on IRC from Infininight: http://pastie.textmate.org/private/clmfldbv2sexjcd7u6qjw

AS3 FlashVars equivalent: LoaderInfo

// Add this to your package..
import flash.text.*;

// And throw this in wherever..
var t:TextField = new TextField();
t.autoSize = TextFieldAutoSize.LEFT;
t.border = true;
addChild(t);

t.appendText("params:" + "\n");
try {
var key:String;
var val:String;
var flashvars:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (key in flashvars) {
val = String(flashvars[key]);
t.appendText("\t" + key + ":\t" + val + "\n");
}
} catch (error:Error) {
t.appendText(error);
}

Make AS3 clips turn cursor into a hand on rollover..

  buttonMode = true; 
  mouseChildren = false;

AS3 SwapDepths Equivalent

function move_to_top() {
  // This will move the current object to the topmost z-index
  parent.setChildIndex(this, parent.numChildren-1);
}

inspect as3 type

// description of your code here

trace(describeType(TYPE-NAME));
« Newer Snippets
Older Snippets »
Showing 1-6 of 6 total  RSS