Created
January 19, 2011 13:41
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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