Skip to main content
August 15, 2007
Question

Controlling play/Pause for external swfs

  • August 15, 2007
  • 1 reply
  • 156 views
I am playing external swfs in an emtpy movie clip. When I choose the movie to play from the dropdown, it plays automatically. But, I cannot get it to play/pause at all. My Code is:

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);

var videoXML:XML = new XML(_level0.MyXML);
videoXML.ignoreWhite = true;
videoXML.onLoad = loadCombo;

var listener:Object = new Object();
listener.change = function(evtObj:Object):Void {
playMovie();
}

video_cbo.addEventListener("change", listener);

play_btn.onRelease = function():Void {
//stream_ns.play();
videoName.play(); - I tried dynamic_mc.play() as well - it doesn't work
}
pause_btn.onRelease = function():Void {
//stream_ns.pause();
videoName.pause();
}

function playMovie():Void {
var videoName:String = video_cbo.selectedItem.data;
dynamic_mc.loadMovie(videoName,1);
//stream_ns.play(videoName); - this makes neither the movie nor the preloader work
//stream_ns.play(videoName,1); - this one makes the preLoader just keep going - no movie appears
// attach the preloader animation
// this will be removed when preloading is complete
attachMovie("preloader anim", "preloader_mc", 500, {_x:275, _y:165});

// set the onEnterFrame event to call preloadContainer
onEnterFrame = preloadContainer;
}

function loadCombo(success:Boolean):Void {
if (success) {
playMovie();
}
}
var cboLabel:String, cboFile:String;
var childItems:Array = videoXML.firstChild.childNodes;
for (var i:Number = 0; i < childItems.length; i++) {
cboFile = childItems .firstChild.firstChild.nodeValue + "\n";
cboLabel = childItems
.lastChild.lastChild.nodeValue + "\n";
//video_cbo.addItem("Choose Video");
video_cbo.addItem({label: cboFile, data: cboLabel});
}
This topic has been closed for replies.

1 reply

August 20, 2007
Hoping that someone can still answer this:)