• Hi,

    I'm wondering what are we supposed to close in stopplugin.

    I'm making a hotspot plugin which will be loaded and unloaded a lot of time, so I'd like to optimize the performance and really close all the variable when closing the swf.

    - Is it necessary to set the global (private var) boolean, array and integer to null (it displays an error) or something else ?

    for instance, Klaus, in radar.as you don't do anything with the String variable pluginpath in stopplugin. Is there any particular reason ?

    - I have the error

    Code
    "Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
    	at hotspot/newEffect()"

    in flash debug when I set some variable to null.

    Translation : It's impossible to access to the property or the method of a null reference objet at hotspot/newEffect()

    Do you have an idea about this error ?

    Thanks

  • Hi,

    on closing the plugin, the plugin should stop all own handlers, remove all own objects from stage, and removing everything else it has added/created,


    Quote

    I'm making a hotspot plugin which will be loaded and unloaded a lot of
    time, so I'd like to optimize the performance and really close all the
    variable when closing the swf.

    it's more imported to remove any handlers/timers,
    e.g. when a object is removed, but the handler/timer is still running...

    Quote

    Is it necessary to set the global (private var) boolean, array and integer to null (it displays an error) or something else ?

    no, normally not,

    Quote

    for instance, Klaus, in radar.as you don't do anything with the String
    variable pluginpath in stopplugin. Is there any particular reason ?

    simple objects(strings too) are automatically free in Flash, when there is no reference to it anymore,
    there is no need here to set "pluginpath" to null,

    Quote

    Do you have an idea about this error ?

    sorry, but without seeing the code of your plugin, no
    there are so many reasons possible,

    best regards,
    Klaus


    I

  • Thanks for your reply

    simple objects(strings too) are automatically free in Flash, when there is no reference to it anymore,
    there is no need here to set "pluginpath" to null,

    The term "simple object" is a little confusing for me. What object is simple, what object is not ? (for instance : loader is simple ? Bitmap is simple ?)

    I've another question : If I set "useWeakReference" to true from my listener, do I have to bother about removing event listener if I set "null" to the associated object ?

  • Hi,

    sorry about the term "simple object", I just mean "normal" Flash Objects

    Quote

    I've another question : If I set "useWeakReference" to true from my listener, do I have to bother about removing event listener if I set "null" to the associated object ?

    no, "useWeakReference" just means if you pass a "inner" Function" as Listener, it will be automatically removed,

    event listeners itself should be always removed!
    here a quote from the Flash docu about it:

    Quote

    If you no longer need an event listener, remove it by calling removeEventListener(), or memory problems could result. Objects with registered event listeners are not automatically removed from memory because the garbage collector does not remove objects that still have references.

    see also here:
    http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/events/EventDispatcher.html#addEventListener()

    best regards,
    Klaus

  • I just mean "normal" Flash Objects

    Like all the "Top Level" variables : http://help.adobe.com/en_US/AS3LCR/Flash_10.0/index.html ?

    Quote

    no, "useWeakReference" just means if you pass a "inner" Function" as Listener, it will be automatically removed

    Ok, I Think I understand now the useWeakReference : if the function is not disponible, it deleted the listener. I think it was : if the objet was removed (set to null), the listeners was also removed ...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!