Re: [Flashcoders] Delegate scope - superclass issue?
are you expecting it to call mySuperClass.myFunction, or mySubClass.myFunction? As far as I know, if you have overridden myFunction in the subclass, that will be called, rather than the super class's definition. I usually get around this with naming conventions, i.e. prefixing my private functions with the initials of the class. It's ugly, but safer, especially when you do a lot of inheritance. Nikolaj Selvik wrote: Hi, Thanks for welcoming me to your list! I´ve run into a problem using MM's delegate class, couldn't find any info on this particular issue so here goes: Example: "mySubClass" inherits from "mySuperClass" In "mySubClass" I have: myObject.addEventListener("click",Delegate.create(this, this.myFunction)); works fine if "myFunction" is defined in "mySubclass", just as it should, but not if Its defined in "mySuperClass". Why? Best Regards, Nick ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] method calls being delayed
The code I posted works :) The example was just to point out the nature of the error I was having, as I found it hard to explain with words alone. The problem occurs in a much larger chunk of code. It is incredibly difficult to track down the difference, hence my post: I was hoping someone had already had this problem and could tell me where to look. I don't know if you read me saying, but changing the called method to a static member made it work - the plot thickens. Chris Velevitch wrote: On 11/28/05, Nick Griffiths <[EMAIL PROTECTED]> wrote: The examples are supposed to work Are you saying, the code fragment you posted isn't working for you? The same code will run correctly if called differently. So what is the difference in the two ways you're calling the failing code? What I want to know is, has anyone had anything similar happen to them, i.e. a called method doesn't execute until after the callee has returned, meaning you can't get the result of the called method. It sounds vaguely familiar, but I've obviously fixed the problem and (hopefully) learnt my lesson. But I don't recall what went wrong and how I fixed it. The 2 classic problems that I seem to be continually getting are:- 1. typos in method names that don't generate compile errors 2. Failing to notice compile errors when compile 2 or more swfs in a batch file before testing that app. Also, copying to reuse existing code, but failing to change ALL the variable names. Sorry I can't be more helpful. Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] method calls being delayed
The examples are supposed to work, and the project with the bug uses flash 8 too. The actual code is a much larger chunk, the example is just representing what is happening. Even worse, I can't repeat "the bug". The same code will run correctly if called differently. What I want to know is, has anyone had anything similar happen to them, i.e. a called method doesn't execute until after the callee has returned, meaning you can't get the result of the called method. Chris Velevitch wrote: It's works fine for me. I'm using Flash 8. Chris -- Chris Velevitch Manager - Sydney Flash Platform Developers Group www.flashdev.org.au ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] method calls being delayed
Hey everybody, Has anyone ever had the flash player not calling a method when you would expect it to. For Example... function a():Void { trace ("a begins..."); trace ("b returns: " + b()); trace ("a ends."); } function b():Number { trace ("b has been called"); return 4 + 4; } running this results in the following trace... a begins... b returns: undefined a ends. b has been called instead of a begins... b has been called b returns: 8 a ends. The real case was slightly more complicated code, involving for loops etc, but the call to "b" was not inside a for loop or anything, in fact it was a call to set some stuff after some dynamic layout happenings had gone on. I've had this before, and now it has happened again and I am perplexed. I managed to work around it by making the "b" method static. Any ideas? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] method calls being delayed
Hey everybody, Has anyone ever had the flash player not calling a method when you would expect it to. For Example... function a():Void { trace ("a begins..."); trace ("b returns: " + b()); trace ("a ends."); } function b():Number { trace ("b has been called"); return 4 + 4; } running this results in the following trace... a begins... b returns: undefined a ends. b has been called instead of a begins... b has been called b returns: 8 a ends. The real case was slightly more complicated code, involving for loops etc, but the call to "b" was not inside a for loop or anything, in fact it was a call to set some stuff after some dynamic layout happenings had gone on. I've had this before, and now it has happened again and I am perplexed. I managed to work around it by making the "b" method static. Any ideas? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders