XML video cuePoint
I'm making a video play that uses XML to go to the cue points
but I just can't get the xml and actionscript to work
together...
What a coincidence - I'm making a car, and the engine won't
start...
Remove '_spamkiller_' to mail
Similar Messages
-
Need help with xml video gallery
Hello everyone
I recently bought a xml video gallery. I'm loading the movie externally into another movie. When the xml gallery loads, it cancels all sounds.
I need to figure out where in the actionscription can i reverse the cancellation of sounds. Can anyone help? if possible, I can email, whomever is willing to help, the xml gallery to see if theres another reason the sound is being canceled.
Also, the sound of the gallery doesn't work til you click the volume scroller.
Here are two parts of actionscript included in the gallery:
part one:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.collection_mc._ x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_mc.main_mc. collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._width));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound();
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true;if you mean sound works well when the gallery is tested without being loaded into another swf but fails when loaded, change the highlighted line:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.colle ction_mc._x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_m c.main_mc.collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._w idth));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound(this);
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true; -
Load XML Videos data on tilelist(component) click
Is this possible to load XML Videos data on tilelist(component) click..?
yes. works for me:
import fl.video.FLVPlayback;
var flv_pb1:FLVPlayback = new FLVPlayback();
var flv_pb2:FLVPlayback = new FLVPlayback();
var flv_pb3:FLVPlayback = new FLVPlayback();
flv_pb1.source="z_flvs/water.flv";
flv_pb2.source="z_flvs/sample.mp4";
flv_pb3.source="z_flvs/water.flv";
tl.addItem({alt:"v 1", src: flv_pb1});
tl.addItem({alt:"v 2", src: flv_pb2});
tl.addItem({alt:"v 3", src: flv_pb3});
tl.labelField = "alt";
tl.sourceField = "src";
tl.columnWidth = 400;
tl.rowHeight = 600;
tl.columnCount = tl.length;
tl.rowCount = 1;
tl.move(10, 10); -
I've created an XML video playlist like the one shown in this
tutorial:
http://www.adobe.com/devnet/flash/articles/prog_download.html
I was wondering how I could edit it to autoplay the first
item in the list upon loading, but still have the list be
completely functional. I've tried everything I can think of, but
can't get it to autoplay and still work.
Thanks!this just uses a xml playlist and listbox component.i seen a
tutorial on one with thumbnails...if i run across it again ill post
the link.maybe this will get you started.
http://www.video-animation.com/flash8_016.shtml -
URGENT help needed in creating external xml video plalist. Please help!
I was given an assignment to create and external video playlist using an xml file. I have never used flash before, know nothing about encoding and all that was given to the class in terms of instuctions was a short tutorial that has no resources for troubleshooting. We were given everything; the external playlist file equipped with the video skin, the video list, actionscript that loads the xml and the xml file. We were told that all we need to do is change the names of the videos in the xml file to match the names of our videos. I did that. We were also told we needed to "name target", but we were not informed on how to do this. I have tried everything, visited every tutorial and I cannot figure out how to get this damn thing to work. I cannot even get flash to load the xml file. PLEASE HELP.
Here is the xml file:
<?xml version = "1.0" encoding = "i-8859-1"?>
<playlist>
<ADogWithoutABone
flvurl="ADogWithoutABone.flv"
desc="Hyper Wall First Video" />
<Highway
flvurl="Highway.flv"
desc="Hyper Wall Second Video" />
<PsychoBabble
flvurl="PsychoBabble.flv"
desc="Hyper Wall Third Video" />
<SomethingElse
flvurl="SomethingElse.flv"
desc="Hyper Wall Fourth Video" />
</playlist>
I tried putting in the entire address of the file location, but it did nothing.
Here is the actionscript in the flash file:
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(new URLRequest("playlistXML.xml"));
function xmlLoaded(event:Event):void {
var playlistXML:XML = new XML(event.target.data);
var item:XML;
for each(item in playlistXML.videoname) {
trace("item: "+item.attribute("flvurl").toXMLString());
myPlayList.addItem({label:item.attribute("desc").toXMLString(), data:item.attribute("flvurl").toXMLString()});
//Select the first video
myPlayList.selectedIndex = 0;
//And automatically play it
myPlayScreen.play(myPlayList.selectedItem.data);
//Add a listener to detect when new video is selected and play it
function listListener(event:Event) {
myPlayScreen.play(event.target.selectedItem.data);
myPlayList.addEventListener(Event.CHANGE, listListener);
I tried placing the full address of the xml file in, along with the file address of the videos, but again it did nothing. Everything is located in the same file, and the videos in a sub file in that file. I tried taking out the sub file and putting all the videos in the same file, but it did nothing. I am sure it's something very simple, but like I said I have NO experience with this whatsoever. I am SO lost and DESPERATELY need help. PLEASE someone SAVE MEEEE!
ThanksIt might be a crossdomain.xml problem.
Please make sure that the server hosting the xml allows the domain where the swf is hosted.
You can start with:
<?xml version="1.0" encoding="utf-8" ?>
<cross-domain-policy>
<allow-access-from domain="*"/>
<site-control permitted-cross-domain-policies="master-only"/>
</cross-domain-policy> -
I have assetts loading into my file with an xml doc. The
images and text is loading fine but when I try to load in external
.swf's i get a error. I am sure my mc on the stage is labeled
correctly and that the files are in the right location.
here is the error and the code.why in the error is my local path and my xml element path
split up. -
Load xml video on tilelist click
greetings all,
so i'm still working on the &#$@ player i 've added the
TileList component from the Dynamic Playlist lesson here at adobe..
I have it working for he most part.
i'm having some issues with playing the correct video on
tileList click...
i can get it to play continuously with the idx++
but i can't get it to play the clip i want on click (it just
goes to the next video on any click)
any help you can offer would be grand... thanks
http://dev2.creativenet.net/_n8/playlist/yes. works for me:
import fl.video.FLVPlayback;
var flv_pb1:FLVPlayback = new FLVPlayback();
var flv_pb2:FLVPlayback = new FLVPlayback();
var flv_pb3:FLVPlayback = new FLVPlayback();
flv_pb1.source="z_flvs/water.flv";
flv_pb2.source="z_flvs/sample.mp4";
flv_pb3.source="z_flvs/water.flv";
tl.addItem({alt:"v 1", src: flv_pb1});
tl.addItem({alt:"v 2", src: flv_pb2});
tl.addItem({alt:"v 3", src: flv_pb3});
tl.labelField = "alt";
tl.sourceField = "src";
tl.columnWidth = 400;
tl.rowHeight = 600;
tl.columnCount = tl.length;
tl.rowCount = 1;
tl.move(10, 10); -
Require Help with Flash Video XML Playlist
flash devs,
all i'm doing to playin videos from a xml file - (used lots
of info and code from Lee's XML Video Playlist Tutorial)
after spending hours getting this to work correctly in AS3
and how i want it to work i've hit a brick wall
i've got 2 components on stage - vid_select (List) & vid
(Player)
i can load my flv videos from my xml file just perfect but
after the first video is done it stops.
i'd like to have my video player play through the xml file
and then restart at the beginning...
i've attached my code...
if anyone could possibly help me so that it "loops" through
all the video in my xml list that would be
so greatly appreciated...
i'm new to AS and am learning alot but some code gets
complicated and i'm not sure what to add...
thanks in advance
@pixeladdiktAgain thank you for your help in advance...
I put the script folder into the root. As far as the .flv
file it is showing up as being "put" to my web server. when i
checked the root folder it is there. again i am having the same
problem.. the local view works but when i check it on the web it
just shows that there should be a flash video there but it does not
show up.
i created a new root for this test page the new link is..
http://www.wfwa.org/TESTindexfolder/TESTindex.asp
here are the files that are showing up in it...
flashprojectwebvid.fla
flashprojectwebvid.html
flashprojectwebvid.swf
PBSpromo.flv
SteelExternalPlaySeekMute.swf
TESTindex.asp
and the Scripts folder
thanks again for any help.. -
Flash Video Cue Points don't work
I used the template sample from Adobe named :Flash video
template: Showcase website for personal video...I followed all the
steps sugested. I used Flash Video Encoder, created the cue points,
worte down the location of those cue points, which I wrote exactly
in the Settings.XML file for each chapter....etc. I guarantee you
that I did it all as sugested...In fact several months ago, it
worked for another project and another videos that I had.
But this time, when I am testing it, the video appears in the
screen all right but when I select a chapter for the section of
that video, an error appears like this :
VideoError: 1003: Invalid seek
at fl.video::VideoPlayer/seek()
at fl.video::FLVPlayback/seek()
at
Video_fla::MainTimeline/chapterClickHandler()[Video_fla.MainTimeline::frame1:184]
VideoError: 1003: Invalid seek
at fl.video::VideoPlayer/seek()
at fl.video::FLVPlayback/seek()
at
Video_fla::MainTimeline/chapterClickHandler()[Video_fla.MainTimeline::frame1:184]
My Settings file has the correspondent locations for each cue
point, like this :
<?xml version="1.0" encoding="utf-8"?>
<showcase>
<!-- Video section #1: Safety Fair 2008 -->
<section>
<title>Safety Fair 2008</title>
<video>video/MOPS_safetyFair.flv</video>
<cuepoints>
<cuepoint>
<title>Fire Department 1</title>
<time>00:00:13.291</time>
<image>img/Gath1.png</image>
<caption>What to do in case of a fire at
home...</caption>
</cuepoint>
<cuepoint>
<title>Fire Department 2</title>
<time>00:01:39.686</time>
<image>img/Poison Center.png</image>
<caption>How to escape from a fire at
home</caption>
</cuepoint>
<cuepoint>
<title>Crime Stoppers</title>
<time>00:01:51.869</time>
<image>img/TxDepTra.png</image>
<caption>Buckle up...</caption>
</cuepoint>
<cuepoint>
<title>Texas Dep of Transportation</title>
<time>00:01:51.869</time>
<image>img/Poison Center.png</image>
<caption>Assistance by phone in case of
emergency...</caption>
</cuepoint>
<cuepoint>
<title>Poison Center</title>
<time>00:02:02.946</time>
<image>img/Gathering3.png</image>
<caption>Mops Gathering at the FLC Picnic
area</caption>
</cuepoint>
<cuepoint>
<title>Fellowship</title>
<time>00:02:09.591</time>
<image>img/Kids-with-Jenny.png</image>
<caption>Nice visit and gathering w/our
children</caption>
</cuepoint>
</cuepoints>
</section>
I have my file structure right as well in each folder IMG and
VIDEO.
What does this error means and how can I correct the
problem.....I have been expending hours trying different ways and
still can't get it to work.
Thanks,
Ednayou don't need a cuepoint to detect the end of your video. use:
var lo:Object = {};
lo.complete = function(eObj:Object):Void {
next_btn._visible=true;
flv_pb.addEventListener("complete", lo); // <- use the instance name of your flvpb component -
Hi everyone, I'm trying to create a videochat using Flex 3
and Flash Media server and I have some problems with the method
"Clear" of Video object. When a user stop publishing its stream
(from the webcam), I receive an event because a shared object
property (with the id of the publisher) changes to "null". At this
time, I invoke the method "clear" of the video object that contains
the stream, but the screen (videoDisplay containing the video
object) doesn't change. I continue seeing the last frame received.
What can I do? Thanks!!You could also subclass the VideoDisplay control and add your
own public "clear()" method which calls the
mx_internal::videoPlayer.clear() code.
[ActionScript]
package {
import mx.controls.VideoDisplay;
import mx.core.mx_internal;
public class MyVideoDisplay extends VideoDisplay {
public function MyVideoDisplay() {
//TODO: implement function
super();
public function clear():void {
pause();
mx_internal::videoPlayer.clear();
[/ActionScript]
[MXML]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:custom="*" layout="vertical">
<custom:MyVideoDisplay id="myVideoDisplay" source="
http://www.helpexamples.com/flash/video/cuepoints.flv"
/>
<mx:Button label="clear" click="myVideoDisplay.clear();"
/>
</mx:Application>
[/MXML]
Peter -
I'm creating xml player. xml process and playing single video is fine. i stuck at multiple videos playing. give me any solution please..?
i have 3 buttons, if i click button_1 play first video, or if i click button_3 play 3rd video.
how to attach videoURL = playlist files.
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("video_list.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
myXML = new XML(e.target.data);
trace(myXML.Video[0]);
button_1.addEventListener(MouseEvent.CLICK, btn1Click);
button_2.addEventListener(MouseEvent.CLICK, btn2Click);
function btn1Click(e:MouseEvent):void
ns.play(myXML.Video[0]);
function btn2Click(e:MouseEvent):void
ns.play(myXML.Video[1]);
var videoURL:String;
//var videoURL:String = "http://www.helpexamples.com/flash/video/cuepoints.flv";
var nConnection:NetConnection;
var ns:NetStream;
var video:Video = new Video();
nConnection = new NetConnection();
nConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nConnection.connect(null);
function netStatusHandler(event:NetStatusEvent):void
switch (event.info.code)
case "NetConnection.Connect.Success" :
connectStream();
break;
case "NetStream.Play.Stop" :
break;
default :
function connectStream():void
ns = new NetStream(nConnection);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
vidDisplay.attachNetStream(ns);
ns.play(videoURL);
XML
<?xml version="1.0" encoding="utf-8"?>
<Playlist>
<Video Title="Chapter 1">media/video_1.flv</Video>
<Video Title="Chapter 2">media/video_2.flv</Video>
</Playlist>everything should work as long as you wait for xml loading to complete before clicking your buttons. you can disable those buttons when you app starts and enable them in processXML.
var videoURL:String;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("video_list.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
button_1.enabled=true;
button_2.enabled=true;
myXML = new XML(e.target.data);
trace(myXML.Video[0]);
button_1.addEventListener(MouseEvent.CLICK, btn1Click);
button_2.addEventListener(MouseEvent.CLICK, btn2Click);
button_1.enabled=false;
button_2.enabled=false;
function btn1Click(e:MouseEvent):void
videoURL=myXML.Video[0];
ns.play(myXML.Video[0]);
function btn2Click(e:MouseEvent):void
videoURL=myXML.Video[1];
ns.play(myXML.Video[1]);
var nConnection:NetConnection = new NetConnection();
nConnection.connect(null);
var ns:NetStream = new NetStream(nConnection);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
var video:Video = new Video();
video.attachNetStream(ns);
addChild(video);
function netStatusHandler(event:NetStatusEvent):void {
// you have no useful code here
play_btn.addEventListener(MouseEvent.CLICK, playClicked);
pause_btn.addEventListener(MouseEvent.CLICK, pauseClicked);
play_btn.visible = false;
var videoPaused:Boolean = false;
function playClicked(e:MouseEvent):void{
if(!videoPaused)
ns.play(videoURL);
else
ns.resume();
play_btn.visible = false;
function pauseClicked(e:MouseEvent):void
ns.pause();
play_btn.visible = true;
videoPaused = true; -
Changing video links in Acrobat 9.0
I have several pdfs that contain links to video files on my server. However, I have now changed my hosting company, so the links no longer work.
Is there any way of editing the links in my pdfs to direct them to the Flash files on the new server? Or do I have to insert all the videos again from scratch?Not within Acrobat - once a Rich Media annotation has been created there is no access to change the source file, even if it's a remote URL.
You can do it by hand, though if the PDF is large it will take some care:
- Open Preflight from the Advanced menu and choose Single Fixups (the wrench symbol).
- Select "Remove document structure compression" from the Document panel, and click FIX. Give it a new name.
- Open the uncompressed PDF file in a professional text editor which can process large binary files (such as Notepad++). Do NOT use Word!!
- Search for all instances of your old URL, and replace them with the new one*
- Save the modified file and re-open it in Acrobat. Save it again to apply recompression.
* The patterns you'll be matching are FlashVars strings passed to the VideoPlayer widget, and will look something like this:
<</Binding 55 0 R/FlashVars(source=http://www.helpexamples.com/flash/video/cuepoints.flv&skin=....
The number "55" will be different in your case and there'll be one match for each remote-linked video in the PDF. -
Flash video players on separate webpages
I tried desperately to upload multiple videos with quicktime player, then I decided to return to the tried and true flv. format and purchased a flv. an xml video player component. Everything works fine and I uploaded it to my webpage index.3 It works great.
Then I decided to put other videos on the second page of my webpage index.4 BUT the videos from index.3 are playing on index.4. I tried to change the swf files to swf and swf1 so that they would not overlap each other BUT I think the problem is the content folder for the video player it has a data.xml folder for each video player. I put all of the images for both video players in the same image folder and I put all of the video for each of the video players in the same video folder because I didn't think I could have TWO image folders and TWO video folders uploaded to the same webpage with the same names.
Then with two video players (its actually the same video player I'm using on two different html pages) I have an:
ro file
a videoPlayer.as
swfobject file
gs file
Can I use these same files for both video players when I upload them to the internet? If not do I rename the files
ro1
videoplayer1.as
swfobject1
gs file
Both video players work when they are on the internet, the problem is that the flv video from index.3 is playing on index.4. All of the flv videos have different names.
I would appreciate any help I can get. Thank you.What is an ro file and a gs file? I'm guessing that you are using a third party flv player and not the player that comes with Flash. In any case an flv player, original issue or not, will play any .flv file that you throw at it, usually. The file to be played can be hard coded into the player or, the player may use an external text or .xml file to tell it what .flv file to use. This information may also be in a variable that the swfobject.js file reads. The videoPlayer.as file is an external actionscript file that will be used by the flash player file. The name of the .flv file may also be hidden in there.
So it's difficult to know which or how many of these files need to be unique to each of the html pages. -
Importing XML. Not working for me.
I've watched the InDesign/XML video now three or four times and I've tried to follow its steps diligently. But, I'm not having success. I created an InDesign template with all of the xml placeholder items in place. The structure at the left side of the screen looked proper. I opened the template, then, imported the xml. All of the imported elements lost any line endings and are crowded together at the top left of each business card. Can someone please help me with this?
Thanks,
PeterOK, the screenshot doesn't really demonstrate the problem, but it gives some context.
It would help to both see the problem and to have Hidden Characters turned on (Cmd-Opt-I or Ctrl-Alt-I).
Are you actually using InData right now for this problem? Because if you're using straight-up InDesign, I'm not sure how you're going to get more than 1 business card on each layout without either custom scripting or Data Merge that doesn't do XML.
Do you have line breaks in your layout right now? I can't tell. I assume the problem is the first line becomes
{FullName}{Title}
instead of
{Fullname}
{Title}
If so, you just need a paragraph boundary between them -- either hit Return or shift-Return, depending on exactly what's supposed to happen. -
Hi Guys,
Just like to know, if anyone has done any project with flash
video with subtitling.
I have around 20 videos of 5 mins each, I have to put the
subtitling on the videos, the text for the sub titling is available
in Excel sheets, I also have the time point for the subtitling.
Is that possible to load the text dynamically from the excel
sheet or any other format at the given time point in the flash
video.
Any tutorial available for the above topic? please provide me
the link.
Thanks in advance
regardsb_pandey,
> Just like to know, if anyone has done any project with
> flash video with subtitling.
I haven't, but I've done projects in which video had to be
synchronized
with other events.
> I have around 20 videos of 5 mins each, I have to put
> the subtitling on the videos, the text for the sub
titling is
> available in Excel sheets, I also have the time point
for
> the subtitling.
Excellent; you're all set!
> Is that possible to load the text dynamically from the
> excel sheet or any other format at the given time point
> in the flash video.
Not from an Excel sheet, no. But Flash can load text files
and Flash
can interact with databases via PHP, ASP, Cold Fusion, and
the like. Given
the time-sensitive nature of your project, however, I would
put the
subtitles right into the SWF itself.
> Any tutorial available for the above topic? please
> provide me the link.
You'll want to read about "cue points" in the documentation
and online.
Here are two tutorials I found by Googling the terms "Flash
video cue
points" ...
http://www.mediacollege.com/flash/video/cuepoints.html
http://www.actionscript4designers.com/wmg3/cuepoints_briefly.html
The second one involves screens, which you probably don't
need, but the
*concept* is, of course, the more important part. The first
tutorial is
more likely to help you.
I would put all the subtitles into an array and use the
cuePoint event,
as described in tutorial #1, to populate the same dynamic
text field over
and over again based on strings in the array.
What this means is that you'll want to familiarize yourself
with the
Array class. Start small, at first. Start a new FLA
altogether and create
nothing in it but an array.
var subtitles:Array = new Array();
Then push items into the array.
subtitles.push("Hello, Ginger.");
subtitles.push("Why, hello, Fred.");
subtitles.push("Care to dance, Ginger?");
subtitles.push("Oh, yes! Let's do!");
Then use trace() to test your understanding of how to pull
information
again from the array.
trace(subtitles[0]); // zero is the first element
trace(subtitles[1]);
trace(subtitles[2]);
// etc.
A for() loop can retrieve them all. Just substitute the
numbers for a
variable that represents numbers.
for (n=0; n<subtitles.length; n++) {
trace(subtitles[n]);
And so on. Looking up the "Array class" entry of the
ActionScript
Language Reference will teach you about the Array.length
property used in
the above sample. All class entries show the properties,
methods, and
events available to a given class. Properties are
characteristics of the
object, methods are things the object can do, and events are
things the
object can react to.
Once you understand arrays, look up the FLVPlayback in the
documentation
and/or follow along in the above tutorials. Just realize that
you'll use
the concepts described to meet your own needs. If you prefer
not to use the
FLVPlayback Component -- and you may not -- look up the Video
class, and
also the NetStream and NetConnection classes to learn how to
load FLVs
without a Component (the NetStream class features an
onCuePoint event). See
also ...
http://www.quip.net/blog/2006/flash/how-to-load-external-video
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design."
Maybe you are looking for
-
Photo transfer from windows folder to ipad not working?
I have transferred photos from a folder on my Windows7 desktop to my IPad yesterday however, I am unable to transfer any tonight. Anyone know why ?
-
How do I find available available storage on Macbook Pro OS X?
I have looked in About this Mac under the Apple symbol but the More Information does not give storage information as advised at the Apple Shop. Would welcome help. Thanks
-
How to obtain mesh geometry and topology data?
I am using JavaScript 3D engine for Adobe Acrobat. I am using the "Mesh" class. It seems that geometry and topology information is not available from "Mesh" class. Is it right? Can anybody to advise me a method for obtain geometry and topology inform
-
No new objects transferred in infocube
hi, while i was creating an InfoCube,i was not able to transfer info objects from template to structure.i got an error message"no new objects transferred".what might be the reason for getting such an error message? can any one help me out of this? th
-
2.4ghz Intel Core 2 Duo iMac freezing when trying to update and non responsive
I have a 2.4Ghz Core 2 Duo iMac. The updates download but when the mac tries to restart to complete the process the screen is just grey with a tool bar across the top System Updates, however the imac is completely unresponsive and will not even forc