That isn't a reference to a function -- it's a reference to a object method.
The object has to hang around.

On 8/6/07, Hans Wichman <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> hmm okay this might seem like a basic question, but this has been
> bothering
> me for a while:)
>
> Imagine i have a class that prints "boo" 10 seconds after it has been
> created, but returns immediately, so eg:
>
>
> public function doTest() {
>      trace("here 1");
>      new BooTest();
>      trace("here 2");
> }
>
> doTest();
>
> this will print:
>
> here 1
> here 2
> boo
>
> My question is how does the garbage collector works in this case?
> Why isnt the BooTest object garbage collected before it executes since it
> has long fallen out of scope?
>
> I have no longer have any reference to the object, but still it is
> executing.
>
> My definition of BooTest:
>
>
> class BooTest {
>
> public function BooTest() {
>   setInterval (test, 1000);
> }
>
> public function test() {
>   trace ("boo");
> }
>
>
> }
> setInterval has a reference to the test function, but not to the object
> itself.
>
> Any ideas / pointers?
>
> greetz
> JC
> _______________________________________________
> [email protected]
> 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
>
_______________________________________________
[email protected]
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

Reply via email to