AS3 GetNextHighestDepth


/ Published in: ActionScript 3
Save to your folder(s)

Often used in conjunction with dragging elements around the screen, you may want the item most recently picked up to jump to the top of the "stack." Here's how to do it. In the event handler you create, you tell the item's parent to set its child's index to the highest number of its children.


Copy this code and paste it in your HTML
  1. private function YourHandlerFunction(e:MouseEvent):void {
  2. e.currentTarget.parent.setChildIndex(DisplayObject(e.currentTarget), e.currentTarget.parent.numChildren - 1);
  3. e.currentTarget.startDrag();
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.