stream af video
Hey.Jeg gir op!
Jeg vil gerne streame en video i flash. Den ligger i en swf som hedder "movietest.swf"
Jeg har så lavet dette script:
(ja, nu får i altså det hele)
// ******************************
// build interface
// ******************************
sw = 350;
sh = 250;
mx = 22;
my = 20;
this.buildInt = function(mwidth, mheight) {
// default
topLeft_mc._x = 0;
topLeft_mc._y = 0;
left_mc._x = 0;
buttomCorner_mc._x = 0;
top_mc._y = 0;
topRight_mc._y = 0;
left_mc._y = topLeft_mc._y+topLeft_mc._height;
top_mc._x = topLeft_mc._x+topLeft_mc._width;
buttom_mc._x = buttomCorner_mc._x+buttomCorner_mc._width;
// difs
var bottomDif = 18;
var rightDif = 13;
// corners left
buttomCorner_mc._y = my+mheight-bottomDif;
topRight_mc._x = mx+mwidth-rightDif;
logoCorner_mc._x = topRight_mc._x+topRight_mc._width-logoCorner_mc._width;
logoCorner_mc._y = buttomCorner_mc._y;
// scale sides
left_mc._height = buttomCorner_mc._y-topLeft_mc._height;
right_mc._height = logoCorner_mc._y-topRight_mc._height;
buttom_mc._width = logoCorner_mc._x-buttomCorner_mc._width;
top_mc._width = topRight_mc._x-topLeft_mc._width;
// place sides
right_mc._x = topRight_mc._x;
buttom_mc._y = buttomCorner_mc._y;
right_mc._y = topRight_mc._y+topRight_mc._height;
// place buttons
var buttonDif = 70;
play_mc._y = buttom_mc._y+buttom_mc._height-buttonDif;
fbw_mc._y = buttom_mc._y+buttom_mc._height-buttonDif+(play_mc._height-fbw_mc._height);
ffw_mc._y = buttom_mc._y+buttom_mc._height-buttonDif+(play_mc._height-fbw_mc._height);
skipb_mc._y = buttom_mc._y+buttom_mc._height-buttonDif+(play_mc._height-fbw_mc._height);
skipf_mc._y = buttom_mc._y+buttom_mc._height-buttonDif+(play_mc._height-fbw_mc._height);
// slider
slider_mc._y = skipf_mc._y-8;
};
buildInt(sw, sh);
play_mc.stop;
skipb_mc.stop();
skipf_mc.stop();
ffw_mc.stop();
fbw_mc.stop();
//
// ******************************
// stream
// ******************************
movieon = false;
loadMovieNum("movietest.swf", 5);
this.onEnterFrame = function() {
var bytesTotal = _level5.getBytesTotal();
var bytesLoaded = _level5.getBytesLoaded();
var sek = getTimer()/1000;
var bytesPerSek = bytesLoaded/sek;
var estimatedDownloadTimeLeft = (bytesTotal-bytesLoaded)/bytesPerSek;
var fullLength = _level5._totalframes/12;
txt_txt.text = "bytes Loaded:"+bytesLoaded+newline+"bytes total: "+bytesTotal+newline+"Sekunds elabsed: "+sek+newline+"bytes loaded per sek: "+bytesPerSek+newline+"bytes per frame: "+bytesTotal/_level5._totalframes+newline+"estimatedDownloadTimeLeft: "+estimatedDownloadTimeLeft+newline+"fullLength: "+fullLength;
slider_mc.stream_mc._xscale = 100/(bytesTotal/bytesLoaded);
_level5._x = mx;
_level5._y = my;
sw -= (sw-_level5._width)/1.5;
sh -= (sh-_level5._height)/1.5;
buildInt(sw, sh);
if (fullLength-2>estimatedDownloadTimeLeft && Math.abs(sw-_level5._width)<0.2 && Math.abs(sh-_level5._height)<0.2) {
if (movieon == false) {
_level5.play();
_level5._visible = true;
_level0.swapDepths(0);
movieon = true;
}
// her skal der senere ske noget mere
} else {
_level5.stop();
_level5._visible = false;
}
};
Det virker fint nok, så længe jeg tester det i flash, men så snart det kommer på nettet.
Hvad gør jeg galt? Eller er der nogen der har en anden måde at gøre det på?
: | Jakob
