Flash Tutorials: Using Variables to set Parameters.

Home • Members Tutorials Forum iSnapChat Contact Us 

 


Flash Tutorials

   

Animating Filters with ActionScript

 

Free Flash Tutorial


Step 3    <<   Previous      Intro   1   2   3   4   5     Next   >>      

 

Step Three: Understanding the ActionScript - Using Variables to set Parameters

 

As explained in other tutorials that parameters control the filter and gives the object (in this case a photo) its look. Changing the parameters changes the look of the object. The parameters are set with this section of code:

(0x000066,.7,myBlur,myBlur,3,3,true,false)

Cross Ref: I have explained parameters in detail in a previous tutorial and so will not repeat it here. If you are not familiar with Filter parameters and how to set them I recommend that you read the tutorial: Creating Filters with ActionScript

The parameters can be set directly like this:

(0x000066,.7,10,10,3,3,true,false)

But they can also be set with variables. This enables them to be changed . This variable is initially given a value by this line:

var myBlur = 10;

I placed a variable in the parameters located where information is stored about the X blur and the Y blur. Both the X & Y blurs are set with the same variable:

(0x000066,.7,myBlur,myBlur,3,3,true,false)

The value of the variable is changed with this line. It adds 12 to itself:

myBlur += 12;

The animation is switched off with this:

if (myBlur > 130) {
         delete this.onEnterFrame;
      }

The reverse effect is created with this:

myBlur -= 12;

The reverse effect is switched off with this:

if (myBlur < 20) {
         delete this.onEnterFrame;
      }

         

Step 3    <<   Previous      Intro   1   2   3   4   5     Next   >>      


20827 visitors to this page since 14 April 07 •

Phil Schulz's Facebook Profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page HomeMembers Tutorials Forum iSnapChat Contact Us 
 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.