|
AS2 Adobe Flash CS6. ActionScript 2, , 600450. , (window) , , , . window. , : onClipEvent (mouseMove) { if (!_root.bMouseAction) { return; } // end if mouse_x = this._xmouse; mouse_y = this._ymouse; if (getProperty(this, _height) < mouse_y || getProperty(this, _width) < mouse_x || mouse_y < 0 || mouse_x < 0) { _root.bMoveV = false; _root.bMoveSpeedH = _root.bNormalMoveSpeedH; _root.bMoveSpeedV = _root.bNormalMoveSpeedV; return; } // end if _root.bMoveH = true; center_x = getProperty(this, _width) / 2; if (mouse_x < center_x) { _root.bRight = true; _root.bMoveSpeedH = _root.bMaxMoveSpeedH * (center_x - mouse_x) / center_x; } else { _root.bRight = false; _root.bMoveSpeedH = _root.bMaxMoveSpeedH * (mouse_x - center_x) / center_x; } // end else if center_y = getProperty(this, _height) / 2; if (mouse_y < center_y) { _root.bDown = true; _root.bMoveSpeedV = _root.bMaxMoveSpeedV * (center_y - mouse_y) / center_y; } else { _root.bDown = false; _root.bMoveSpeedV = _root.bMaxMoveSpeedV * (mouse_y - center_y) / center_y; } // end else if } - 1 2, 1 2( ) , , , , , . ,, ( , 1),' ', photo1 2 1( photo2 (.) (window), , . '', 2 1 ,.. AS, : _root.bMoveH = true; _root.bRight = true; _root.bMaxMoveSpeedH = 15; _root.bNormalMoveSpeedH = 5; _root.bMoveSpeedH = bNormalMoveSpeedH; _root.bMoveV = false; _root.bDown = false; _root.bMaxMoveSpeedV = 2; _root.bNormalMoveSpeedV = 1; _root.bMoveSpeedH = bNormalMoveSpeedV; _root.photo_left = "photo1"; _root.photo_right = "photo2"; _root.bMouseAction = true; photo1_x = getProperty("photo1", _x); photo1_width = getProperty("photo1", _width); photo1_height = getProperty("photo1", _height); photo1_y = getProperty("photo1", _y); win_x = getProperty("window", _x); win_width = getProperty("window", _width); win_y = getProperty("window", _y); win_height = getProperty("window", _height); if (win_width < photo1_width) { setProperty("photo2", _x, photo1_x + photo1_width); } else { _root.bMoveH = false; setProperty("photo1", _x, win_x + win_width / 2 - photo1_width / 2); _root.bMouseAction = false; } // end else if setProperty("photo1", _y, win_y + win_height / 2 - photo1_height / 2); setProperty("photo2", _y, win_y + win_height / 2 - photo1_height / 2); 3, : function swapToLeft(bToLeft) { photo_width = getProperty(_root.photo_left, _width); left_x = getProperty(_root.photo_left, _x); right_x = getProperty(_root.photo_right, _x); if (bToLeft) { setProperty(_root.photo_right, _x, left_x - photo_width); } else { setProperty(_root.photo_left, _x, right_x + photo_width); } // end else if tmp = _root.photo_right; _root.photo_right = _root.photo_left; _root.photo_left = tmp; } // End of the function function moveH(ifRight, sizeMove) { left_x = getProperty(_root.photo_left, _x); right_x = getProperty(_root.photo_right, _x); width = getProperty(_root.photo_left, _width); win_x = getProperty("window", _x); win_width = getProperty("window", _width); if (ifRight) { left_x = left_x + sizeMove; right_x = right_x + sizeMove; setProperty(_root.photo_left, _x, left_x); setProperty(_root.photo_right, _x, right_x); if (win_x < left_x) { swapToLeft(true); } // end if } else { left_x = left_x - sizeMove; right_x = right_x - sizeMove; setProperty(_root.photo_left, _x, left_x); setProperty(_root.photo_right, _x, right_x); if (right_x < win_x) { swapToLeft(false); } // end if } // end else if } // End of the function function moveV(ifDown, sizeMove) { y = getProperty(_root.photo_left, _y); height = getProperty(_root.photo_left, _height); win_y = getProperty("window", _y); win_height = getProperty("window", _height); if (bDown) { if (y < win_y) { y = win_y < y + bMoveSpeedH ? (win_y) : (y + sizeMove); } // end if } else if (win_y + win_height < y + height) { y = y - sizeMove + height < win_y + win_height ? (win_y + win_height - height) : (y - sizeMove); } // end else if setProperty(_root.photo_left, _y, y); } // End of the function if (_root.bMoveH) { moveH(bRight, bMoveSpeedH); } // end if if (_root.bMoveV) { moveV(bDown, bMoveSpeedV); } // end if gotoAndPlay(2); F5 , . , . . |
"*ADOBE FLASH":
1 -
2 -
...
5 - "FLFMME". ACTION SCRIPT 2.
6 - . Photo Stack Gallery.
7 -
8 - 3-d . Flash CS 6. Action Script 3.
9 - - -
: | |