# Some help with Stop FLV from preloading

**URL:** <https://forum.kirupa.com/t/some-help-with-stop-flv-from-preloading/313385>\
**Category:** Uncategorized\
**Created:** [August 27, 2010, 6:33pm UTC](https://forum.kirupa.com/t/some-help-with-stop-flv-from-preloading/313385 "2010-08-27T18:33:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![efieilat](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@efieilat](https://forum.kirupa.com/u/efieilat)\
**Post date:** [August 27, 2010, 6:33pm UTC](https://forum.kirupa.com/t/some-help-with-stop-flv-from-preloading/313385/1 "2010-08-27T18:33:37Z")

</div>

I have a digital magazine (pageflip) on my site and i want to play video in each page.  
my problem is when user want to see the magazine he need to wait untill all the movies preloading…

Im trying to stop FLV from preloading untill the user click on play button or go to other page on our magazine (pageflip).  
can someone know how to do it?

this is the code im using for the FLV video  
stop();  
var n = 0;

trailer = new XML();  
trailer.ignoreWhite = true;  
trailer.onLoad = function(success) {  
if (success) {

video = trailer.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
videoWidth = trailer.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;  
videoHeight = trailer.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;  
buffTime = trailer.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;

theVideo.attachVideo(ns);  
ns.play(video);  
ns.pause(true);

theVideo.\_width = videoWidth;  
theVideo.\_height = videoHeight;

theborder.\_width = theVideo.\_width+20;  
theborder.\_height = theVideo.\_height+65;  
theborder.\_x = theVideo.\_x-10;  
theborder.\_y = theVideo.\_y-10;

the\_controls.bigButton.\_width = theVideo.\_width;  
the\_controls.bigButton.\_height = theVideo.\_height;  
the\_controls.bigButton.\_y = -theVideo.\_height+45;  
the\_controls.\_x = theVideo.\_x;  
the\_controls.\_y = theVideo.\_y+theVideo.\_height;  
the\_controls.controls\_bg.\_width = videoWidth-1;  
the\_controls.progress\_bar.progressBar.\_width = videoWidth-90;  
the\_controls.progress\_bar.the\_load\_bar.\_width = videoWidth-90;  
the\_controls.sound\_btn.\_x = the\_controls.controls\_bg.\_width-40;

buffText.\_x = theVideo.\_x+(theVideo.\_width-85);  
buffText.\_y = theVideo.\_y+17;  
buffText.\_alpha = 100;  
}  
};

trailer.load(“xml/myxml.xml”);  
var nc:NetConnection = new NetConnection();  
nc.connect(null);  
var ns:NetStream = new NetStream(nc);  
ns.setBufferTime(buffTime[0]);  
ns.onStatus = function(info) {  
if (info.code == “NetStream.Buffer.Full”) {  
buffText.\_alpha = 0;  
}  
if (info.code == “NetStream.Buffer.Empty”) {  
buffText.\_alpha = 100;  
}  
if (info.code == “NetStream.Play.Stop”) {  
ns.seek(0);  
buffText.\_visible = false;  
ns.pause(true);  
if (n == 1) {  
the\_controls.pause\_Btn.gotoAndStop(1);  
n = 0;  
} else {  
the\_controls.pause\_Btn.gotoAndStop(2);  
n = 1;  
}

}  
};

//video loading bar  
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;  
the\_controls.progress\_bar.the\_load\_bar.\_width = amountLoaded_the\_controls.progress\_bar.progressBar .\_width;  
the\_controls.progress\_bar.seeker.\_x = Math.floor(ns.time/duration_(the\_controls.progress\_bar.progressBar.\_w idth-24));  
}

//seeker  
var scrubInterval;

the\_controls.progress\_bar.seeker.onPress = function() {  
clearInterval(videoInterval);  
scrubInterval = setInterval(scrubit, 10);  
this.startDrag(false,0,this._y,the\_controls.progre ss\_bar.progressBar._ width-24,this.\_y);  
};

the\_controls.progress\_bar.seeker.onRelease = the\_controls.progress\_bar.seeker.onReleaseOutside= function () {  
clearInterval(scrubInterval);  
videoInterval = setInterval(videoStatus, 100);  
this.stopDrag();  
};

the\_controls.progress\_bar.seeker.onRollOver = the\_controls.progress\_bar.seeker.onDragOver=functi on () {  
\_root.canflip=false;  
the\_controls.progress\_bar.seeker.gotoAndStop(2);  
};

the\_controls.progress\_bar.seeker.onRollOut = the\_controls.progress\_bar.seeker.onDragOut=functio n () {  
\_root.canflip=true;  
the\_controls.progress\_bar.seeker.gotoAndStop(1);  
};

function scrubit() {  
ns.seek(Math.floor((the\_controls.progress\_bar.seek er.\_x/(the\_controls. progress\_bar.progressBar.\_width-24))\*duration));  
}

//pause/play button  
the\_controls.pause\_Btn.onRelease = the\_controls.pause\_Btn.onReleaseOutside=function () {  
ns.pause();  
buffText.\_visible = true;  
if (n == 1) {  
the\_controls.pause\_Btn.gotoAndStop(1);  
ns.play(video);  
n = 0;  
} else {  
the\_controls.pause\_Btn.gotoAndStop(2);  
n = 1;  
}  
};

the\_controls.pause\_Btn.onRollOver = the\_controls.pause\_Btn.onDragOver=function () {  
\_root.canflip=false;  
};

the\_controls.pause\_Btn.onRollOut = the\_controls.pause\_Btn.onDragOut=function () {  
\_root.canflip=true;  
if (n == 1) {  
the\_controls.pause\_Btn.gotoAndStop(2);  
} else {  
the\_controls.pause\_Btn.gotoAndStop(1);  
}  
};

//sound control  
this.createEmptyMovieClip(“vSound”,this.getNextHig hestDepth());  
vSound.attachAudio(ns);  
var so:Sound = new Sound(vSound);

var m = 0;

the\_controls.sound\_btn.onRollOver = the\_controls.sound\_btn.onDragOver=function () {  
\_root.canflip=false;  
};

the\_controls.sound\_btn.onRollOut = the\_controls.sound\_btn.onDragOut=function () {  
\_root.canflip=true;  
};

the\_controls.sound\_btn.onRelease = the\_controls.sound\_btn.onReleaseOutside=function () {  
if (m == 0) {  
so.setVolume(0);  
the\_controls.sound\_btn.gotoAndStop(2);  
m = 1;  
} else {  
so.setVolume(100);  
the\_controls.sound\_btn.gotoAndStop(1);  
m = 0;  
}  
};
