R – killing old objects in flash

actionscriptactionscript-2flash

Hi there first timer here.

I'm building a flash animation using the tweenlite library. It's extremely simple which is why this is so aggravating. It's basically a slideshow with 5 frames that crossfade. When a button that calls up the next frame fades out, I'd like to disable any actions it has on it. Currently it fades out, but when you roll over it you get the button cursor, and the overstate brings the opacity back up.

I am really a noob in flash so I'm sure this is extremely simple.

thanks,
Ryan

Best Answer

Anyway, there is no direcy way of deleting objects in AS even though you have a new operator to create one. All objects are garbage collected when there are no strong references of that object. Here are two things that you can do:

  • When adding event handlers to the button object or whatever, mark them as weak OR set the eventhandlers to NULL when you are through

  • Though there is no explicit delete in AS you can set the object to null using the var = null syntax to enable the garbage collector to mark it as read y for cleanup.

Related Topic