Flash HitArea quirks
Also known as:
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.
Now the following happens:
- during a graphical redesign you think you are smart, fast and furious YEAH BABY and you apply a DropShadow to the dialog clip on the timeline.
Next thing you know, your hitArea has died and gone forever, dramatic ain’t it?
Cause: no idea, but I think cacheAsBitmap has to do with it.
Workaround: set the dropshadow on the dialog clip through code.
Situation 2:
- you have a clip on the timeline to which you want to attach a dynamically drawn hitarea
Everything works fine up to this point.
Now the following happens:
- during a graphical redesign you think you are smart, fast and furious YEAH BABY and you apply a glow filter to the dynamically drawn hitArea.
Next thing you know, your hitArea has died and gone forever, dramatic ain’t it?
Cause: no idea, but I think cacheAsBitmap has to do with it (again)
Workaround: create a bitmap from the dynamicall drawn hitArea first, attach it to a clip, set THAT clip as hitArea and apply the glow filter to it.