flash on 2011-11-9

by mmlemon_
♥0 | Line 42 | Modified 2011-11-09 12:35:03 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    import flash.display.Shape;
    import flash.events.Event;
    import flash.display.Sprite;
    import fl.motion.easing.*;
    import com.flashdynamix.motion.*;
    
    public class FlashTest extends Sprite {
        
        private var m_sp:TextField;
        private var m_con:Sprite;
        public function FlashTest() {
            // write as3 code here..
            addEventListener(Event.ADDED_TO_STAGE, init, false, 0, false);
        }
        private function init(event:Event):void
        {
            m_sp = new TextField();
            //m_sp.graphics.beginFill(0xff0000, 1);
            //m_sp.graphics.drawCircle( 0, 0, 100);
            //m_sp.graphics.endFill();
            var tfmt:TextFormat = new TextFormat(null, 80, 0xff00ff);
            m_sp.defaultTextFormat = tfmt;
            m_sp.text = "aaaa";
            m_sp.width = m_sp.textWidth;
            
            m_con = new Sprite();
            m_con.x = stage.stageWidth/2;
            m_con.y = stage.stageHeight/2;
            m_con.addChild(m_sp);
            
            m_sp.x = -m_sp.width/2;
            m_sp.y = -m_sp.height/2;
            addChild(m_con);
            
            stage.addEventListener(MouseEvent.CLICK, onClick, false);
        }
        
        private function onClick(event:MouseEvent):void
        {
            m_con.scaleX = 0.0;
            m_con.scaleY = 0.0;
            var seq:TweensySequence = new TweensySequence();
            seq.push(m_con, {scaleX: 1.8, scaleY: 1.8}, 0.3, fl.motion.easing.Quartic.easeIn);
            seq.push(m_con, {scaleX: 1.0, scaleY: 1.0}, 0.2, fl.motion.easing.Quartic.easeOut);
            seq.start();
        }

    }
}