vendredi 23 septembre 2016

Possible color error in AS3

I wrote an AS3 program (.swf output) about a board moving with the mouse, but when I set the color to blue, the result is a yellow outer area of the board surrounding the blue inner area. It only becomes totally blue when the user click the screen. How can I modify the program so that the board becomes blue at the start of the program without clicking once? The program is uploaded onto this link :

And here is the source code, all of it.

    import flash.display.Sprite;
    public class FlashTest extends Sprite 
        public var board:Sprite;
        public function FlashTest() 
            board = new Sprite();
            board.x = stage.stageWidth /2 - board.width/2;
            stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEvent);
            stage.focus = board;
        public function onMouseEvent(event:MouseEvent):void
            board.x = event.localX - board.width/2;
            if(board.x <0)
                board.x = 0;
            if(board.x > stage.stageWidth - board.width)
                board.x = stage.stageWidth - board.width;

Aucun commentaire:

Enregistrer un commentaire