Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : if statement in onClipEvent (enterFrame)


Walloompoom
10/31/2006 7:50:52 PM
How do you get the if statement to occure only once each time you move to the x
and y. So, if (Math.round(this._x) == -805 && this._y == 0) then do
this.secWineMc.gotoAndPlay(2); ONLY ONCE unless if (Math.round(this._x) == -805
&& this._y == 0) occures again. How?

Thanks!

onClipEvent (enterFrame) {

if (this._x == 0 && this._y == 0) {
this.secProBonoMc.gotoAndStop(2);
}

if (Math.round(this._x) == -805 && this._y == 0) {
this.secWineMc.gotoAndPlay(2);
}

if (Math.round(this._x) == -1610 && Math.round(this._y) == 0) {
this.secFredMc.gotoAndStop(2);
}
}
TimSymons
10/31/2006 8:15:48 PM
To call external program from flash you need to use the FSCOMMAND or a 3rd party piece of software like FlashJester or SWF Studio by Northcode.

Walloompoom
10/31/2006 9:14:00 PM
Hi Walloompoom,

I shall answer your question: Its very simple really...

onClipEvent (enterFrame) {
if (Math.round(this._x) == -805 && this._y == 0) {
if (!didit) {
this.secWineMc.gotoAndPlay(2);
didit = true;
}
} else if (didit) {
didit = false;
}
}
AddThis Social Bookmark Button