Tuesday, April 29, 2008

AS3 stage height and width (+ Hello)

A pretty common one and In AS2 you would access this property like this:

trace(Stage._height);
trace(Stage._width);


So in AS3, you might at first try something like this:

trace(stage.width);
trace(stage.height);


Only to find it now returns the bounds of any objects on the stage.
We now access the stage width and height in AS3 like this:

trace(stage.stageWidth);
trace(stage.stageHeight);


Have a nice day.

This is a new blog for people like me, who are migrating to from actionscript 2 (AS2) to actionscript 3 (AS3) out of necessity. I will be speaking mainly to [myself] people like me who are already professionals who can deliver AS2 projects swiftly and are now in need of maintaining client expectations so this blog will be light on the basic descriptions of how stuff works and feature a lot of code to copy and paste straight into a new document to get your AS3 projects over the line and on time.

I will colour the code, but I will leave the AS2 code (depreciated) in a nice comment shade of grey.

A little about me; I am a professional flash and web-application developer, I am also currently a sessional lecturer at Swinburne University teaching flash. OK.

No comments: