P1000
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by P1000
-
-
I found that if you delete an item (using either the delete key, or the deleteSelection function), and then call selectAll, then you get a selection object where the items used to be - but any attempt to use it results in a load of exceptions being thrown. Further investigation showed that the deleted items were not getting removed from the _items array. I've created my own fix for this:
public function deleteSelection($e:Event = null):void { if (_enabled && _allowDelete) { var deletedItems:Array = []; var item:TransformItem; var j:int; for (var i:int = _selectedItems.length - 1; i > -1; i--) { item = _selectedItems[i]; if (item.onPressDelete($e)) { deletedItems.push(item); //CUSTOM //remove from _items array for( j = _items.length - 1; j > -1; j-- ) { if( _items[j] == item ) { _items.splice( j, 1 ); } } //END CUSTOM } } if (deletedItems.length != 0) { dispatchEvent(new TransformEvent(TransformEvent.DELETE, deletedItems)); } } }
This seems to fix the issue!
Hope this helps someone!
Oh, and this is with the following version:
VERSION: 1.54
DATE: 3/6/2009
ACTIONSCRIPT VERSION: 3.0 (Requires Flash Player 9)
Deleting item bug [SOLVED]
in TransformManager (Flash)
Posted
Hmm - yes, I did - now I recall - selectAll was one of mine! Oops.. Basically it just passes the items array to selectItems. So, I guess this one is my bad, although it is the kind of thing I would have expected to be built in..