Code analysis of another navigation menu

xiaoxiao2021-03-06  104

http://www.gunongxy.com/asp/main.swf

Max_scale = 130; // Defines the maximum zoom value

Min_scale = 50; // Define minimum scaling values

MAX_ALPHA = 100; // Defines the maximum transparency (here optends)

Min_alpha = 50; // Define the minimum transparency (here is a translucent effect)

Speed ​​= 3; // Define the step size

Function getDistance () {

Var distance = 0; // Define variable distance, value is 0

Var constant = 1.3; // Define variable constant, value is 1.3 (Note: Value remains unchanged)

Distance = math.abs (this._y-_parent._ymouse); // Calculate the value of Distance, re-assaptuous value, the current Distance value is the result of math.abs (this._y-_parent._ymouse), not zero, Where math.abs () This function is the absolute value, the result of this._y-_parent._ymouse is the zoom value of the Y coordinate axis.

Return distance * constant; // Return the function value, that is, now getDistance = distance * constant

}

Function setscale () {// function starts

Var distance = getDistance (); // Defines Variable DISTANCE, which is the value of the getDistance function, which is the calculation result of Distance * Constant.

Var target_scale = max_scale-distance; // Defines the target scaling size and assigns, where max_scale is already defined in the program header.

IF (Target_scale)

//

If the value of the target zoom size is less than the minimum zoom value, then

Target_scale = min_scale; Target scaling is equal to the minimum scaling value, Min_scale has defined in the program header

}

VAR next_scale = this._xscale ((target_scale-this._xscale) / speed); // calculate the size of the actual zoom

Return next_scale; // Return Function Value

}

Function setalpha () // Here with the previous function function class

{

VAR distance = getDistance ();

Var Target_alpha = max_alpha-distance;

IF (Target_Alpha)

{

Target_alpha = min_alpha;

}

VAR next_alpha = this._alpha ((target_alpha-this._alpha) / speed); return next_alpha;

}

Function fluidsystem ()

{

VAR next_scale = setscale (); // This hereby function is assigned to the variable

Var next_alpha = setalpha ();

THIS._XSCALE = next_scale; // Define the scaling of the clip

THIS._YSCALE = next_scale;

THIS._ALPHA = next_alpha; // Define the transparency of the clip

}

This._xscale = min_scale; / / here should be a movie clip back to the initial setting state

THIS._YSCALE = min_scale;

THIS._ALPHA = min_alpha;

转载请注明原文地址:https://www.9cbs.com/read-123931.html

New Post(0)