In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2011-3-6

Get Adobe Flash player
by kazucafe 06 Mar 2011
    Embed
/**
 * Copyright kazucafe ( http://wonderfl.net/user/kazucafe )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mDLM
 */

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    public class FlashTest extends Sprite {
        private var sp:Sprite;
        private var st:ShowTarget;
        
        public function FlashTest() {
            st = new ShowTarget();
            this.addChild(st);
            
            var spC1:Sprite = new Sprite();
            var spC2:Sprite = new Sprite();
            
            sp = new Sprite();
            this.addChild(sp);
            sp.x = 30;
            sp.y = 120;
            
            sp.addChild(spC1);
            sp.addChild(spC2);
            spC2.x = 50;
            spC2.y = 50;  
            
            spC1.graphics.beginFill(0xFF0000);
            spC1.graphics.drawRect(0,0,200,200);
            spC1.graphics.endFill();
            
            spC2.graphics.beginFill(0xFFFF00);
            spC2.graphics.drawRect(0,0,100,100);
            spC2.graphics.endFill();
            
            //sp.addEventListener(MouseEvent.ROLL_OVER, _onRollOver);
            sp.addEventListener(MouseEvent.MOUSE_OVER, _onMouseOver);
        }
        
        private function _onRollOver(e:MouseEvent):void {
            st.setText(e.toString());
        }
        private function _onMouseOver(e:MouseEvent):void {
            st.setText(e.toString());
        }

    }
    
}

import flash.display.Sprite;
import flash.text.TextField;
class ShowTarget extends Sprite {
    private var tf:TextField;
    private var str:String;
    
    public function ShowTarget() {
        graphics.beginFill(0x0000FF);
        graphics.drawRect(250,20,200,430);
        graphics.endFill();
        
        tf = new TextField();
        this.addChild(tf);
        tf.width = 200;
        tf.x = 250;
        tf.y = 20;
        tf.height = 430;
        tf.wordWrap = true;
        tf.border = true;
        tf.textColor = 0xFFFFFF;
        
    }
    
    public function setText(str:String):void {
        str += str;
        tf.text = str;
    }

}