Adobe Flash CS: Category

Category: Adobe Flash CS

JSFL: fl.addEventListener() & fl.removeEventListener()

Posted At: November 2, 2010 6:38 AM | Posted By: Ben Schmidtke
Related Categories: Adobe Flash CS, JSFL

I’ve been experimenting with the Flash CS5 JSFL API lately and ran across these handy methods adding and removing event listeners to the fl object. However, I discovered that the functionality has changed from what the documentation states. After digging around the internet for some answers with no luck, I finally contacted Adobe about it and sure enough here is what they say.
fl.addEventListener now returns an eventID (valid across FLA files for that Flash session) when you add an event listener. When you remove the event listener, you have to specify the event type and the event id.
Example for adding: var evtID = fl.addEventListener("documentChanged", docChangedHandler); Example for removing: fl.removeEventListener("documentChanged", evtID); This affects Flash CS4 & Flash CS5. Hopefully this clears things up for people and hopefully the documentation will be updated soon. After experimenting with it while attempting to prevent duplicate event listeners from being added when working with a windowswf that has been opened and closed repeatedly, now you can derive a way to persist the id’s and keep your panel from adding duplicate listeners. Pretty handy I must say.

Comments (2)

Using FlexUnit 4 with Flash CS5

Posted At: May 10, 2010 10:18 PM | Posted By: Ben Schmidtke
Related Categories: ActionScript, Adobe Flash CS, Adobe Flex, FlexUnit

After all these years I still love working in the Flash IDE. It is a raw pure form of ActionScript that presents you with a blank canvas to express your creativity. Having said that, our mindless creations need solid testing before being released to the public. Today I will talk about the most direct way of using Flex Unit 4 with your ActionScript 3: Flash CS Project, by directly adding the Flex Unit SWC to your FLA. This gives full access to the FLA library during the tests. The easiest way to describe this is the FLA library is comprised of Class objects that are not external files, and they need testing too. More

Comments (4)