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 http://www.adobe.com/products/flex/. To download the latest nightly build of the Flex 4 SDK, see http://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>

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.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

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

  1. Anonymous says:

    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. Peter deHaan says:

    @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

  3. Anonymous says:

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

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree