-
-
Save sixones/1846989 to your computer and use it in GitHub Desktop.
Lab2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package | |
| { | |
| import flash.display.Sprite; | |
| import flash.events.Event; | |
| import flash.text.TextField; | |
| import flash.geom.ColorTransform; | |
| import flash.geom.Transform; | |
| import flash.display.Shape; | |
| import flash.events.MouseEvent; | |
| import flash.events.KeyboardEvent; | |
| public class Main extends Sprite | |
| { | |
| private var square:Shape = new Shape; | |
| public function Main():void | |
| { | |
| this.square.graphics.beginFill(0x0000ff); | |
| this.square.graphics.drawRect(-32, -32, 64, 64); | |
| this.square.graphics.endFill(); | |
| this.addChild(this.square); | |
| this.addEventListener(MouseEvent.CLICK, ColorChange); | |
| } | |
| public function onDraw():void | |
| { | |
| } | |
| public function onMouseClick(e:MouseEvent):void | |
| { | |
| var myColour:ColorTransform = new ColorTransform; | |
| myColour.color = 0xff0000; | |
| this.square.transform.colorTransform = myColour; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment