PhotoDune

Setting alpha to a container

4528 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

Looking for a solution on this:

- A container Sprite has 2 objects inside and one over another.
- The object on top hides the blow one. So the object below is not visible.
- If we reduce the alpha property of container, the object below becomes visible slightly which is unexpected. But this is the way flash works.

To avoid this, there is an alternative: Instead of setting alpha value to the container, mask the container and apply alpha to the mask object.

But I don’t want to go with mask due to other issues on the project. Is there any alternative for this? Any simple property / blend modes that can help these situations?
Thanks!

747 posts
  • Elite Author
  • Has been a member for 3-4 years
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Contributed a Tutorial to a Tuts+ Site
  • Microlancer Beta Tester
+4 more
activetofocus says

About alpha,you can try use blendMode = “layer” . I often use it. :)

4528 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

Thanks activetofocus! That works!

But sadly it works only if objects doesn’t have any 3D properties set. hmm… due to the same reason, mask also doesn’t works! :confusedsad:

148 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
XanderRock says

and I guess you dont want to double the alpha ? cause if I got this correct all you need to do is when changing the container alpha change the object visibility at the same time. like below object visible false and container alpha reduce. so you’ll only show foreground object as fading.

4528 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

...when changing the container alpha change the object visibility at the same time. like below object visible false and container alpha reduce. so you’ll only show foreground object as fading.

Yes, that will work but objects are only partially overlapped. So we can’t hide them.

Anyway we have whole lot of trouble when using native 3D properties of flash. Really not sure if next flash version will have some solutions. Otherwise it will be a 3D tool that ’s not much supportive to real life interactive projects. What actually happens is even if the child objects are working only with 2D properties, the usual display functionalities (bitmap mask, blendmodes etc) are disabled in player 10.

148 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
XanderRock says

So I guees its about 3D object properties. But as you know Adobe keeps upgrading AS3 . its a very powerful lang.

And did you also try removing below 3d object from display? and keeping it in cache to add it to stage later. Cause it should probably work.

4528 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

And did you also try removing below 3d object from display? and keeping it in cache to add it to stage later. Cause it should probably work.

Thanks for the suggestions. To be clear, the container is a sprite that has some z position (so it’s parent becomes 3D). All it’s children are within 2D properties. I guess the player has no logical problems applying those display properties to children. Should try some more tricks with hierarchy tree and need to see if I miss something.

1626 posts fueledweb.com
  • Envato Staff
  • Reviewer
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
+4 more
RimmonTrieu staff says

Try using BitmapData to draw the container Sprite before applying 3D transformation then create a new Bitmap to hold that BitmapData and apply 3D properties and alpha to that Bitmap.

Downside is you’ll need to keep drawing if there is any animation.

4528 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

Downside is you’ll need to keep drawing if there is any animation.

Yes that is the case.

Just found that the blendmode works but we need to add another container inbetween (on which blendmode set to “layer”), that’s fine. So no problem with the way Flash works!

Also works only when either parent or child is not 3D. Doesn’t work if both has 3d which is understandable.

by
by
by
by
by