Jump to content
Search Community

Add and remove items | TransformItem

Nezarov test
Moderator Tag

Recommended Posts

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 = 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
 //trace(index) // output: 4
  if (index == selectedArray.length)
  for (var t:int = 0; t < index; t++)
it's removing one item only!
Link to comment
Share on other sites

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

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