All posts tagged function

Know where your function is called from

A very nice tip over there:

getBounds() on DisplayObject not functioning properly

Well in fact, it is… or is it not ? depends on how you see it. The trouble If using masks or objects that have their “visible” property on true but “alpha” at 0.0, it is taken into account into the calculation of the bounding rectangle. Even objects that are outside of the masked area […]

AS3 stop() function doesn’t work

Here is the “configuration”: One main movie that loads external movies. Externals movies that have stop() functions on their timeline. When played alone, the external movies run perfectly. The stop() functions work well and everything’s fine. But when loaded into the main movieclip, all the stop() functions stop working… (well in a way they work […]

Call a function by its name in AS3

Imagine you want to call a function but you don’t have its reference, only its name. Well everything in ActionScript 3 follows pretty much the same logic. Every member of an object can be accessed via object[“member_name”]; Now it should be easy to get a function from it: [sourcecode language=’as3′] var f:Function = object[“function_name”] as […]

Common mistakes when using hitTestPoint function of a DisplayObject

hitTestPoint is a very usefull function when you want to test if a point (x, y) hits a shape, even an irregular one. But there are a few but important things that you got to remember to get it to work properly: the dispay object you’re working on must be added to the display list. […]

AS3 arrays against linked lists performance benchmarking

Let’s have a look at arrays vs. linked lists, and for what use. Here, the assumption is that we need to access a property and/or call a function from a lot of objects in a list at the highest speed possible. Let’s say we are making a game and we want to go through all […]