0

The problem: I have to create a Flash video (in CS3) that will query a MySQL database and display that data at certain points in the video. The bigger problem: I'm not a Flash/ActionScript developer, so this is all very foreign to me!

I've divided this project into two parts: a.) dynamically generate an XML feed from the data using PHP (using an ID number passed in the URL's query string), and b.) be able to work with it in Flash. I've got the first part working, but am pretty lost in Flash. I can parse the XML, but I'm not sure how to set the data up as variables and attach it to a video's cue points.

Can anyone point me in the direction of a good tutorial or offer some advice?

1 Answers1

0

How are you pulling the video into the Flash Movie? One option is to use the Timer Class and have this running this when the video is playing, then you can compare the duration of the video at the time of the Timer Event to find out which data should be on the screen (If any, your XML nodes can have end and start times to display).

You just need a function to return the currently displayed data at a given time duration (Or null if none).

Chris Bos
  • 335
  • 1
  • 6
  • I'm using the FLVPlayback component. I was also able to pull in the text using the FLVPlaybackCaption component and time it using properly formatted XML; however, I'm not sure if FLVPlaybackCaption is going to let me stylize and animate the text like I want. Here's my ActionScript: – Aaron Ladage Jan 05 '11 at 14:50
  • import mx.video.*; myVid.autoPlay = true; myVid.contentPath = "video.flv"; myVid.autoRewind = true; var captions:Array; var captionsXML:XML = new XML(); captionsXML.ignoreWhite = true; captionsXML.onLoad = function():Void { captions = this.firstChild.childNodes; for(var i:Number = 0; i < captions.length; i++) { myVid.addASCuePoint(Number(captions[i].attributes.start), captions[i].firstChild.nodeValue); }; }; captionsXML.load("captions.xml"); myVid.addEventListener("cuePoint", onCuePoint); function onCuePoint(evntObj:Object):Void { txtCaption.text = evntObj.info.name; }; – Aaron Ladage Jan 05 '11 at 14:51
  • I've used the FLVCaptionComponent once and remember it was hard to get it styled correctly (Usually my video players are not built on FLVPlayback so it's not an option). If memory serves there was a way to get a handle on the actual textfield in the component then you can set the TextFormat so it will style correctly. Its the quickest simplest way to get the captions up on the screen though. – Chris Bos Jan 05 '11 at 16:18
  • Actually now I remember, I grabbed the TextField from the component and attached it elsewhere on the display list. So the component was still updating the text correctly, but I had more control on where the captions would be displayed (They wanted them in a panel beside the video not over layed on top). – Chris Bos Jan 05 '11 at 16:29