[Flashcoders] phantom flash class instance

2006-10-19 Thread grimmwerks

Ok, this is a flash question

I've got a class I'm using in an app - it's really simple, just is a
'slideshow' type class; it gets a list of images and cycles through
them as a slideshow with an interval between.

Now it's being used in a movieclip that is in turn being loaded in a
Window component.  When a user clicks the window component close
button, I've got it unloading the movieclip instance; but the
slideshow class still tries to continue cycling through it's images
array -- ie it's 'instance' is still going even though the movieclip
that birthed it is gone.

For example: the slideshow class, upon birth, gets it's 'owner/parent'
movieclip upon it's birth. It then creates a new movieclip (myBack)
and starts attaching jpgs to the myBack instance. When the main screen
movieclip in the Window instance is removed, myBack no longer has a
_url because it doesn't exist. I thought I could use the fact that
myBack==undefined to clearInterval() and stop the phantom slideshow,
but it doesn't stop.

So how does one 'unload' a class, or really, a class instance?
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] phantom flash class instance

2006-10-19 Thread Hans Wichman

Hi,
implement a destroy method in the class, in which you tell it to release all
its own reference, next release all reference to the object itself.
Make sure there are no hidden references, (delegates, setIntervals,
movieclip pointers, globals) etc to the instance, so it can be garbage
collected.

greetz
JC


On 10/19/06, grimmwerks [EMAIL PROTECTED] wrote:


Ok, this is a flash question

I've got a class I'm using in an app - it's really simple, just is a
'slideshow' type class; it gets a list of images and cycles through
them as a slideshow with an interval between.

Now it's being used in a movieclip that is in turn being loaded in a
Window component.  When a user clicks the window component close
button, I've got it unloading the movieclip instance; but the
slideshow class still tries to continue cycling through it's images
array -- ie it's 'instance' is still going even though the movieclip
that birthed it is gone.

For example: the slideshow class, upon birth, gets it's 'owner/parent'
movieclip upon it's birth. It then creates a new movieclip (myBack)
and starts attaching jpgs to the myBack instance. When the main screen
movieclip in the Window instance is removed, myBack no longer has a
_url because it doesn't exist. I thought I could use the fact that
myBack==undefined to clearInterval() and stop the phantom slideshow,
but it doesn't stop.

So how does one 'unload' a class, or really, a class instance?
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] phantom flash class instance

2006-10-19 Thread Muzak
You have to remove the interval before the slideshow gets removed.
You can add an onUnload method in the slideshow class.

class SlideShow extends MovieClip {
 function SlideShow() {
 }
 function onUnload() {
  // remove interval
 }
}

regards,
Muzak

- Original Message - 
From: grimmwerks [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Thursday, October 19, 2006 2:03 PM
Subject: [Flashcoders] phantom flash class instance


 Ok, this is a flash question

 I've got a class I'm using in an app - it's really simple, just is a
 'slideshow' type class; it gets a list of images and cycles through
 them as a slideshow with an interval between.

 Now it's being used in a movieclip that is in turn being loaded in a
 Window component.  When a user clicks the window component close
 button, I've got it unloading the movieclip instance; but the
 slideshow class still tries to continue cycling through it's images
 array -- ie it's 'instance' is still going even though the movieclip
 that birthed it is gone.

 For example: the slideshow class, upon birth, gets it's 'owner/parent'
 movieclip upon it's birth. It then creates a new movieclip (myBack)
 and starts attaching jpgs to the myBack instance. When the main screen
 movieclip in the Window instance is removed, myBack no longer has a
 _url because it doesn't exist. I thought I could use the fact that
 myBack==undefined to clearInterval() and stop the phantom slideshow,
 but it doesn't stop.

 So how does one 'unload' a class, or really, a class instance?


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com