Add Enter Frame event listener : Frame Event : Animation Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Animation » Frame Event »

 

Add Enter Frame event listener


 
package {
    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.text.TextField;
    import flash.events.Event;

    public class Main extends Sprite {
        private var _bitmap:BitmapData= new BitmapData(100100, false, 0xffffffff);
        private var _textfield:TextField= new TextField(  );

        public function Main(  ) {
            var image:Bitmap = new Bitmap(_bitmap);
            addChild(image);
            _bitmap.noise(100002551|2|4false);
    
            addChild(_textfield);
            _textfield.y = 100;
    
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
    
        public function onEnterFrame(event:Event):void {
            var colorVal:Number = _bitmap.getPixel(mouseX, mouseY)
            _textfield.text = "#" + colorVal.toString(16).toUpperCase(  );
        }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Animation
» Frame Event