Timer incrementation not happening


what wrong here? results consistent alpha value not increment or decrement. missing something, or should cake?


-= -0.1

does same as:

+= 0.1

1 - (-0.1) == 1 + (0.1)

so if sprite or whatever starts @ alpha 1 stay @
alpha 1.

hth,
manno


miquael wrote:
> wrong here? results consistent alpha value
> not increment or decrement. missing something, or should cake?
>
>
>
>
> public function fade(fademode:string):void {
>
> var fadetimer:timer = new timer(5, 10);
>
> if (fademode == "out") {
> fadetimer.addeventlistener(timerevent.timer, fadeout);
> }
> if (fademode == "in") {
> fadetimer.addeventlistener(timerevent.timer, fadein);
> }
> fadetimer.start();
> }
> private function fadeout (e:timerevent):void {
> trace (this.alpha);
> this.alpha -= -0.1;
> }
> private function fadein (e:timerevent):void {
> trace (this.alpha);
> this.alpha += 0.1;
> }
>
> // results constant "1" each iteration, no change. why "-="
> or "+=" not appear work?
>


More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support