Blurring a Picture - Step Seven: The Movie Clip ActionScript
Posted by : PhilS on Sep 30, 2008
Turn off the visibility
of the: button layerYou should now be able to see the Movie Clip (Cat Fader) with the image of the cat in focus. Select the Movie Clip: Cat Fader
Place the following code into the actionscript editor:
onClipEvent (load) { //sets the initial condition of the "Cat Fader" clip. In this case we want the clip to be invisible. We also want to setup a variable, named speed, to represent the amount of alpha shed or gained by the clip in every frame. this._alpha = 0; _root.speed = 15; } onClipEvent (enterFrame) { //setup an onClipEvent EnterFrame function for the clip that checks to see what value the alpha of the clip is at (represented by this._alpha) if (this._alpha < 0) { //if the alpha is less than zero set it to zero. (I know this sounds silly, but it can exist this way without immediate, obvious effect. Without this check it is possible to delay the fade-in since the alpha continues to drop numerically). Then set the direction (i.e., dir) to zero to prevent the alpha of the clip from changing until dir has a value of plus or minus 1. this._alpha = 0; _root.dir = 0; } if (this._alpha > 100) { //if the alpha is >100, set the alpha to 100 and set dir to 0 to prevent the alpha of the clip from changing until dir has a value of plus or minus 1. this._alpha = 100; _root.dir=0; } this._alpha = this._alpha + (_root.dir*_root.speed); //if the alpha of the clip is between 0 and 100, increment the clips alpha by the value of speed. }
That's it for Method 2. You should now test your Movie. As always, I hope you enjoyed the tutorial, and found it easy to follow.
Thank you for your time!
Source: http://www.webwasp.co.uk/tutorials/b27-blur-cat/index.php
« Method 2: Blurry Cat using ActionScript Fading; Step Six: The Button ActionScript Tutorial overview »

no comment
Add comment