PDA

View Full Version : How to stop an action?



markcq
May 8th, 2003, 07:41 AM
This is probably a (VERY) stupid question...

Is there any way to stop a script?

Lets say I have the following script:

onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
if (this._alpha<95) {
this._alpha += 5;
}
if (this._alpha>95) {
this._alpha = 100;
}
}

The problem with this is that it keeps repeating the enterFrame script... I want it to stop running the script when its done (if you get what I'm saying)

Any ideas or suggestions?

virusdoder
May 8th, 2003, 07:45 AM
stop() maybe?

markcq
May 8th, 2003, 07:47 AM
Nope...

That was the first thing I tried... hehehe...

I put a trace in... According to the trace it keeps running...

kode
May 8th, 2003, 07:47 AM
dynamic event handlers...

myClip._alpha = 0;
myClip.onEnterFrame = function() {
if (this._alpha<95) {
this._alpha += 5;
} else {
this._alpha = 100;
delete this.onEnterFrame;
}
}
of course, use the script in the frame actions, not in the MovieClip actions. ;)

markcq
May 8th, 2003, 09:50 AM
thanx!

I'll give that a shot :)

kode
May 8th, 2003, 09:53 AM
no problem. =)

markcq
May 8th, 2003, 10:35 AM
wow... mexico helping malaysia... we have like a 12 hour (more or less) time difference... this is SOOOO cool. :)

kode
May 8th, 2003, 10:40 AM
ehmm... that's because i'm a vampire. :P

;)

markcq
May 8th, 2003, 11:06 AM
ok, i'll repay you with a bit of my blood... :)

kode
May 8th, 2003, 11:11 AM
:P

yup... that would be nice. :P

markcq
May 8th, 2003, 11:13 AM
alien blood ok for you? :P

kode
May 8th, 2003, 11:15 AM
as long as it isn't yellow or some weird color... :P

markcq
May 8th, 2003, 11:16 AM
nope... still red...

eek... the little envelope is starting to bleed already... its turning red!!! :P

kode
May 8th, 2003, 11:21 AM
bah! there's no alcohol in this blood!! :hair: :P

markcq
May 8th, 2003, 11:25 AM
we'll need to spice it up with a bit of tequila... then i'll also drink :P

kode
May 8th, 2003, 11:33 AM
a bloody mary (literally)?... :P