You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

1

Friday, July 17th 2009, 10:50am

stopplugin

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

Source code

1
2
"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
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

2

Sunday, July 19th 2009, 3:37pm

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,


Quoted

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...

Quoted

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,

Quoted

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,

Quoted

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

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

3

Tuesday, July 28th 2009, 3:06pm

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 ?
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

4

Friday, July 31st 2009, 1:03pm

Hi,

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

Quoted

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:

Quoted

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

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

5

Saturday, August 1st 2009, 9:39am

I just mean "normal" Flash Objects


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

Quoted

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 ...
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

This post has been edited 1 times, last edit by "nelk" (Aug 1st 2009, 9:54am)