Skip to content

Commit

Permalink
fixed missing textField-dispose in Button; fixed text alignment gette…
Browse files Browse the repository at this point in the history
…rs (refs Gamua#456)
  • Loading branch information
PrimaryFeather committed Jan 16, 2014
1 parent b04eeae commit 0ac052b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions starling/src/starling/display/Button.as
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ package starling.display
this.text = text;
}

/** @inheritDoc */
public override function dispose():void
{
// text field might be disconnected from parent, so we have to dispose it manually
mTextField.dispose();

super.dispose();
}

private function resetContents():void
{
mIsDown = false;
Expand Down Expand Up @@ -239,15 +248,23 @@ package starling.display
}

/** The vertical alignment of the text on the button. */
public function get textVAlign():String { return mTextField.vAlign; }
public function get textVAlign():String
{
return mTextField ? mTextField.vAlign : VAlign.CENTER;
}

public function set textVAlign(value:String):void
{
createTextField();
mTextField.vAlign = value;
}

/** The horizontal alignment of the text on the button. */
public function get textHAlign():String { return mTextField.hAlign; }
public function get textHAlign():String
{
return mTextField ? mTextField.hAlign : HAlign.CENTER;
}

public function set textHAlign(value:String):void
{
createTextField();
Expand Down

0 comments on commit 0ac052b

Please sign in to comment.