Transitions Sample

A popular question on the forums and with player developers is how to use transitional effects on media elements.  A common transitional effect is a fade to and from black.  These transitions help ease the transition from content to ad.   I’ve written a small sample to demonstrate how to do this with the framework.  It’s a reusable effect that utilizes the Flex Fade effect.  Here is an excerpt from the sample:

var video:MediaElement = new VideoElement(new URLResource(REMOTE_PROGRESSIVE));
new MediaElementEffect(10, video);
ps.media = video;

Full Sample:

The class that performs the transition is the MediaElementEffect, which takes two constructor params: a duration and the media element the transition will target.  In the above case, the transition will be ten seconds.  Clicking the stage will restart the video and effect from the beginning.  
Other effect frameworks, such as Tweener, can be swapped in and out. The effect type can be changed as well, to something such as dissolve.  To override or change the effect override the doTransition() function in MediaElementEffect