Groups
Groups
Sign in
Groups
Groups
Flex ObjectHandles
Conversations
About
Send feedback
Help
Flex 4 need help Deleting objects from the Canvas
50 views
Skip to first unread message
Craig McLeod
unread,
Sep 1, 2011, 4:59:51 AM
9/1/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flex ObjectHandles
Hi,
I am adding objects to the canvas dynamically and then when I want to
delete them I use the following code:
public function removeSelected():void {
if (objectHandles.selectionManager.currentlySelected[0])
{
var elementToRemove:IVisualElement;
try {
elementToRemove =
this[objectHandles.selectionManager.currentlySelected[0].CanvasItemID];
objectHandles.unregisterComponent(elementToRemove);
mainGroup.removeElement(elementToRemove)
} catch (myE:Error){
//Alert.show
([objectHandles.selectionManager.currentlySelected[0].CanvasItemID] +
'')
//elementToRemove =
[objectHandles.selectionManager.currentlySelected[0].CanvasItemID] ;
//objectHandles.unregisterComponent(elementToRemove);
//mainGroup.removeElement(elementToRemove)
Alert.show(mainGroup[objectHandles.selectionManager.currentlySelected[0].CanvasItemID]
+ '');
}
} else {
Alert.show('Please select an object to remove from the
canvas','Oops');
}
}
It only seems to work for objects that start off on the stage, it
fails for new objects even though they have the same address space.
Anyone got a working example of how to delete objects off the stage in
FLEX 4.
Please and thank you for any help you can offer.
Regards
Craig
Reply all
Reply to author
Forward
0 new messages