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

    JSFL FLfile.listFolder archive bit bug

    Today I ran into a nasty ‘feature’ of FLfile.listFolder in Flash 8 on Windows XP.

    FLfile.listFolder doesn’t list files that don’t have the archive flag enabled.

    Workaround: none except enabling the archive flag for all files you are searching for.

    Flash 8 hitArea quirks

    Also known as:

    • dynamically drawn hitarea bug
    • filter applied hitarea bug
    • hitarea no longer works
    • hitarea stops working

    I recently noticed two weird bugs while handling hitArea’s in Flash (I say bug you might say feature).

    Situation 1:

    • you have a clip on the timeline, let’s call it dialog
    • you have a large hitarea below the dialog, let’s call it largeHitArea
    • you have connected the hitarea to the dialog: dialog.hitArea = largeHitArea
    • you have set the onPress of the dialog to anything but null

    Everything works fine up to this point, the large hitarea makes the dialog act as a modal dialog, since you cannot trigger any mouse events below it.

    Read more

    Consuming webservices in Flash 8

    During a partial refactoring process of the Behrloo client system, one of the items on my list was the backend webservice result processing. Without going into a lot of detail how these services are wrapped, it suffices to say that somewhere in the application a couple of webservices are being initialized and utilized through the macromedia webservice classes.

    You might be familiar with them, they come in several flavours, for example the WebServiceConnector and the Webservice class. Personally I don’t like to use the WebServiceConnector, mostly since the Webservice class is simple enough to use and tends to give you more control over what is happening.

    Basic example

    As a simple example of using this Webservice class, paste the following code onto the first frame of the timeline in a new fla document (on a sidenote, REAL applications are not written on a timeline, but for example purposes/quick proof of concepts, this will do just fine):

    Read more

    Non selectable transparent textfield with embedded font

    Some of the V2 Flash Components are less than intuitive now and then. While working on the new trophy tour for Heineken we had to create an application with a transparent textarea with non selectable non editable text using a non standard (embedded) font with Spanish characters.

    Oh and the text had to be rendered smoothy using advanced anti-aliasing.

    This leaves you with different options. Although I was tempted to simply use a standard textfield, this should be easy to implement using a TextArea component as well, right? As a reference for our own and your convenience, here is a step by step approach.
    Read more