Jump to content
GreenSock

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

Adding color picker to the ignoredObject list help needed

Recommended Posts

My program uses the TransformManagerTool AS3 from Greensock.

I'm trying to have my program NOT deselect my selected item when the user chooses a color from a color picker flash component.

To do so I added the color picker to the igneredObject list:

 

                       tManager.addIgnoredObject(myPicker);

 

The picker is added with success but clicking any color from the palette deselects any selected item. I then though I should add the components children to the ignoredObject list:

 

		for (var i:uint = 0; i < myPicker.numChildren; i++){
			tManager.addIgnoredObject(myPicker.getChildAt(i));
		}

 

Which changed nothing. I traced the added children and the component seems to only have 1 button child. I guess I missunderstood the way the components work.

How could I make it so the color picker component does not deselect selected items?

Link to comment
Share on other sites

No need to add the children like that (as you discovered). It sounds like the ColorPicker actually puts a new (different) DIsplayObject on top of the display list for the actual color palette that you choose from, so that [additional] picker item would need to be added to the ignored objects. However, one other easy way to make this work is to turn OFF the autoDeselect option (autoDeselect:false) on your TransformManager and then put a big rectangle (a Sprite) BEHIND all your objects (think of it like a background) with an alpha of 0. Then, add a MouseEvent.CLICK event listener to that rectangle Sprite and in your handler, call your TransformManager's deselectAll() method. That way, only clicks that go through to the background get registered. See what I mean?

 

Since your color picker (and other interface elements) are on top of that rectangle, clicks on them won't matter.

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.

×