flash on 2009-10-6

by telcanty
♥0 | Line 47 | Modified 2009-10-06 09:23:47 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.display.MovieClip;
    
    public class FlashTest extends Sprite {
        
        public var background:MovieClip = new MovieClip();
        public var bounds:Sprite = new Sprite();
        
        public function FlashTest() {
            bounds.graphics.beginFill(0x000000,0);
            bounds.graphics.lineStyle(1,0xFF0000,1);
            bounds.graphics.drawRect(0,0,stage.stageWidth/2,stage.stageHeight/2);
            bounds.graphics.endFill();
            bounds.x = stage.stageWidth/4;
            bounds.y = stage.stageHeight/4;
            
            addChild(bounds);
            
           var new_map:Map = new Map(bounds,background);
                 new_map.start();
        }
        
    }
}

import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;

class Map{
    
    private var _bounds:Sprite;
    private var _target:MovieClip;
    
    public function Map(bnds:Sprite, obj:MovieClip)
    {
        _bounds = bnds;
        _bounds.mouseEnabled = false;
        _target = obj;
        _target.addEventListener(Event.ADDED_TO_STAGE, _init);
    }
    
    public function start():void
    {
        _target.addEventListener(Event.ENTER_FRAME, _update);
    }   
    
    public function stop():void
    {
          _target.removeEventListener(Event.ENTER_FRAME, _update); 
    }
    
    private function _init(e:Event):void
    {
        
    }
 
    private function _update(e:Event):void
    {
        
    }
    
}