Question
exit out of video and return to stage frame 1
Ive manged to create a flash player that incorporates a video
using a online
tutorial with the code below.
All is working well but at the end of the video I want to exit out of the
video and return to the stage at frame 1. The reason being is; before a user
hits play an interface image (containing info) is displayed. When they hit
the play button the video appears and plays over the interface image.
problem is at the end of the video the layer containing the image is still
covered by the video. when the video finishes I need a line of code to exit
and return the player to the original state without the presecence of the
video layer.
any ideas? thanks in advance
Brett
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
rewindButton.onRelease = function() {
ns.seek(0);
ns.play();
}
playButton.onRelease = function() {
ns.play("modular.flv");
}
pauseButton.onRelease = function() {
ns.pause();
}
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 200;
loader.scrub._x = ns.time / duration * 200;
}
var scrubInterval;
loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit, 10);
this.startDrag(false,1,this._y,198,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function () {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/200)*duration));
}
tutorial with the code below.
All is working well but at the end of the video I want to exit out of the
video and return to the stage at frame 1. The reason being is; before a user
hits play an interface image (containing info) is displayed. When they hit
the play button the video appears and plays over the interface image.
problem is at the end of the video the layer containing the image is still
covered by the video. when the video finishes I need a line of code to exit
and return the player to the original state without the presecence of the
video layer.
any ideas? thanks in advance
Brett
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
rewindButton.onRelease = function() {
ns.seek(0);
ns.play();
}
playButton.onRelease = function() {
ns.play("modular.flv");
}
pauseButton.onRelease = function() {
ns.pause();
}
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 200;
loader.scrub._x = ns.time / duration * 200;
}
var scrubInterval;
loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit, 10);
this.startDrag(false,1,this._y,198,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function () {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/200)*duration));
}