So you might be embedding you SWF into an HTML page and then you discover that stageWidth/stageHeight are almost but not entirely unrelated to the actual dimensions of the embedded component. Or, rather, it’s more complex than that: they equate exactly to the dimensions you provide, but drawing a box from (0,0)->(stageWidth,stageHeight) doesn’t actually [...]
Archive for August, 2007
Why isn’t stageWidth == stageWidth?
Posted in Uncategorized on August 27, 2007 | Leave a Comment »
stageWidth vs width (aka, “why is width zero?”)
Posted in Uncategorized on August 27, 2007 | Leave a Comment »
So one of the first things you might wonder is “what’s my width?” Probably the first thing you’ll do is just test this.width (ie, the width of the current sprite). However, it’s zero. Then you might think to try stage.width, but it’s also zero. The correct answer is stage.stageWidth.
As for the [...]
My First Animation
Posted in Uncategorized on August 27, 2007 | Leave a Comment »
Ready for some animation? It’s quite easy: just listen for the ENTER_FRAME event sent by the “stage” (the object representing the canvas on which all graphics are drawn) as follows:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Stage;
public class HelloWorld extends Sprite [...]
No way to pass primitive types by reference?
Posted in Uncategorized on August 26, 2007 | Leave a Comment »
Wow, that’s very strange.
HelloWorld.html
Posted in Uncategorized on August 25, 2007 | Leave a Comment »
Generally you don’t want your component to take up the entire page. Rather, you want to embed it somewhere in another page. No trouble, just put this in a HelloWorld.html file and you’re good to go:
<html>
<body>
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″
[...]
HelloWorld.swf
Posted in Uncategorized on August 25, 2007 | Leave a Comment »
One thing I was surprised to learn is how easy it is to program in ActionScript. It’s pretty much just like a compiled version of JavaScript, with a few slight improvements. One thing to keep in mind, however, is the output is a SWF file rather than an EXE, and the “application” is [...]