This topic is related to AS2.0 .
Recently I made a discovery after a research on a very strange "return value missing" problem.
The situation is like this:
I have a class A which extends MovieClip and calls "stop()" method to stop the play head in its construction method. Everything seems normal except I can't get return value from any method who create instance of A.
For example, I have the following code:
In file A.as:
class A extends MovieClip{
function A(){
stop();
}
}function strangeMethod(){
_root.attachMovie("testa","test",_root.getNextHighestDepth());
var x=_root.test;
return 1;
}
var a=0;
a=strangeMethod();
trace(a);var a=strangeMethod();
trace(a);When I first found this problem, the class I used was much more complicated than the above A.as. So It took me a lot of time to spot the cause of this phenomenon. Finally I got it. The source is "stop()"! When I change "stop()" into "this.stop()", the problem disappears.
I guess when you call "stop()" in a class, actually you are not calling the stop method of a movieclip. Maybe it's the ancient timeline "stop()" method who is taking control. And it looks like the method does more than just stop the play head. It seems it also stopped the passing of return value or at least interfered with the value passing.
So my advice is that you should always use "this.stop()" instead of "stop()" in a class definition. I didn't try gotoAndStop or gotoAndPlay, but I think they may act the similar way, so you'd better use this.gotoAndStop and this.gotoAndPlay instead.