Saturday, May 14, 2011

Essential Flash Scripts

FLASH SCRIPTING

Full Screen Command
            Select the First frame -> right click -> actions->
                                    fscommand("fullscreen", "true");

Quit Command
            Create button -> actions ->
                                    on (release) {
                                                fscommand("quit");
}

Go to Next Page
            Select & right click the button -> actions ->
                                    on (press) {
                                                gotoAndPlay("type the scene name", 1);
}

URL Command
            Select the Button -> actions ->
                                    on (release) {
                                                getURL("type the folder name", "_self");
}

On mouse Command
            First create the Movie clip -> drag the movie clip in to the current scene->
Actions->
                                    onClipEvent (load) {
                                                _x = 0;
                                                _y = 0;
                                                speed = 5;
}
onClipEvent (enterFrame) {
                                                endX = _root._xmouse;
                                                endY = _root._ymouse;
                                                _x += (endX-_x)/speed;
                                                _y += (endY-_y)/speed;
}

Stop All sounds
            Mute all sounds when clicked in a button -> actions ->
                                    on (press) {
stopAllSounds();

}
Juke box Command
            Import the sound in to the library -> press F11 -> right click the sound -> linkage ->
Tick -> Export for action script -> and give a Name -> create the button -> Actions ->
                                    on (press) {
                                                stopAllSounds();
                                                mysound = new Sound();
                                                mysound.attachSound("type the sound name");
                                                mysound.start();
}

Mouse Trail
            Select the first frame -> right click -> actions ->

Text = "keltron animation campus";
letters = Text.split("");
letterformat = new TextFormat();
letterformat.font = "Tahoma";
letterformat.align = "center";
letterformat.size = "10";
spacing = 6;
speed = 2;
for (var LTR = 0; LTR<letters.length; LTR++) {
            mc = _root.createEmptyMovieClip(LTR+"l", LTR);
            mc.createTextField(letters[LTR]+"t", LTR, LTR*spacing, 10, 20, 20);
            with (mc[letters[LTR]+"t"]) {
                        text = letters[LTR];
                        setTextFormat(letterformat);
                        selectable = false;
        }
            if (LTR) {
                        mc.prevClip = _root[(LTR-1)+"l"];
                        mc.onEnterFrame = function() {
                        this._x += (this.prevClip._x-this._x+5)/speed;
                        this._y += (this.prevClip._y-this._y)/speed;
                };
        } else {
                        mc.onEnterFrame = function() {
                        this._x += (_root._xmouse-this._x+10)/speed;
                      this._y += (_root._ymouse-this._y)/speed;
                };
        }
}


Game Command
            First create a Movie Clip -> apply the actions ->
                       
onClipEvent (enterFrame) {
            if ((Key.isDown(Key.LEFT)) && !(Key.isDown(Key.RIGHT))) {
                        this._x -= 5;
                        this._rotation=270;
            }
            if ((Key.isDown(Key.RIGHT)) && !(Key.isDown(Key.LEFT))) {
                        this._x += 5;
                        this._rotation=90;
            }
            if ((Key.isDown(Key.UP)) && !(Key.isDown(Key.DOWN))) {
                        this._y -= 5;
                        this._rotation=0;
            }
            if ((Key.isDown(Key.DOWN)) && !(Key.isDown(Key.UP))) {
                        this._y += 5;
                        this._rotation=180;
            }
            if ((Key.isDown(Key.UP)) && (Key.isDown(Key.RIGHT)) &&!(Key.isDown(Key.DOWN)) && !(Key.isDown(Key.LEFT))) {
                       
                        this._rotation=45;
            }
            if ((Key.isDown(Key.DOWN)) && (Key.isDown(Key.RIGHT)) &&!(Key.isDown(Key.UP)) && !(Key.isDown(Key.LEFT))) {
                       
                        this._rotation=135;
            }
            if ((Key.isDown(Key.DOWN)) && (Key.isDown(Key.LEFT)) &&!(Key.isDown(Key.UP)) && !(Key.isDown(Key.RIGHT))) {
                       
                        this._rotation=225;
            }
            if ((Key.isDown(Key.UP)) && (Key.isDown(Key.LEFT)) &&!(Key.isDown(Key.RIGHT)) && !(Key.isDown(Key.DOWN))) {
                       
                        this._rotation=315;
            }
}
                       

2 comments:

Anonymous said...

The Extractor is a self-contained unit, powered by a simple air motor. The unit is easily lifted into position by one crane, and butt-clamped to the shell flange of an exchanger that has been stripped for bundle removal. The carriage containing the main hydraulic cylinder is moved to the forward position, the cylinder rod extended and secured to the tube sheet.Extractors

Unknown said...

gioi thieu xe http://mitsubishihadong.vn/car-listing/gia-xe-mitsubishi-new-outlander-2017 nhap khau
xe tai van dongben: http://otohyundaidongvang.com/product/van-dongben-x30-2-cho-va-5-cho/ chinh hang
gia xe toyota yaris 2017: http://toyota-caudien.com/bao-gia-xe-toyota-yaris-2017/ nhap khau

Post a Comment