Iterating properties creates unwanted side-effects

Also known as:

  • iterating properties in actionscript 2 causes getter setter to execute

I was working on our AS2 logger today. In particular I was creating a setup where you could simply drop in a couple components in your fla and ‘tada’, you would have a reflecting logger at your disposal.

I’ll go into the reflecting logger and component creation in another post, because what happened was that during a test run I ran into the dreaded 256 levels recursion problem.

Some research indicated that the problem lay with getters and setters.

Read more

Finding character positions in ActionScript 2

Also known as:

  • finding the position of a character in a dynamic textfield with embedded fonts using actionscript 2

One of current projects involves some texteffects and I am loath to do anything on the timeline that can be done quicker by code. So my basic idea was (keeping the designer in me happy):

Doing the design stuff at design time on stage:

  • put a dynamic textfield on stage
  • apply a font, fontsize, color, anti-aliasing
  • apply effects such as dropshadow, glow etc to make it look good

Doing the animate stuff at runtime through code:

  • break apart the stage textfield into little textfields that I could animate

At this point I was already thinking about converting the stage textfields to bitmaps but found I was thinking about optimising things too early, so back to KISS, basic principles first.

Read more