ActionScript 3

All posts tagged ActionScript 3




  • {flexSDK} – The path to the selected flex SDK



Not everyone realizes it, but you can actually customize the context menu that appears when you right click a flash application in ActionScript 3.  You can add new items and you can even remove some of the existing items.  But lets get one thing out of the way first:

Can I remove or hide the Flash context menu?

The answer is no, you cannot.  There is no way to hide the context menu, and although you can remove some items like the print option, there is no way to hide the “Settings…” or “About Adobe Flash Player” items.  But lets go over what you can do.

Continue Reading

I recently ran into a quirk with the getBounds() and getRect() methods of DisplayObject, where the returned x and y coordinates would be extremely high (and incorrect) values.  This occurs when the DisplayObject is empty, using the following code:

Executing the above code gives the following result:

What?!  Where are these crazy numbers coming from?  Since childObject was added as a child to parentObject without having its x or y coordinates modified, you would expect that x and y would be 0, but instead we get the unexpected result of 6710886.4!  It is worth noting that if you try to get the bounds of an empty object using itself as the argument to getBounds(), x and y return 0 as expected.  Now if we were to add anything that has a width and height to childObject, say a vector rectangle or a bitmap, the resulting x and y values are 0 as expected.

I am not totally sure what is going on here, but if you need to get the bounds of a child DisplayObject, you may want to add a check to make sure that childObject.numChildren is greater than 0 first.