Jump to content
GreenSock

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

Select a TransformItem only on non-transparent regions?

Recommended Posts

Hi there,

 

we have bought a licence of your very fine TransformManager AS3 component, and now we ran into a first little problem:

 

There are different pictures on our stage, many of them are transparent PNGs.

Now we want the user to only be able to select one of the PNGs ( => TransformItems), if he/she clicks on a non-transparent region of the PNG.

 

By default, the user can click anywhere inside the boundaries of the whole PNG, and it does not matter if the image is transparent there or not.

 

Can this be solved by using any "hidden features" inside the classes, or would i have to change core code to accomplish this feature?

 

Any ideas and hints would be awesome, thank you!

Link to comment
Share on other sites

Yeah, unfortunately that's how Flash handles PNGs - transparent areas are clickable. There isn't a simple fix in TransformManager to avoid that, but I can think of two options you have:

 

1) Use a mask

 

2) Check out http://blog.mosessupposes.com/?p=40 for an idea of how to hack together a solution without a mask.

Link to comment
Share on other sites

  • 2 months later...

You can do some simple bitmap hit testing if you want to check for sure... we are developing an application that has to deal with this, and essentially I check to see if the object clicked on is a bitmap, and if it is I run the bitmap hit test on the points and use that as the basis for my hit testing.

 

However, because if this I have to restrict the transformManager to not execute it's own select/deselect events and instead I tell the manager what to select and deselect.

Link to comment
Share on other sites

  • 1 month later...
Yeah, unfortunately that's how Flash handles PNGs - transparent areas are clickable. There isn't a simple fix in TransformManager to avoid that, but I can think of two options you have:

 

1) Use a mask

 

2) Check out http://blog.mosessupposes.com/?p=40 for an idea of how to hack together a solution without a mask.

 

Thanks for that, i tried to incorporate the InteractivePNG class by using it as a container for my bitmaps, but the transformManager seems to apply it's own mouseEvent handlers.. so it still selects any item with or without opacity. Seems like i will need to dig deeper into your fine class.. 8-)

Link to comment
Share on other sites

You can do some simple bitmap hit testing if you want to check for sure... we are developing an application that has to deal with this, and essentially I check to see if the object clicked on is a bitmap, and if it is I run the bitmap hit test on the points and use that as the basis for my hit testing.

 

However, because if this I have to restrict the transformManager to not execute it's own select/deselect events and instead I tell the manager what to select and deselect.

 

Hey there stickeryou,

 

seems like i need to do the same thing as you did, as my trial with the InteractivePNG class did not succeed..

Can you you tell me in a little more detail how you "bypassed" the TransformManagers own MouseEvent handling?

And did you remove all the MouseEvent handling, or just the "Select / Deselect" part?

 

Thanks a bunch! :)

Link to comment
Share on other sites

  • 1 month later...

Yes, essentially I have removed the transform manager's selection capabilities. I capture mouse down myself and then tell the transform manager what to select / deselect based on the results of my testing. We've made several other modifications to it, as we needed to control the parent where the items are added as well, so there's a bit more to it, but a simple solution would be to just do what I've suggested. Override the select/deselect capabilities and then code a mouse down event for your own purposes.

Link to comment
Share on other sites

  • 10 months later...
Yeah, unfortunately that's how Flash handles PNGs - transparent areas are clickable. There isn't a simple fix in TransformManager to avoid that, but I can think of two options you have:

 

1) Use a mask

 

2) Check out http://blog.mosessupposes.com/?p=40 for an idea of how to hack together a solution without a mask.

 

Hi,

 

Do you have a little example of using a mask with the image class (and png transparent) ? I really would like select the object hidden by the transparent region.

Many thanks

 

Vincent.

Link to comment
Share on other sites

  • 2 years later...

Hi,

did any of you guys succeed? Do you still have the code you wrote?

I think greensock should implement this feature in the transformmanager, I've bought this product mainly because I'm not an advanced developer. Now I'm discovering that I must change a lot and dig deep down greensock's code...

Please help.

Thanks

Link to comment
Share on other sites

I'm sorry to hear about the disappointment, amexudo. We'd be happy to issue a full refund if you're not happy with TransformManager and prefer to cancel the license. Unfortunately, adding the capability you're requesting isn't exactly a trivial thing at all, especially to bake it into the core in a way that would work in a vast number of scenarios (like lots of overlapping PNGs with transparency), plus doing so would likely reduce performance for everyone because of all the extra conditional logic necessary on every click. Doing what stickeryou suggested is much less impactful because if you can make certain assumptions based on your particular project, it makes coding that feature far easier.

 

Less than 0.25% of the customers base has ever reported a need for this type of feature, so it's very difficult to justify the performance tradeoff (for everyone) and time investment.

 

Again, just contact us if you'd like a full refund. We want happy customers, not frustrated ones.

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.

×