My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GettingStarted  

Featured
Updated May 25, 2009 by flashdyn...@gmail.com

Getting Started with Blend Modes 4 Flash

Using the UltimateBlendModeShader SWC with CS4

If you have Flash CS4 installed a SWC can be referenced from your FLA. Go to File > Publish settings > Flash > Settings Then choose the tab 'Library path' and click the plus icon and select the UltimateBlendModeShader.swc file.

Applying custom blend modes with Actionscript to DisplayObjects

Once the UltimateBlendModeShader.swc is referenced in your FLA or your Flex Project you may apply custom blend modes in the following manners.

1) Using Static references to custom blend modes

import flash.display.BlendModeShader;

myDisplayObject.blendShader = BlendModeShader.SOFTLIGHT;

2) Using constructed instances of custom blend modes

import flash.display.BlendModeShader;
import flash.display.shaders.*;

myDisplayObject.blendShader = new BlendModeSoftlight();

3) Altering custom blend modes via multiplying and undoing

import flash.display.BlendModeShader;
import flash.display.shaders.*;

var customBlendMode: BlendModeSoftlight  = new BlendModeSoftlight();
customBlendMode.multiply = 2; //exaggerates the blendmode effect by double
customBlendMode.alpha = 0.5; // reverts the blendmode effect 50% back to the source blending layer

myDisplayObject.blendShader = customBlendMode;

Altering custom blend modes with Actionscript

Custom blend modes have 2 parameters which you can tweak to get a desired result. These parameters are alpha and multiply.

The alpha parameter

The alpha parameter undoes the blend shader to the source image where 0 is undone and 1 is the custom blend shader completely applied.

The multiply parameter

The multiply parameter exaggerates the blend shader effect. This can be thought of as similar to a process you may consider doing via applying the same custom blend shader onto duplicates of the same DisplayObject.

Comment by nikolaib...@hotmail.com, Oct 28, 2009

Is it possible to use your custom blend modes for Flash CS3?

Comment by makc.the...@gmail.com, Feb 16, 2010

I was reading through BlendModeExclusion? pbk and I am lost :( This site http://www.nathanm.com/photoshop-blending-math/ said that exclusion formula is as simple as Exclusion (A, B) = (A + B - 2 · A · B / 255) and I can't really understand what you are doing there...

Comment by makc.the...@gmail.com, Feb 16, 2010

waaaait... http://dunnbypaul.net/blends/ that the above link refers to puts this as R = ½ - 2×(Base-½)×(Blend-½) which does resemble your formula, and if you open that up you have the above simpler expression :)

Comment by akier...@gmail.com, Aug 24, 2011

Hi there,

Im having trouble getting this swc to work with cs5. will it work or is there a different process to get it working?

So far I have loaded the zipped folder containing library.swf and catalog.xml into the Components folder, and the UltimateBlendModeShader?.swc in the same place. I have added the .swc to the Library path of my flash project, and imported the library.swf to my library. I added the code above to try to apply a shader to an mc, and I recieve 'Warning: unable to load SWC UltimateBlendModeShader?.swc'

Is this the correct process?

thanks, ak

Comment by mecseki....@gmail.com, May 13, 2012

Hi Guys!

I am having the same issue as Akier. I only had a .zip. And inside an .xml and a.swf.

Thanks in advance for your time! Krs


Sign in to add a comment
Powered by Google Project Hosting