ActiveDen

Setting alpha to a container

2998 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
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!

1 year ago
597 posts
  • Has been a member for 2-3 years
  • Contributed a Tutorial to a Tuts+ Site
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • China
  • Referred between 50 and 99 users
activetofocus says

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

1 year ago
2998 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
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:

1 year ago
137 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
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.

1 year ago
2998 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
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.

1 year ago
137 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
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.

1 year ago
2998 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
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.

1 year ago
1553 posts Rockstar Developer
  • Has been a member for 5-6 years
  • Envato Staff
  • Reviewer
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • Australia
  • Referred between 10 and 49 users
RimmonTrieu 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.

1 year ago
RimmonTrieu is an Envato staff member
2998 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a File in an Envato Bundle
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • India
  • Referred between 200 and 499 users
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.

1 year ago
by
by
by
by
by