piratefish
11-06-2005, 11:29 PM
So I'm trying to figure out how to use "Delete" in MX. I'm trying to delete a function called this.onEnterFrame. I believe I've seen delete used this way before, but i'm not sure. Here's my AS.
this.onEnterFrame = function() {
_root.guy2_mc._x += 5;
if (_root.guy2_mc._x>=550) {
setProperty(_root.guy2_mc, _x, 20);
}
};
_root.rock_btn.onRelease = function() {
_root.guy2_mc.gotoAndPlay("rock");
delete this.onEnterFrame;
setProperty(_root.guy2_mc, _x, 25);
};
The second code snippet is where the first bit of code is removed. I'm obviously not doing it correctly or I wouldn't be asking here. Can anyone help me out with how to delete/stop a function from continuing?
this.onEnterFrame = function() {
_root.guy2_mc._x += 5;
if (_root.guy2_mc._x>=550) {
setProperty(_root.guy2_mc, _x, 20);
}
};
_root.rock_btn.onRelease = function() {
_root.guy2_mc.gotoAndPlay("rock");
delete this.onEnterFrame;
setProperty(_root.guy2_mc, _x, 25);
};
The second code snippet is where the first bit of code is removed. I'm obviously not doing it correctly or I wouldn't be asking here. Can anyone help me out with how to delete/stop a function from continuing?