Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import flash.display.MovieClip;
- import flash.events.Event;
- import flash.utils.*;
- public class ZClip extends MovieClip {
- public var target_alpha:Number;
- public var prev_alpha:Number;
- private var isFE:Boolean=false;
- private var lit:Boolean=false;
- //----------------------------------
- public function ZClip() {
- }
- //----------------------------------
- public function goUp():void {
- if ((isFE) || (lit)) return;
- /*this.parent.setChildIndex(this,
- this.parent.numChildren-1);*/
- prev_alpha=alpha;
- target_alpha=1;
- lit=true;
- if (!isFE) {
- isFE=true;
- addEventListener(Event.ENTER_FRAME, on_frame);
- }
- setTimeout(goDown,1500);
- }
- //----------------------------------
- public function goDown():void {
- target_alpha=prev_alpha;
- if (!isFE) {
- isFE=true;
- addEventListener(Event.ENTER_FRAME, on_frame);
- }
- lit=false;
- }
- //----------------------------------
- private function on_frame(e:Event):void {
- var stepp:Number=(target_alpha-alpha)/10;
- var alpha_p:Number=alpha;
- alpha+=stepp;
- if (alpha_p==alpha) {
- removeEventListener(Event.ENTER_FRAME,on_frame);
- isFE=false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement