Skip to content

Instantly share code, notes, and snippets.

@sixones
Forked from Gi133/gist:1837191
Created February 16, 2012 18:51
Show Gist options
  • Select an option

  • Save sixones/1846989 to your computer and use it in GitHub Desktop.

Select an option

Save sixones/1846989 to your computer and use it in GitHub Desktop.
Lab2
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