# Help modify fade in AS 2.0

**URL:** <https://forum.kirupa.com/t/help-modify-fade-in-as-2-0/304301>\
**Category:** flash\
**Created:** [February 5, 2010, 2:55am UTC](https://forum.kirupa.com/t/help-modify-fade-in-as-2-0/304301 "2010-02-05T02:55:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TerraAustralia](https://avatars.discourse-cdn.com/v4/letter/t/51bf81/32.png) [@TerraAustralia](https://forum.kirupa.com/u/TerraAustralia)\
**Post date:** [February 5, 2010, 2:55am UTC](https://forum.kirupa.com/t/help-modify-fade-in-as-2-0/304301/1 "2010-02-05T02:55:06Z")

</div>

The following AS works fine but I seek the wisdom of an AS guru to modify the action.

I have a tweened movie which plays on a loop. A click on the image area stops the movie and the image fades nicely from alpha 100 to alpha 0. A second click brings the image back immediately to alpha 100 and the clip continues.

I would like the movie image to fade back in from alpha0 to alpha 100 before it re-starts; (the reverse of the fade out). At the moment the re-appearence of the image is a crude jump. So far my ill informed tinkering has not worked.

import mx.transitions.Tween;  
import mx.transitions.easing.\*;  
var secNum:Number = 3;  
var aTween:Tween;  
click\_btn.onRelease = function() {  
if (!this.toggle) {  
chameleon.stop();  
aTween = new Tween(chameleon, “\_alpha”, Quad.easeInOut, 100, 0, secNum, true);  
aTween.onMotionFinished = function() {  
delete aTween;  
chameleon.\_visible = false;  
};  
} else {  
aTween.stop();  
chameleon.\_visible = true;  
chameleon.\_alpha = 100;  
chameleon.play();  
}  
this.toggle = !this.toggle;  
};
