Skip to content

Instantly share code, notes, and snippets.

@Stray
Created January 19, 2011 13:03
Show Gist options
  • Save Stray/786139 to your computer and use it in GitHub Desktop.
Save Stray/786139 to your computer and use it in GitHub Desktop.
Toggle the position of a panel by conditional (for comparison with other approaches)
private var _isGoingUp:Boolean = false;
private function togglePanelPosition(e:MouseEvent):void
{
var yPos:Number = ON_STAGE_Y;
if(_isGoingUp)
{
yPos = OFF_STAGE_Y;
}
moveTo(yPos);
_isGoingUp = !_isGoingUp;
}
private function moveTo(yPos:Number):void
{
TweenLite.to(this, 1, {y:yPos});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment