ColonelBlue
Technical User
Hello,
I have an enterFrame action that I use on a graphic:
Because I want to use the above code more than a few times, I tried to make it a function.
But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.
What am I doing wrong?
Any help would be greatly appreciated.
Thanks in advance.
I have an enterFrame action that I use on a graphic:
Code:
onClipEvent (enterFrame) {
if (this._alpha >= 0) {
this._alpha -= 2;
} else {
this._alpha = 0;
}
}
Because I want to use the above code more than a few times, I tried to make it a function.
Code:
function fadeOut() {
onClipEvent (enterFrame) {
if (this._alpha >= 0) {
this._alpha -= 2;
} else {
this._alpha = 0;
}
}
But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.
Code:
onClipEvent (enterFrame) {
fadeOut();
}
What am I doing wrong?
Any help would be greatly appreciated.
Thanks in advance.