(single) REDIGERET 16 June 2009 • by admin

Fra AS2 til AS3 – Kort og Groft

Strict scripting: Type definitioner

var untyped:*; // (or no typing) undefined
var boolean:Boolean; // false
var number:Number; // NaN
var integer:int; // 0
var unsignedInteger:uint; // 0
var string:String; // null
var object:Object; // null

Ingen acctionscripting direkte på knapper
Actionscripting på hovedtidslinien – og helst på første frame – eller i classes.

Knap-actions:

// event
home_button.addEventListener(MouseEvent.CLICK, home_button_handler);
 
// handler
function home_button_handler(event:MouseEvent):void {
gotoAndStop("homeLabel");
}

Properties

ActionScript 2 ActionScript 3
_name name
_x x
_y y
_width width
_height height
_xscale (0-100) scaleX (0-1)
_yscale (0-100) scaleY (0-1)
_rotation rotation
_alpha (0-100) alpha (0-1)
_visible visible
_xmouse mouseX
_ymouse mouseY
_parent parent