Jump to content
Search Community

P1000

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by P1000

  1. 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)

×
×
  • Create New...