Skip to content

Instantly share code, notes, and snippets.

@tienery
Created December 31, 2015 02:28
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 tienery/1275bf96c2a7008ac036 to your computer and use it in GitHub Desktop.
Save tienery/1275bf96c2a7008ac036 to your computer and use it in GitHub Desktop.
private function setBitmapState(state:String)
{
if (state == null)
return;
#if !sys
if (Assets.exists(state))
#else
if (FileSystem.exists(state))
#end
_bmp.bitmapData = Assets.getBitmapData(state);
}
private function redraw()
{
graphics.clear();
_renderHeight = _label.height + (padding * 2);
_label.x = padding;
_label.y = padding;
if (_bmp.bitmapData != null)
{
_bmp.visible = true;
_renderWidth = _bmp.width;
_bmp.height = _renderHeight;
}
else
{
if (_down)
graphics.beginFill(_downColor);
else if (_over)
graphics.beginFill(_overColor);
else
graphics.beginFill(_baseColor);
graphics.drawRect(0, 0, renderWidth, renderHeight);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment