[RESOLVED] Flash 8 AS2 deleting a function possible?
Hey!
I'm working on a game where once i have all my moviClips set, I want to jump to the game playing frame, but I can't come up with a way to delete the function that places them in the startup frame.
My code is included in a function that enables dragging the players named placePlayers(), but when I manage to get to the game frame, the movieClips are still draggable which is what I need to avoid before trying to program the real game.
this is the code to place the players in first frame:
for (i=0; i<6; i++) {
this.attachMovie("botoBarça", "botoBarça"+i, this.getNextHighestDepth());
this.attachMovie("botoValencia", "botoValencia"+i, this.getNextHighestDepth());
this["botoBarça"+i]._x = 100+i*56;
this["botoBarça"+i]._y = 28;
this["botoValencia"+i]._x = 450+i*56;
this["botoValencia"+i]._y = 28;
_root["botoBarça"+i].onPress = function() {
dragging = true;
startDrag(this);
};
_root["botoBarça"+i].onRelease = _root["botoBarça"+i].onReleaseOutside=function () {
dragging = false;
stopDrag();
if (eval(this._droptarget) == areaPetitaN || camp) {
positionPlayersBarça++;
if (positionPlayersBarça>=7) {
localReady_btn._visible = true;
}
}
};
this is the code on clicking the ready button:
this.visitorReady_btn.onPress = function(){
visitorReady = true;
if(localReady == true && visitorReady == true){
dragging = false;
delete placePlayers(); // this is what I thought worked.
gotoAndStop("game");
}
}
this.localReady_btn.onPress = function(){
localReady = true;
if(localReady == true && visitorReady == true){
dragging = false;
delete placePlayers(); // this is what I thought worked. gotoAndStop("game");
}
}
I include the swf for better explanation... drag all the players to their respective side of the field before jumping to the game frame.
thanks, but it doesn't work
Thanks for the reply, Blink.
I managed to rename the movieclips on the game frame and that way it works for me but I have the feeling there has to be a cleaner way to achieve the same result. A class perhaps, if deleting the function can't be done.
Thanks anyway...