Skip to content

Instantly share code, notes, and snippets.

@wouterds
Created December 8, 2012 12:34
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 wouterds/4240103 to your computer and use it in GitHub Desktop.
Save wouterds/4240103 to your computer and use it in GitHub Desktop.
[PhotoBooth vb] IconButton, de button parent die van SPrite extend
/**
* Created with IntelliJ IDEA.
* User: wouter
* Date: 09/10/12
* Time: 19:11
* To change this template use File | Settings | File Templates.
*/
package be.devine.cp3.photobooth.view {
import flash.display.DisplayObject;
import flash.display.Sprite;
public class IconButton extends Sprite{
protected var icon:DisplayObject;
public var explicitWidth:uint;
public var explicitHeight:uint;
public function IconButton(explicitWidth:uint, explicitHeight:uint) {
this.explicitWidth = explicitWidth;
this.explicitHeight = explicitHeight;
graphics.beginFill(0xff0000, 0);
graphics.drawRect(0, 0, explicitWidth, explicitHeight);
graphics.endFill();
createIcon();
if(icon)
{
icon.x = Math.round((explicitWidth - icon.width) * .5);
icon.y = Math.round((explicitHeight - icon.height) * .5);
addChild(icon);
}
mouseChildren = false;
buttonMode = true;
}
protected function createIcon():void
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment