PDA

View Full Version : Re-enabling game


jingle
04-11-2005, 05:23 PM
Hello. I have a matching game with some drag and drop clips. When all the mc's are matched up correctly, the movie goes to the next frame where there is a play again button. When this button is clicked the movie returns to the first frame. The actionsript on this button sets up the properties so that the movie clips return to their origingal positions. The problem is that the clips are no longer draggable. And ideas how to fix this?
Here is the code from one of the clips.

onClipEvent (load) {
white_x = getProperty(this, _x);
white_y = getProperty(this, _y);
}
onClipEvent (enterFrame) {
this.onRelease = function() {
_root.tries++;
if (hitTest(_root.answer2)) {
_root.answer2;
setProperty(this, _x, white_x);
setProperty(this, _y, white_y);

this._x = _parent.answer2._x;
this._y = _parent.answer2._y;


_root.s_check._visible = true;
_root.score++;
this.enabled = false;
} else {
setProperty(this, _x, white_x);
setProperty(this, _y, white_y);
}

};
}
on (press) {
this.startDrag();
}
on (release) {
this.stopDrag();}

And this code is on frame 1 of the main timeline:

stop ();

this.onEnterFrame = function() {
if (_root.score == 8) {
delete(this.onEnterFrame);
gotoAndStop(2);
}
};

Thanks!

oldnewbie
04-11-2005, 05:30 PM
A quick & dirty workaround, might simply be to re-load your movie on the _root level...

on(release){
loadMovieNum("thisgame.swf", 0);
}

Of course obviously use your .swf's name rather than "thisgame.swf".

jingle
04-11-2005, 06:42 PM
Yeah, that works. Wish I would have thought of that. Thanks!