Share Posted January 24, 2016 Hello, I am trying to remove some items from the taregetObjects list using array but it's removing only one item! Code sample: var my_item:TransformItem = t_manager.addItem(my_mc); my_item.addEventListener(TransformEvent.SELECT, addToList); function addToList(event:TransformEvent):void { selectedArray = new Array; for (var t:int = 0; t<t_manager.selectedTargetObjects.length; t++) { selectedArray.push(t_manager.selectedTargetObjects[t]); } ///selectedArray = t_manager.selectedTargetObjects; ///selectedArray = t_manager.selectedItems; } //// Remove items from targetObjects array: index = 0 for(var i:int = 0; i< selectedArray.length; i++) { ///////// some code here index++ //trace(index) // output: 4 if (index == selectedArray.length) { for (var t:int = 0; t < index; t++) { t_manager.removeItem(selectedArray[i]); } } } it's removing one item only! Link to comment Share on other sites More sharing options...
Author Share Posted January 24, 2016 it's t not i ( solved ( t_manager.removeItem(selectedArray[t]) Link to comment Share on other sites More sharing options...
Share Posted January 24, 2016 Yep, it was just an error in the conditional logic you were using. You've got it solved now, right? Just making sure. 1 Link to comment Share on other sites More sharing options...
Author Share Posted January 26, 2016 Yes it's working thanks, I have another question plz can you explain me how move() method works? I want to move all the selected items by a button click I am using: transform_tool.selectedTargetObjects.move(10,10,flase, false); this code doesn't work i am getting an error says "move is not a function" I tried so many codes but no one of them has worked! I can only move one selected item on x and y axis's using: transform_tool.selectedTargetObjects[0].x what I am looking for is to move all the selectedItems depending on the dummyBox, is there any solution? Thanks. Link to comment Share on other sites More sharing options...
Author Share Posted January 27, 2016 I got it: moveSelection() Link to comment Share on other sites More sharing options...
Share Posted January 27, 2016 Great, glad you got it Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now