Skip to content

Instantly share code, notes, and snippets.

View amowu's full-sized avatar

Amo Wu amowu

View GitHub Profile
@amowu
amowu / EnumerableClass.as
Created November 6, 2012 10:42
Looping over properties of a Class (property enumeration)
//Get an XML description of this class
//and return the variable types as XMLList with e4x
var varList:XMLList = flash.utils.describeType(VO)..variable;
for(var i:int; i < varList.length(); i++){
//Show the name and the value
trace(varList[i].@name+':'+ VO[varList[i].@name]);
}
@amowu
amowu / EnumerableObject.as
Created November 6, 2012 10:47
Looping over properties of a Object (property enumeration)
for (var key:String in object)
{
trace(key+':'+ object[key]);
}
@amowu
amowu / StringToObject.as
Created December 4, 2012 11:04
Get a Class Reference by Class Name
import flash.utils.getDefinitionByName;
var ClassReference:Class = getDefinitionByName("CLASS_NAME") as Class;
var obj:Object = new ClassReference();
@amowu
amowu / GetClassBySWF.as
Created December 19, 2012 17:32
Get Class by external load .swf
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.events.Event;
import flash.system.ApplicationDomain;
@amowu
amowu / RemoveEventListener.as
Created December 22, 2012 09:01
Remove self closure function event listener.
var obj:DisplayObject = new DisplayObject();
obj.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
obj.removeEventListener(event.type, arguments.callee);
});
@amowu
amowu / Filter.as
Created December 26, 2012 15:31
Use filter function with array.
array.filter(filterFunction);
private function filterFunction(item:Object ,index:int, arr:Array):Boolean
{
// Do anything..
}
@amowu
amowu / shake.mxml
Last active December 10, 2015 05:18
Flex shake effect.
<s:Panel id="ui">
<!-- anything -->
</s:Panel>
</fx:Declarations>
<s:Sequence id="shake" target="{ui}" duration="30">
<s:Move xBy="20"/>
<s:Move xBy="-20"/>
<s:Move xBy="20"/>
<s:Move xBy="-20"/>
@amowu
amowu / ArrayCollectionSort.as
Created January 3, 2013 11:11
ArrayCollection sort function.
package classes.utils
{
import mx.collections.ArrayCollection;
import mx.collections.Sort;
import mx.collections.SortField;
/**
* Useful functions to manipulate arrays
*
* @author Cyril Mazur cyrilmazur.com
@amowu
amowu / NERDTree.md
Last active December 11, 2015 01:38
  • To toggle the vertical NERDTree window on and off, use :NERDTreeToggle
  • To open a tab and move into it use j or k to navigate the file you want to open, then hit t from the NERDTree window
  • To open a tab but stay in the current tab, use j or k to navigate the file you want to open, then hit T from the NERDTree Window
  • To move a file in the NERDTree window, use m
  • To add a file in the NERDTree window, use a
  • To navigate to the next tab, use gt
  • To navigate to the previous tab, use gT
  • All window commands start with ctrl w
  • To move back to the NERDTree window from another split window in the current tab, use ctrl ww or ctrl wh
  • To move between windows in general, ctrl wh takes you left, ctrl wl takes you right, ctrl wj takes you down and ctrl wk takes you up.

#Sublime Text 2 - Shortcuts (Mac OSX)

##Default

###General

Command Shortcut
Command palette + + P
Toggle side bar + K + B