| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jun 2002
Posts: 7
|
Given the potential utility of cupoints in general the supplied documentation seems umm....lite.
To import cuepoint information from an XML file structured as: <listitem title="Introduction" name="unit1_320_20.flv" start="0" len="-1" thumb="chap1.jpg"> <qPoint qName="q1_1" qTime=":44" qText="Caption to show first."/> <qPoint qName="q1_2" qTime="1:15" qText="This text shows up at 1:15 et."/> <qPoint qName="q1_3" qTime="1:45" qText="This played last"/> </listtime> Cuepoints can be created by: var xmlPlaylist = new XML(); //setup a variable to hold the XML xmlPlaylist.ignoreWhite = true; xmlPlaylist.load( "playlist.xml" ); //load the XML file xmlPlaylist.onLoad = function( status ) { //trace("loading xml"); if ( !status ) trace( status ); var entries = this.childNodes[0]; for ( var i = 0; i < entries.childNodes.length; i++ ) { var entry = entries.childNodes[i]; for ( var q = 0; q < entry.childNodes.length; q++ ) { //trace ("entry.childNodes[q] = " + entry.childNodes[q].attributes.qName); MakeCue( entry.childNodes[q].attributes.qTime, entry.childNodes[q].attributes.qName, entry.childNodes[q].attributes.qText); } var entry = entries.childNodes[i]; } //end xmlPlaylist.onload function MakeCue(myTime:Number, myName:String, myParam:Object){ if (myTime <> undefined) { //trace("myTime = " + myTime + "myName" + myName + "myParam = " + myParam); my_FLVPlybk.addASCuePoint(1, myName, myParam); } } Except that documentation does not provide an example usage of the parameter nor an example of converting conventional time notation (hh:mm:ss:ms) into Number. Imagine the ass we could kick if it did! I'd very much appreciate any direction in these documentary holes by anyone able to address. thx, --steve... |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Jun 2002
Posts: 7
|
I've made some amount of progress. I'm now able to handle the parameter
with: var listenerObject:Object = new Object(); listenerObject.cuePoint = function(eventObject:Object):Void { trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime); trace("Cue point name is: " + eventObject.info.name); trace("Cue point type is: " + eventObject.info.type); trace("Cue point parameters are: " + eventObject.info.parameters); for (var x in eventObject.info) { trace ("x=" + x + " in " + eventObject.info[x]); } synchText_txt.text = eventObject.info.parameters; } myVideoHolder.myVideo.addEventListener("cuePoint", listenerObject); function MakeCue(myTime:String, myName:String, myParam:Object){ //trace("Making Cue"); var myCTime:Number; if (myTime <> undefined) { var convert2Seconds = myTime.split(":"); //todo - add detection/support for hours if (convert2Seconds[0] == ""){ myCTime = Number(convert2Seconds[1]); } else { myCTime = (Number(convert2Seconds[0] * 60)) + Number(convert2Seconds[1]); } } trace("myTime = "+ myCTime ); my_FLVPlybk.addASCuePoint(myCTime, myName, myParam); } |
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|