flash actionscript:
Hi, I was hoping that someone could help me out with this. I have a SWF that plays a FLV with actionscript cue points that when the cue point is reached the timeline plays. I need the cue points variables (the timecode) to be loaded from a text file because non Flash users will be adding content. The problem is that I can get it to work with putting the variables in the actionScript. But if I load the variables from the text file the playhead will not play with the cue point is reached. Below is the code that I am using. Thanks in advance. loadtextContent = new LoadVars(); // Load the text file into my movie loadtextContent.load("cuePointList.txt"); loadtextContent.onLoad = function(success) { if (success) { cuePoint0 = this.cue1; cuePoint1 = this.cue2; cuePoint2 = this.cue3; cuePoint3 = this.cue4; cuePoint4 = this.cue5; // Create cuePoint object. var cuePt:Object = new Object(); cuePt.time = 0; cuePt.name = "elapsed_time"; cuePt.type = "actionscript"; // Add AS cue point. //myVideoPlayback.addASCuePoint(cuePt); // Add Cue Points. myVideoPlayback.addASCuePoint(cuePoint0, "elapsed_time0"); myVideoPlayback.addASCuePoint(cuePoint1, "elapsed_time1"); myVideoPlayback.addASCuePoint(cuePoint2, "elapsed_time2"); myVideoPlayback.addASCuePoint(cuePoint3, "elapsed_time3"); myVideoPlayback.addASCuePoint(cuePoint4, "elapsed_time4"); myVideoPlayback.addASCuePoint(cuePoint5, "elapsed_time5"); }} // Display cue point information in text field. var listenerObject:Object = new Object(); listenerObject.cuePoint = function(eventObject) { play(); }; myVideoPlayback.addEventListener("cuePoint",listenerObject);
While loading the values from the text, instead of this, use the loadVars instance name. I believe "this" will point "outside" your loadVars instance. if (success) { cuePoint0 = loadtextContent.cue1; cuePoint1 = loadtextContent.cue2; cuePoint2 = loadtextContent.cue3; cuePoint3 = loadtextContent.cue4; cuePoint4 = loadtextContent.cue5; } I always used loadVars this way and everything goes fine...
Don't see what you're looking for? Try a search.
|