Skip to content

Instantly share code, notes, and snippets.

@canab
Created February 25, 2011 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canab/844002 to your computer and use it in GitHub Desktop.
Save canab/844002 to your computer and use it in GitHub Desktop.
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
public class Profiler extends Sprite
{
public function Profiler()
{
var sprite:Sprite = createInteractiveSprite();
sprite.addEventListener(MouseEvent.MOUSE_OVER, onOver);
addChild(sprite);
// With this line mouseListeners profiler does not show any shape
// However, sprite is stil reacting on mouse events
mouseEnabled = false;
}
public function createInteractiveSprite():Sprite
{
var sprite:Sprite = new Sprite();
sprite.graphics.beginFill(0x0000FF);
sprite.graphics.drawRect(50, 50, 100, 50);
sprite.graphics.endFill();
return sprite;
}
private function onOver(e:MouseEvent):void
{
Sprite(e.currentTarget).scaleX += 0.1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment