Posts Tagged Layer

Again on BlendMode (this time in AS2)

I was really happy when I found out how to do proper fade outs of MovieClips containing other MovieClips, but I am even more happy now because I found how to do it in ActionScript 2. I don’t know why but I was thinking that blendMode was something new that came in Flash 9, but I actually knew it came with Flash 8 at the same time that filters came in. I woke up when my colleague told me he and to roll back an animation from Flash 8 to Flash 7 and had to loose the blendModes because of that.

The way to do it is really similar than in ActionScript 3, it’s actually way easier but more prone to errors (if you mispell “layer” the compiler won’t tell you):

1
my_mc.blendMode = "layer";

That’s all there is to it.

, , ,

No Comments


BlendMode.LAYER; A must when changing the alpha property of a DisplayObject containing other DisplayObjects

I don’t know if you ever tweened a MovieClip’s alpha while this MovieClip contained multiple assets, but I kinda do this all the time (fade in ,fade out being the easiest transition for almost everything). The default way Flash handles this is by changing the alpha of every assets in the containing MovieClip (or Sprite). Sometimes it doesn’t matter but most of the time that’s not the behavior you would like it to have. When you have shapes or bitmaps that overlap or hide other graphical assets you will see what is under it when changing the alpha instead of actually changing the alpha of the container as if it was a whole.

Well I don’t know if it’s clear but I have an example below that should clarify that. Anyway, I have stumbled upon the solution to this while browsing through the help files for BlendMode. If you set the blendMode of your containing DisplayObject to BlendMode.LAYER Flash will consider this DisplayObject as only one layer and will change the alpha the way you normally think it would.

Here is the example that will illustrate my point better. The left Sprite is the reference object, the middle Sprite has no blendMode on and the right Sprite has a blendMode of BlendMode.LAYER. Mostly look at the colors while tweening and the overlapping regions of the green and blue ellipses.

I really wish I had found this earlier and I hope this will help others that were in my situation.

Cet article en Français

, , , ,

18 Comments