Jump to content
Search Community

Auto-select displayObject [SOLVED]

foldiman test
Moderator Tag

Recommended Posts

I'm loading an image from a URL and then adding it as a child to a moveClip. I'm then targeting this movieClip when I create a new TransformManager. I would now like to have that movieClip auto-selected rather than making the user click the image. I've tried using selectItem and setting the AddToSelection to true. This only draws one handle in the top left of the image.

 

Is there a way to auto-select the DisplayObject that's targeted by the TransformManager?

 

Thanks.

Link to comment
Share on other sites

Did you wait to addItem() until your image was COMPLETELY loaded? That's the most common mistake people make with this type of thing. TransformManager needs accurate measurements of the item so that it can correctly render the handles, but if the image hasn't fully loaded AND initted, it will not report accurate width/height values. You can also call the update() method on the TransformItem instance associated with your image which forces it to re-measure things, but that still won't do any good until after the image has fully loaded.

Link to comment
Share on other sites

Yes, got it working.

 

I requested the image from a URL using a loader that had ".contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);" attached as an event listener. On complete, the handler added the child object to a parent that had an Event.ADDED attached. That final ADDED event called the TransformManager.

 

Once called I ran deselectAll() and then selectItem() with the addToSelection parameter set to "true".

 

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