|
||||||
|
||||||
Flash - Blurring a Picture

Free
Flash Tutorial
Step Five: The Invisible Button
Note: If you are using the ActionScript Method (2) to create your Movie you continue the tutorial from this Step.



Note: This semi-transparent turquoise is an Invisible Button. It will hold some Actionscript code. The turquoise area represents the active hit area (set to exactly the same size as the original and blurred cat clips).
Note: You do not need to type in the comments: // Grayed out text.
on (rollOver) { //setup a Rollover event for the button clip
currframe = _root.cat._currentframe; //currframe represents the frame that is currently playing in the "cat" clip at the time you move your cursor over the "button" clip
displacement = Math.abs(currframe-10); //displacement represents the number of frames the Play Head is from the visible image in frame 10 in the MC Cat symbol. Frame 10 is the frame in which the "MC Cat" is completely visible, having an alpha of 100%.
if (currframe == 1 || currframe == 10) { //if currframe is at the first frame (Frame 1, invisible) or at Frame 10 (completely visible) , let "cat" play.
_root.cat.play(); //then allow "cat" to play
}
if (currframe == 20) { //if you are at frame 20 of "cat" (i.e., currframe==20), "rewind" "cat" by playing it from frame 2.
_root.cat.gotoAndPlay(2);
}
if (currframe>10) { //if currframe greater than 10 (you are starting to fadeout). where you left off from fading out.
_root.cat.gotoAndPlay(10-displacement); // This controls the position of the Play Head. The Play Head or place that the animation plays from will depend to the amount of fade out the animation previous reached. So if the image was very blurred it will come back into focus form a very blurred image and visa versa. To realise this effect I have used a variable called: displacement.
}
}
on (rollOut)
{ //setup a Rollout event for the button
clip
currframe = _root.cat._currentframe; //defines the variable called: currframe
displacement = Math.abs(currframe-10); // defines the variable called: displacement
if (currframe <= 10) { //this time, if you rollout while fading in, start to fadeout.
_root.cat.gotoAndPlay(10+displacement);
}
}
on (release, releaseOutside)
{
trace("Meow!"); //put your own code here to do something like: gotoAndPlay etc.
}
Note: In the ActionScript above to type the line: | use: Shift + Back Slash \
|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
|
|
|

Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend:
Click here
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|