-
FLV Scripts Don't Work When SWF Is Loaded Into Another SWF
I have a SWF that loads and plays an FLV. There is additional functionality like pause and mute and some animation that plays when the video is done. It works perfect, but when I load this SWF into a container SWF, most of it stops working and I don't know why. Maybe it's the NetStream code... Any suggestions would be appreciated.
Here is my entire script:
Code:
_root.videoPath = "xxxxxxxxxxxxxx.flv";
_root.playingVar = 1;
_root.panelVar = 0;
function handleFLVevents(infoObject) {
if (infoObject.code == "NetStream.Play.Stop") {
stopMovie();
}
} // If the FLV is over
function stopMovie() {
_root.playingVar = 0;
_root.panelVar = 1;
_root.clipPanel.gotoAndPlay("expand");
_root.pause_btn.gotoAndStop("off");
finale.gotoAndStop("off");
snd.setVolume(100);
_root.btn.gotoAndStop("on");
} // Do this when the FLV is over
var my_nc = new NetConnection();
my_nc.connect(null);
var my_ns = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.setBufferTime(5);
my_ns.play(_root.videoPath);
pause_btn.onRelease = function () {
if (_root.panelVar == 1) {
_root.panelVar = 0;
_root.clipPanel.gotoAndPlay("contract");
}
if (_root.playingVar == 1) {
my_ns.pause();
pause_btn.play();
} else {
_root.playingVar = 1;
_root.pause_btn.gotoAndStop("on");
my_ns.play(_root.videoPath);
finale.gotoAndStop("on");
}
}; // Pause/Play button actions
var snd = new Sound(this);
snd.attachSound(myVideo);
snd.setVolume(100);
btn.onPress = function () {
var _loc1 = snd.getVolume();
snd.setVolume(Math.abs(_loc1 - 100));
btn.play();
}; // Mute button actions
my_ns.onStatus = function (objStatus) {
var _loc1 = handleFLVevents(objStatus);
};
function playVideo() {
my_ns.play(_root.videoPath);
finale.gotoAndStop("on");
} // Play function for replay buttons
stop();
Thanks, SD909
-
AKA [ Paul Bainbridge]
Your reference to _root is lost as soon as you lod that swf into a new swf. _root now becomes the swf that just loaded your video player.
-
Originally Posted by webdreamer
Your reference to _root is lost as soon as you lod that swf into a new swf. _root now becomes the swf that just loaded your video player.
Hmmm. I thought that as long as you were loading a SWF into a SWF that _root. always remained inclusive to the SWF where the script was and that if you wanted to reference the main timeline of the "loader" SWF that you had to use _level0.
SD909
-
AKA [ Paul Bainbridge]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|