Setting the video alpha on a Spark VideoPlayer control in Flex 4

The following example shows how you can set the video alpha on a Spark VideoPlayer control in Flex 4 by setting the alpha property on the VideoPlayer instance’s videoDisplay property.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see www.adobe.com/products/flex/. To download the latest nightly build of the Flex 4 SDK, see opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4.

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/10/24/setting-the-video-alpha-on-a-spark-videoplayer-control-in-flex-4/ -->
<s:Application name="Spark_VideoPlayer_videoElement_alpha_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:controlBarContent>
        <mx:Form paddingTop="0" paddingBottom="0">
            <mx:FormItem label="alpha:">
                <s:HSlider id="sldr"
                        minimum="0.0"
                        maximum="1.0"
                        value="1.0"
                        snapInterval="0.1"
                        stepSize="0.1"
                        change="vdPlyr.videoDisplay.alpha = sldr.value;" />
            </mx:FormItem>
        </mx:Form>
    </s:controlBarContent>
 
    <s:VideoPlayer id="vdPlyr"
            source="http://helpexamples.com/flash/video/water.flv"
            horizontalCenter="0" verticalCenter="0" />
 
</s:Application>

[GoogleAdsWide]

View source is enabled in the following example.

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

6 thoughts on “Setting the video alpha on a Spark VideoPlayer control in Flex 4

  1. Hello Peter,

    Could you clarify for me one question?
    The ‘outgoing’ VideoDisplay’ component supports AS cue points. This feature seems to be completely dropped from the VideoPlayer and VideoElement.
    Is there a way to add cue points within VideoPlayer/VideoElement, or it’s only possible with VideoDisplay?

    Thanks,
    Igor Borodin

  2. @Igor Borodin,

    Currently, I believe it is only possible with the older VideoDisplay control. As far as I understand, the VideoPlayer/VideoElement controls are being updated to use the Open Source Media Framework (OSMF) instead of the FLVPlayback code. So I believe that enhanced cuepoint support will most likely be added in the future, but I don’t have any first hand knowledge of when/if that would actually be happening.

    But please file a bug/enhancement request at http://bugs.adobe.com/flex/ and you may get a bit better idea on how soon it may be happening (depending on whether the bug is opened/deferred). Plus, that way you can watch the bug and be notified of new comments and updates.

    Peter

    1. Hello Peter,

      While working with VideoPlayer today, I’ve noticed that code completion offers me two VideoPlayers, both from the spark.components package: VideoPlayer and VideoPlayer2. And it’s also reflected in the language reference.
      What’s the difference?

      thanks,
      Igor Borodin

  3. Thank you Peter for the clarification.
    Meanwhile, perhaps using the combination of playheadTime and playheadUpdate will suffice.
    Thank you,
    Igor

Comments are closed.