Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
mortenjo

Bug when removing selectionBoxElement

Recommended Posts

Hi,

 

The removeSelectionBoxElement function is not working correctly. _selectionElements.indexOf(element) will not locate the correct DisplayObject since the _selectionElements array contains objects where the DisplayObject to delete is just one of the properties. This was maybe not the best explanation, but below you can see the change I made to the function to make it work.

 

public function removeSelectionBoxElement(element:DisplayObject):void {
for (var i:uint = 0; i < _selectionElements.length; i++){
	if (_selectionElements[i].element === element){
		_selectionElements.splice(i, 1);
		if (element.parent == _selection) {
			_selection.removeChild(element);
		}					
	}
}
/*
var i:int = _selectionElements.indexOf(element);
if (i >= 0) {
	_selectionElements.splice(i, 1);
	if (element.parent == _selection) {
		_selection.removeChild(element);
	}
}
*/
}

 

Morten Johnsen

NVD AS

Link to post
Share on other sites

You are absolutely right. Great catch. Sorry about that - it is fixed in the latest version.

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×