Attn: Job Beebe Re: Hi-Jack Optimizations

And of course, if anyone else knows the answer, please answer! :) Thanks.

I'm taking a look at your tutorial here http://jonbeebe.net/hi-jack-optimizations but it doesn't seem to work. I put a print("hijacking") line in there and just commented everything else and it never prints to the terminal. Am I doing something wrong?

1
2
3
4
5
6
7
8
9
        g.oldRemoveSelf = g.removeSelf
        
        -- Let the hi-jacking begin:
        function g:removeSelf()
                print("HIJACKING")
            -- call the original removeSelf() function:
            --myObject:oldRemoveSelf()
            --myObject = nil
        end

Hmm, I think I've figured out why this isn't working. I was under the impression that removeSelf() would be called recursively on all the children of the display group. It appears this is not the case. So if I use the director class, create an image and insert it into the localGroup, I can override the localGroup:removeSelf() and get the line to print, but overloading the image object removeSelf() doesn't do anything.

Am I just completely off base to think that removeSelf() worked recursively(coulda swore I read it did), or do I need to make sure to call removeSelf() on every child object in my director group before changing scenes?

Well, if anyone cares....to get this to work properly with director I had to manually call the removeSelf() functions. Maybe this is normal, but I really did think part of director's selling point was that if you put stuff into the local group it all had removeSelf() called on it and dumped.

I *thought* that's how Director worked, too, but I also think there was a change in cleanup from v1.2 to v1.3 -- which version are you using?

Jay

I'm using 1.3

views:1580 update:2011/9/28 9:01:40
corona forums © 2003-2011