<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; CuePointEvent</title>
	<atom:link href="http://blog.flexexamples.com/category/cuepointevent/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating ActionScript cue points with the VideoDisplay control</title>
		<link>http://blog.flexexamples.com/2007/07/29/creating-actionscript-cue-points-with-the-videodisplay-control/</link>
		<comments>http://blog.flexexamples.com/2007/07/29/creating-actionscript-cue-points-with-the-videodisplay-control/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 06:00:32 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[CuePointEvent]]></category>
		<category><![CDATA[VideoDisplay]]></category>
		<category><![CDATA[cuePoint]]></category>
		<category><![CDATA[cuePointManagerClass]]></category>
		<category><![CDATA[playheadUpdate]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/29/creating-actionscript-cue-points-with-the-videodisplay-control/</guid>
		<description><![CDATA[<p>A simple example of creating and using ActionScript cue points with the VideoDisplay control. The example uses a VideoDisplay control to display the progressively downloaded video, a ProgressBar to display the amount of video that has played back, and two DataGrid controls to show ActionScript cue points and embedded cue points.</p> <p>Full code after the [...]]]></description>
			<content:encoded><![CDATA[<p>A simple example of creating and using ActionScript cue points with the VideoDisplay control. The example uses a VideoDisplay control to display the progressively downloaded video, a ProgressBar to display the amount of video that has played back, and two DataGrid controls to show ActionScript cue points and embedded cue points.</p>
<p>Full code after the jump.</p>
<p><span id="more-39"></span></p>
<p>The following example creates a series of ActionScript cue points using the &lt;mx:Array&gt; tag and adds them to the VideoDisplay control by setting its <code>cuePoints</code> property. It also demonstrates how you can use a ProgressBar control to display the video playback status using the <code>playheadUpdate</code> event and the ProgressBar control&#8217;s <code>label</code> property:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.CuePointEvent;

            [Bindable]
            private var embeddedCuePoints:ArrayCollection = new ArrayCollection();

            private function onCuePoint(evt:CuePointEvent):void {
                var cuePointObject:Object = {name:evt.cuePointName, time:evt.cuePointTime, type:evt.cuePointType};
                if (evt.cuePointType != "actionscript") {
                    embeddedCuePoints.addItem(cuePointObject);
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="cuePointArr"&gt;
        &lt;mx:Object name="one" time="1" type="actionscript" /&gt;
        &lt;mx:Object name="two" time="2" type="actionscript" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:VideoDisplay id="videoDisplay" cuePointManagerClass="mx.controls.videoClasses.CuePointManager" cuePoints="{cuePointArr}" cuePoint="onCuePoint(event)" source="http://www.helpexamples.com/flash/video/cuepoints.flv" playheadUpdate="progressBar.setProgress(videoDisplay.playheadTime, videoDisplay.totalTime);" /&gt;
    &lt;mx:ProgressBar id="progressBar" mode="manual" width="{videoDisplay.width}" minimum="0" maximum="{videoDisplay.totalTime}" label="{videoDisplay.state} %3%%" /&gt;

    &lt;mx:HBox&gt;
        &lt;mx:Panel title="ActionScript cue points:"&gt;
            &lt;mx:DataGrid id="actionScriptCuePointGrid" dataProvider="{videoDisplay.cuePoints}"&gt;
                &lt;mx:columns&gt;
                    &lt;mx:DataGridColumn dataField="name" headerText="Name:" /&gt;
                    &lt;mx:DataGridColumn dataField="time" headerText="Time:" /&gt;
                    &lt;mx:DataGridColumn dataField="type" headerText="Type:" /&gt;
                &lt;/mx:columns&gt;
            &lt;/mx:DataGrid&gt;
        &lt;/mx:Panel&gt;

        &lt;mx:Panel title="Embedded cue points:"&gt;
            &lt;mx:DataGrid id="embeddedCuePointGrid" dataProvider="{embeddedCuePoints}" itemClick="videoDisplay.playheadTime = event.currentTarget.selectedItem.time;"&gt;
                &lt;mx:columns&gt;
                    &lt;mx:DataGridColumn dataField="name" headerText="Name:" /&gt;
                    &lt;mx:DataGridColumn dataField="time" headerText="Time:" /&gt;
                    &lt;mx:DataGridColumn dataField="type" headerText="Type:" /&gt;
                &lt;/mx:columns&gt;
            &lt;/mx:DataGrid&gt;
        &lt;/mx:Panel&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;</pre>
<p>If you prefer to define the cue point array in ActionScript rather than MXML, you could use this snippet instead:</p>
<pre class="code">
[Bindable]
private var cuePointArr:Array = [{name:"one", time:1, type:"actionscript"}, {name:"two", time:2, type:"actionscript"}];
</pre>
<p>Or&#8230;</p>
<pre class="code">
[Bindable]
private var cuePointArr:Array;

private function initCuePoints():void {
    cuePointArr = new Array();
    cuePointArr.push({name:"one", time:1, type:"actionscript"});
    cuePointArr.push({name:"two", time:2, type:"actionscript"});
    videoDisplay.cuePoints = cuePointArr;
}
</pre>
<p>You can also define the ActionScript cue points directly within the VideoDisplay MXML tags, like so:</p>
<pre class="code">
&lt;mx:VideoDisplay id="videoDisplay" cuePointManagerClass="mx.controls.videoClasses.CuePointManager" cuePoint="onCuePoint(event)" source="http://www.helpexamples.com/flash/video/cuepoints.flv" playheadUpdate="progressBar.setProgress(videoDisplay.playheadTime, videoDisplay.totalTime);"&gt;
    &lt;mx:cuePoints&gt;
        &lt;mx:Object name="one" time="1" type="actionscript" /&gt;
        &lt;mx:Object name="two" time="2" type="actionscript" /&gt;
    &lt;/mx:cuePoints&gt;
&lt;/mx:VideoDisplay&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating ActionScript cue points with the VideoDisplay control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/29/creating-actionscript-cue-points-with-the-videodisplay-control/',contentID: 'post-39',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'cuePoint,cuePointManagerClass,playheadUpdate',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/07/29/creating-actionscript-cue-points-with-the-videodisplay-control/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Getting started with the VideoDisplay control</title>
		<link>http://blog.flexexamples.com/2007/07/23/getting-started-with-the-videodisplay-control/</link>
		<comments>http://blog.flexexamples.com/2007/07/23/getting-started-with-the-videodisplay-control/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 01:01:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[CuePointEvent]]></category>
		<category><![CDATA[VideoDisplay]]></category>
		<category><![CDATA[VideoEvent]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/23/getting-started-with-the-videodisplay-control/</guid>
		<description><![CDATA[<p>I was experimenting with the VideoDisplay control the other day and built this simple little example to help me understand the order of events when loading a Flash Video (FLV).</p> <p></p> <p>The following example creates a VideoDisplay control and displays each event in a debugging DataGrid which displays the type of event, video state, playhead [...]]]></description>
			<content:encoded><![CDATA[<p>I was experimenting with the VideoDisplay control the other day and built this simple little example to help me understand the order of events when loading a Flash Video (FLV).</p>
<p><span id="more-18"></span></p>
<p>The following example creates a VideoDisplay control and displays each event in a debugging DataGrid which displays the type of event, video state, playhead time, and total time of the FLV:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" backgroundColor="white" creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.CuePointEvent;
            import mx.events.VideoEvent;

            [Bindable]
            private var arrColl:ArrayCollection;

            [Bindable]
            private var FLV_URL:String = "http://www.helpexamples.com/flash/video/clouds.flv";

            /**
             * Initialize the ArrayCollection object.
             */
            private function init():void {
                arrColl = new ArrayCollection();
            }

            private function doVideoEvent(evt:VideoEvent):void {
                doAddItem({type:evt.type});
            }

            private function doCuePointEvent(evt:CuePointEvent):void {
                doAddItem({type:evt.type});
            }

            private function doProgressEvent(evt:ProgressEvent):void {
                doAddItem({type:evt.type});
            }

            /**
             * Add the item to the ArrayCollection instance, revalidate the DataGrid control, and scroll to the last item in the DataGrid.
             */
            private function doAddItem(obj:Object):void {
                arrColl.addItem({type:obj.type, state:videoDisplay.state, playheadTime:videoDisplay.playheadTime, totalTime:videoDisplay.totalTime});
                dataGrid.validateNow();
                dataGrid.selectedIndex = arrColl.length;
                dataGrid.scrollToIndex(arrColl.length);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:VideoDisplay id="videoDisplay" source="{FLV_URL}" autoPlay="false" autoRewind="false"
            ready="doVideoEvent(event);"
            rewind="doVideoEvent(event);"
            playheadUpdate="doVideoEvent(event);"
            close="doVideoEvent(event);"
            complete="doVideoEvent(event);"
            progress="doProgressEvent(event);" /&gt;

    &lt;mx:HBox&gt;
        &lt;mx:Button label="play()" click="videoDisplay.play();" /&gt;
        &lt;mx:Button label="pause()" click="videoDisplay.pause();" /&gt;
        &lt;mx:Button label="stop()" click="videoDisplay.stop();" /&gt;
    &lt;/mx:HBox&gt;

    &lt;mx:DataGrid id="dataGrid" dataProvider="{arrColl}" width="320" rowCount="5"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn id="typeCol" dataField="type" headerText="Evt. type" /&gt;
            &lt;mx:DataGridColumn id="stateCol" dataField="state" /&gt;
            &lt;mx:DataGridColumn id="playheadTimeCol" dataField="playheadTime" textAlign="right" /&gt;
            &lt;mx:DataGridColumn id="totalTimeCol" dataField="totalTime" textAlign="right" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Getting started with the VideoDisplay control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/23/getting-started-with-the-videodisplay-control/',contentID: 'post-18',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/07/23/getting-started-with-the-videodisplay-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Listening for a Flash Video&#8217;s cue points using the VideoDisplay control</title>
		<link>http://blog.flexexamples.com/2007/07/23/listening-for-a-flash-videos-cue-points-using-the-videodisplay-control/</link>
		<comments>http://blog.flexexamples.com/2007/07/23/listening-for-a-flash-videos-cue-points-using-the-videodisplay-control/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 00:50:29 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[CuePointEvent]]></category>
		<category><![CDATA[VideoDisplay]]></category>
		<category><![CDATA[cuePoint]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/23/listening-for-a-flash-videos-cue-points-using-the-videodisplay-control/</guid>
		<description><![CDATA[<p>Here&#8217;s a simple example that listens for the cuePoint event on a VideoDisplay control and updates a DataGrid control whenever the cue point is encountered.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" backgroundColor="white" &#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.collections.ArrayCollection; import mx.events.CuePointEvent; [Bindable] private var arrColl:ArrayCollection = new ArrayCollection(); [Bindable] private var [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple example that listens for the <code>cuePoint</code> event on a VideoDisplay control and updates a DataGrid control whenever the cue point is encountered.</p>
<p>Full code after the jump.</p>
<p><span id="more-20"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" backgroundColor="white" &gt;
    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.CuePointEvent;

            [Bindable]
            private var arrColl:ArrayCollection = new ArrayCollection();

            [Bindable]
            private var FLV_URL:String = "http://www.helpexamples.com/flash/video/cuepoints.flv";

            private function doCuePoint(evt:CuePointEvent):void {
                var eType:String = evt.type;
                var cpName:String = evt.cuePointName;
                var cpTime:Number = evt.cuePointTime;
                var cpType:String = evt.cuePointType;

                arrColl.addItem({type:eType, cuePointName:cpName, cuePointTime:cpTime, cuePointType:cpType});
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:VideoDisplay id="vid" autoPlay="true" source="{FLV_URL}" cuePoint="doCuePoint(event);" /&gt;

    &lt;mx:DataGrid id="dataGrid" dataProvider="{arrColl}" width="400" rowCount="5"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn id="typeCol" dataField="type" /&gt;
            &lt;mx:DataGridColumn id="cuePointNameCol" dataField="cuePointName" /&gt;
            &lt;mx:DataGridColumn id="cuePointTimeCol" dataField="cuePointTime" textAlign="right" /&gt;
            &lt;mx:DataGridColumn id="cuePointTypeCol" dataField="cuePointType" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Listening for a Flash Video\&#039;s cue points using the VideoDisplay control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/23/listening-for-a-flash-videos-cue-points-using-the-videodisplay-control/',contentID: 'post-20',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'cuePoint',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/07/23/listening-for-a-flash-videos-cue-points-using-the-videodisplay-control/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

