Thanks for the clarification Francis.

--- In flexcoders@yahoogroups.com, "Francis Cheng" <[EMAIL PROTECTED]>
wrote:
>
> In ActionScript 3.0, the delete operator only works on properties
of
> objects, not on instances of a class. Setting the 'ping' variable
to
> null is the way to go. As long as the variable 'ping' is the only
> reference to the PingTime instance you created in your init()
function,
> you can make the instance eligible for garbage collection by
setting
> ping to null (in removePing(), if you prefer).
>

>
> Francis
>

>
> ________________________________
>
> From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
> Behalf Of Tim Hoff
> Sent: Tuesday, May 16, 2006 12:05 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: delete class instances
>

>
> Make the bad ping go away!  ;)
>
> If you are instantiating the class:
>
> import PingClass;
>
> public var myPingClass : PingClass = new PingClass;
>
> I believe that you can either set it to null:
>
> myPingClass = null;
>
> or delete it:
>
> delete myPingClass;
>
>
> -TH
>
> --- In flexcoders@yahoogroups.com, "Sonja Duijvesteijn"
> <treinmobiel@> wrote:
> >
> > I've been working with Flex since last Februari, and since then
I've
> been
> > having a problem with classes. Since it's seemed foolish that I
could
> not
> > find the solution myself I've been hesitant to ask but here goes.
> >
> > How do you delete and instance of a class?! I've set up a small
> example with
> > a class 'PingTime' which says 'ping' every second. And I'd like
it to
> stop,
> > but not just stop but completely remove the class out of memory.
How
> do I do
> > that? I'm sure there's a solution, and probably it's in the docs
> somewhere,
> > but I just can't find it.
> >
> > How do I make the pinging stop?
> >
> > Kind regards,
> > Sonja Duijvesteijn
> >
> > package sd.classes {
> > import flash.utils.Timer;
> > import flash.events.Timer! Event;
> > import mx.core.Application;
> >
> > public class PingTime {
> > private var timer:Timer;
> >
> > public function PingTime() {
> > timer = new Timer(1000);
> > timer.addEventListener(TimerEvent.TIMER, sayPing);
> > timer.start();
> > }
> >
> > private function sayPing(event:TimerEvent):void {
> > Application.application.pingTxt.text += "ping "
> > timer.reset();
> > timer.start();
> > }
> > }
> > }
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
> > creationComplete="init()">
> > <mx:Script>
> > <![CDATA[
> > import sd.classes.PingTime;
> > private var ping:PingTime;
> >
> > private function init():void {
> > ping = new PingTime();
> > }
> >
> > private function removePing():void {
> >
> > }
> > ]]>
> > </mx:Scr! ipt>
> > <mx:Button x="10" y="10" label="stop Ping"/! >
> > <mx:TextArea x="10" y="56" width="445" height="143"
> click="removePing()"
> > id="pingTxt"/>
> > </mx:Application>
> >
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
>
> ________________________________
>
> YAHOO! GROUPS LINKS
>

>
> *      Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
>        
> *      To unsubscribe from this group, send an email to:
>       [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
subject=Unsubscribe>
>        
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
>

>
> ________________________________
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to