About the transparent image masks in Flex (I still have some questions)

Source: Internet
Author: User
Tags transparent image

I thought it was very easy to use the mask In Flex. Naturally, I wrote the following:Code:

< MX: Image Source = "Assets/bg.jpg" Mask = "{Maskimage }"   />
< MX: Image Source = "Assets/wjx.png" ID = "Maskimage"   />

Result: failed. The background image shows the size of the mask layer, but the transparent mask effect is not met.

 

 

Then, we learned from Google that the cacheasbitmap of the mask layer must be set to true when this transparent mask is used; otherwise, it is invalid.

< MX: Image Source = "Assets/bg.jpg" Mask = "{Maskimage }"   />
< MX: Image Source = "Assets/wjx.png" ID = "Maskimage" Cacheasbitmap = "True"   />

Result: failed. Same effect

 

 

Search for results from Google, find an example, and modify the code as follows.

< MX: Image Source = "Assets/bg.jpg" Mask = "{Maskimage }" >
< MX: Filters >
< MX: dropshadowfilter />
</ MX: Filters >
</ MX: Image >
< MX: Image Source = "Assets/wjx.png" ID = "Maskimage" Cacheasbitmap = "True"   />

Result: success.

 

 

Although the effect has been achieved, there is still a question about how to apply a filter to the background image to implement a transparent mask.
Hope that experts can answer the question.

The following describes when cacheasbitmap will be used. Thank you for sharing your experience:
Content from: http://as3blog.com/as3/when-and-how-to-use-cacheasbitmap/

Based on official instructions and my own experience, share the following information:
when cacheasbitmap is used:

1. A large number of animations exist on a complex vectoring background image.
2. scroll text area;
3. window-based applications (you often drag the entire area)
4. transparent mask (mandatory, otherwise invalid)

when cacheasbitmap is not used:

1. do not abuse it. cacheasbitamp consumes a lot of memory. A 250 × 250 pixel rectangle may occupy KB of memory after being cached!
2. Do not use the target element when it is scaled.
3. The target element itself should be static, or do not flip or zoom an animation frequently.
4. Do not mix the vector image with the cached bitmap.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.