try1

by mikako
♥0 | Line 38 | Modified 2010-05-17 14:21:22 | MIT License
play

ActionScript3 source code

/**
 * Copyright mikako ( http://wonderfl.net/user/mikako )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oN5F
 */

// forked from jl7kii's "ClickSound" forked from: "Mouse Tracking"
// forked from jl7kii's "Mouse Tracking" forked from: "Using TextFormat" forked from: hello world
// forked from jl7kii's forked from: hello world
// forked from jl7kii's hello world
package {
    import flash.display.Sprite;
    import flash.text.*;
    import flash.events.*;
    
    [SWF(width="500", height="500", backgroundColor="0xfffff", frameRate="30")]
    import flash.text.TextFormat;
    import flash.media.Sound;
    import flash.net.URLRequest;
    import flash.media.SoundChannel;
    public class Main extends Sprite {
    		private var textField:TextField;
    		
        /* Constructor */
        public function Main() {
        		textField = new TextField();
        		textField.text = "1234567891";
        		
        		var textFormat:TextFormat = new TextFormat();
        		textFormat.size = 300;
        		textFormat.font = "century"
        		textField.setTextFormat(textFormat);
        		
        		textField.x = 1250;
        		textField.y = 1250;
        		
        		stage.addChild(textField);
        		stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        		stage.addEventListener(MouseEvent.CLICK, onClick);
        }
        
        private function onEnterFrame(e:Event): void {
        		textField.x = stage.mouseX;
        		textField.y = stage.mouseY;
        }
        
        private var sound_rpg:Sound = null;
        private var soundChannel:SoundChannel = null;
        private function onClick(e:MouseEvent): void {
        	    if(sound_rpg == null) {
        	    	    sound_rpg = new Sound(new URLRequest("http://sfx-g.net/mp3/Weapon-Explosion/RPG.mp3"));
        	    }
        	    soundChannel = sound_rpg.play();
        }
    }
}