PDA

View Full Version : Full screen FLV looping


detonate
03-28-2008, 06:27 PM
Been trying to loop a .flv without any success so far.
Could anyone help me out in the best direction possible?

Here's my listener attempt:

var lstn = new Object();
lstn.complete = function(evtObj) {
myNetStream.play();
}
myNetStream.addEventListener('complete', lstn);




------------------------- Main code below


// Prepare stage
Stage.align ="TL";


// VIDEO FULLSCREEN
// ************************************************** ************************************************** **

// Prepare connection
var myNetConnection:NetConnection = new NetConnection();
myNetConnection.connect(null);


// Stream video
// "video" is the video symbol in the library
var myNetStream:NetStream = new NetStream(myNetConnection);
video.attachVideo(myNetStream);

// Smooth
video.smoothing = true;

// Start playing
myNetStream.play("anim_lignes09a.flv");
myNetStream.seek(0.3);


// VIDEO SIZE
function setVideoSize():Void
{
// Stage Dimensions
var wStage:Number = Stage.width;
var hStage:Number = Stage.height;

// Adapt based on width
video._width = Stage.width;
video._yscale = video._xscale;

// Adapth based on height
if( video._height < hStage )
{
//scale
video._height = Stage.height;
video._xscale = video._Yscale;

// centered
video._x = ((video._width - Stage.width) / 2) * (-1);
}
}




// RESIZE STAGE
// ************************************************** ************************************************** **

// Create listener
var resizeStage:Object = new Object();

// Detect resize
resizeStage.onResize = function()
{
// Video
setVideoSize();
}

// Activates listener
Stage.addListener(resizeStage);
stop();

xxneon
03-28-2008, 06:34 PM
I think your confusing what NetStream uses and what the FLVPlayBack component uses to detect when a video is finished..

myNetStream.onStatus(infoObj:Object){
if(infoObj.status == "NetStream.Play.Stop"){
this.seek(0);
this.pause(false);
}
}
that should loop the flv when its finished playing .. as long as you dont have any controls that stop the video manually.. hehe

detonate
03-29-2008, 01:04 AM
xxneon thanks for taking a look and helping out.
I tried adapting your suggestion but couldn't make it work...
Tweaking syntax, changing vars etc.

xxneon
03-29-2008, 05:17 AM
sometimes i have to use this instead of stop when it doesnt work..

if(infoObj.status == "NetStream.Buffer.Flush"){
this is broadcast when the video is done streaming .. the buffer is flushed .. which i noticed only fires when it reaches the end of the video..

detonate
03-29-2008, 12:40 PM
xxneon, also tried using that solution... it outputs an error.
Morphed your suggestion into a function in case of syntax.

Here's the file you can take a look at what's happening.

xxneon
03-31-2008, 12:38 PM
infoObj.status should be infoObj.code.. sorry .. the Flash documentation is misleading .. it doesnt make any reference that the status messages are sent via a code property .. it makes reference to a status property.. very confusing ..

hah.. helps to read it better .. on second glance there is a code.. and level property .. and then the values of those two properties are listed below .. oops.. my bad.

detonate
03-31-2008, 03:41 PM
Would've never found it alone xxneon! All works ok now...
Appreciated your time and help =)