Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
billyWhite

Trouble with DESELECT [SOLVED]

Recommended Posts

Hello,

 

I'm having problems listening for the DESELECT event. I only have one item added to the transform manager and I'd like to be notified once you click off of it. I'm able to get ROTATE, MOVE, SCALE, etc. to fire. Here is the chunk of code in case I'm missing something obvious.

 

		private function doFileComplete(e:CustomEvent):void {
		Common.removeAllChildren(custImgContainer);
		custImgContainer.addChild(Bitmap(e.params));

		manager.addItem(custImgContainer);

		trace(manager.autoDeselect); // is set to true

		manager.addEventListener(TransformEvent.DESELECT, onDeselect, false, 0, true);
	}

	private function onDeselect(e:TransformEvent):void {
		trace("in onDeselect");
	}

 

Is there anything special about this event, or is my impression of its use incorrect?

 

Thanks so much for this awesome tool,

Billy

Link to comment
Share on other sites

  • 2 weeks later...

Actually, only TransformItems dispatch DESELECT events because TransformManager could have multiple items selected, so it could be confusing for it to dispatch DESELECT events every time PART of the selection was deselected, etc. Instead, it dispatches SELECTION_CHANGE events. It's easy to find out when everything has been deselected, though, by checking the TransformManager's selectedItems Array length when the SELECTION_CHANGE event gets fired. Like this:

 

myManager.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange);
function onSelectionChange($e:TransformEvent):void {
trace("Changed selection. Items just selected/deselected (changed): " + $e.items.length + ", total items now selected: " + myManager.selectedItems.length);
}

 

(Sorry I didn't answer this sooner - the forum never sent me the notification e-mail)

Link to comment
Share on other sites

Ahhh, sweet - makes sense. Thanks a lot!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×