F9 for actions

Some possibly useful and definitely unuseful ActionScript 3.0 code.

May 17

Listening for stage selections with JSFL

I’ve researched and tested a few ideas, but for the most part the conclusion is that there is no nice way to monitor the stage for some sort of “Selection Event” when building WindowSWF panels or JSFL scripts. JSFL does allow you to listen for some events, however I found none of these to suffice for wanting to know when the user has selected an instance item on the stage.

Adding an ENTER_FRAME event listener to your panel works. Basically calling out to a JSFL script on each frame to see if anything is selected, but the thought of having this execution loop running is like nails on a chalkboard when it comes to being efficient. Also I noticed bugs when trying to drill into objects - double clicks not registering on the stage, etc. So that idea was pitched out the window. A timer would do the same to a lesser degree, but again it’s not as nice a solution as having Flash tell us that something was selected.

I ended up going with what I’ve seen in most 3rd-party panels - a button to manually tell flash “hey, I’m ready for you to analyze my selection I have made on the stage.” Although the manual part about this is annoying at best, it seems to be the “nice” solution for now.