Skip to content

Instantly share code, notes, and snippets.

@Stray
Created January 19, 2011 13:41
Show Gist options
  • Save Stray/786182 to your computer and use it in GitHub Desktop.
Save Stray/786182 to your computer and use it in GitHub Desktop.
Toggle the position of a panel by linked list (for comparison with other approaches)
private var _currentTargetPosition:LinkedListPoint;
private function createPositionTargets():void
{
var onPosition:LinkedListPoint = new LinkedListPoint(0, ON_STAGE_Y, null);
var offPosition:LinkedListPoint = new LinkedListPoint(0, OFF_STAGE_Y, onPosition);
onPosition.next = offPosition;
_currentTargetPosition = offPosition;
}
private function togglePosition(e:MouseEvent):void
{
_currentTargetPosition = _currentTargetPosition.next;
moveTo(_currentTargetPosition.y);
}
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