Skip to content

Instantly share code, notes, and snippets.

@cflewis
Created October 7, 2012 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cflewis/3849926 to your computer and use it in GitHub Desktop.
Save cflewis/3849926 to your computer and use it in GitHub Desktop.
protected function targetButton_dragDropHandler(event:DragEvent):void
{
var draggedButton:Button = event.dragInitiator as Button;
var droppedOnButton:IVisualElement = event.currentTarget as IVisualElement;
var newButton:Button = new Button();
var parent:Group = droppedOnButton.parent as Group;
// Set up the new button
newButton.label(draggedButton.label);
newButton.color(draggedButton.color);
parent.addElementAt(newButton, parent.getElementIndex(droppedOnButton));
parent.removeElement(droppedOnButton);
}
@cflewis
Copy link
Author

cflewis commented Oct 7, 2012

This barfs with:
Description Resource Path Location Type
1061: Call to a possibly undefined method color through a reference with static type spark.components:Button. DragDrop line 38 Flex Problem
1119: Access of possibly undefined property color through a reference with static type spark.components:Button. DragDrop line 38 Flex Problem
1195: Attempted access of inaccessible method label through a reference with static type spark.components:Button. DragDrop line 37 Flex Problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment