Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Add and remove items | TransformItem

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

:( it's t not i :(( solved :((


Link to comment
Share on other sites

Yep, it was just an error in the conditional logic you were using. You've got it solved now, right? Just making sure. 

  • Like 1
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

Great, glad you got it :)

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.