Jump to content
Search Community

Bug when removing selectionBoxElement

mortenjo test
Moderator Tag

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 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.
×
×
  • Create New...