This content has been marked as final. Show 5 replies
I've added a Boolean called "callMain" and used _root.watch("callMain") to watch for it to change. Then I replaced the call to m ain, with "callMain = true;"
Now it calls main, but even with the "root.unwatch("callMain")" it creates an infinite loop!
Try attached code. Otherwise post a link to a zip with all files.
Thank you very much LuigiL!
I don't think I would have ever thought of that. I tried all sorts of complicated things to get around this problem (including using the .watch() method) but none of them worked.
This was the final puzzle piece to making my program run properly. Yet I have no idea WHY it works. Does "this" refer to something else when used inside of an onEnterFrame? I even tried _root, and that didn't work either.
>>Does "this" refer to something else when used inside of an onEnterFrame?
Inside callback handlers the class members are out of scope. Inside the onEnterFrame 'this' points to _root since you attached the onEnterFrame to the root. One way to solve this is using a local reference to the current class - in the code the var thisObj. Then you have a pointer to the class and can access the class members -> thisObj.Main()