Richard Ryu

Judge whether item exist or not?

Recommended Posts

I had a big problem with TransformManager.

 

I just want to do select TransformItem that I've loaded in the stage.

If then I have to check existing in the stage too.

 

Question 1. How can I access the transformItem?

I've marked the color of text, Is this a good way?

var manager:TransformManager = new TransformManager({allowDelete:true, autoDeselect:true});

// ref is an index number;

function clickHandler(e:MouseEvent):void {
    if(manager.selectedTargetObjects[ref] == null){
         // No item in the transformanager

    } else {
         // here is the item's existed
         manager.selectItem(manager.selectedTargetObjects[ref]);
    }
}

Question 2. How can I select transformItem if it is still in the stage.

 

Once I added the transformItem I can transform size properly.

However I try to select transformItem again, It has disappeared and New item add in the stage.

All I have to do is that I want to select transformItem again that I made once. I mean I want to show selection boundary display again.

 

I think it is related to below code but I cannot figure out at all.

 

manager.selectItem(manager.selectedTargetObjects[ref]);

 

or getSelectionBoundsWithHandles

Share this post


Link to post
Share on other sites

I read your questions a few times, and I don't understand either one. I'm sorry. Can you rephrase them? 

 

And this wouldn't make any sense: 

manager.selectItem(manager.selectedTargetObjects[ref]);

 

Because manager.selectedTargetObjects is an array containing all of the currently selected objects, thus if you tell it to select one of those, it won't have any affect (it's already selected). Sorry, I just can't seem to understand what you're trying to do. I wish I could help more. I would definitely recommend reading the docs: http://greensock.com/asdocs/transform/

Share this post


Link to post
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.