I don’t know where I went wrong with this code, but here it is:
main swf: stage empty, a function creates 1 enemy and 2 arrows from library and place them so that the two arrow clips touch the enemy clip.
inside Arrow clip: first frame stop();hit()
inside Enemy clip: stop()
inside Arrow class in an external .as file:
public function hit() {
if (this.hitTestObject(arr)) {
trace("trace1",this.name);
arr.gotoAndPlay(2);
trace("this should follow trace1",this.name);
arr.doThat();
}
}
inside Enemy class:
public function doThat() {
this.gotoAndPlay(3);
}
main swf output:
trace1
trace1
this should follow trace1
this should follow trace1
output if I remove the “gotoAndPlay” command between the traces in Arrow:
trace1
this should follow trace1
trace1
this should follow trace1
why did the execution order change? or is it some logical flaw I didn’t understand?
thanks