Created
February 25, 2011 16:03
-
-
Save canab/844002 to your computer and use it in GitHub Desktop.
This file contains 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.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