PDA

View Full Version : swf works in flash, not in browser?


rysotope
08-03-2007, 11:11 PM
I have a swf that has a video playlist. All the videos are visible at once and it will go through playing one at a time. works fine when I test it in flash but in the browser the videos start playing erratically and at the same time. what could be causing this? Tested with ie 6,7 and firefox 2. all with flash 9.

it is written in as3...which is the first actionscript I have learned so there isn't any old actionscript in there.

heres the code i'm using...its supposed to place all the videos, stop them, and then when the first one is done the next one plays. what would make them all start playing when you try it online, but not locally?

import fl.video.*;

// Video component instance name
var jon = a.jon_flv;
var flvSource2 = "jon.flv";

var ryan40 = b.ryan40_flv;
var flvSource3 = "ryan40watts.flv";

var scott = c.scott_flv;
var scott1 = c.scott_flv1;
var flvSource1 = "scott1.flv";

var flvSource = "ryan.flv";
var ryan = d.ryan_flv;

var flvSource4 = "hoodie1.flv";
var jonhoodie = e.jonhoodie_flv;


////set video sizes
jon.width = 162;
jon.height = 208;

ryan.width = 230;
ryan.height = 175;

scott.width = 162;
scott.height = 228;

scott1.width = 162;
scott1.height = 228;

ryan40.width = 240;
ryan40.height = 180;

jonhoodie.width = 170;
jonhoodie.height = 195;

// video complete / order
function completeJon(event:VideoEvent):void
{
ryan40.play();
}
jon.addEventListener(VideoEvent.COMPLETE, completeJon);

//////////

function completeRyan40(event:VideoEvent):void
{
scott.play();
scott1.play();
}
ryan40.addEventListener(VideoEvent.COMPLETE, completeRyan40);

/////////

function completeScott(event:VideoEvent):void
{
ryan.play();
}
scott.addEventListener(VideoEvent.COMPLETE, completeScott);

//////////

function completeRyan(event:VideoEvent):void
{
ryan.seek(0);
jonhoodie.play();
}
ryan.addEventListener(VideoEvent.COMPLETE, completeRyan);

//////////

function completeJonhoodie(event:VideoEvent):void
{
jon.play();
}
jonhoodie.addEventListener(VideoEvent.COMPLETE, completeJonhoodie);


// Set video
ryan.source = flvSource;
scott.source = flvSource1;
scott1.source = flvSource1;
jon.source = flvSource2;
ryan40.source = flvSource3;
jonhoodie.source = flvSource4;

scott.stop();
scott1.stop();
jonhoodie.stop();
ryan.stop();
ryan40.stop();


//// play buttons
brainrotover_mc.play1_mc.addEventListener(MouseEve nt.CLICK, playMovie_ryan);
brainrotover_mc.play1_mc.buttonMode = true;

function playMovie_ryan(event:MouseEvent):void
{
ryan.seek(0);
ryan.play();
scott.stop();
scott1.stop();
jon.stop();
setChildIndex(scan, numChildren - 1);
}


soreuoover_mc.play_mc.addEventListener(MouseEvent. CLICK, playMovie_scott);
soreuoover_mc.play_mc.buttonMode = true;

function playMovie_scott(event:MouseEvent):void
{
ryan.stop();
jon.stop();
scott.seek(0);
scott.play();
scott1.seek(0);
scott1.play();
}


broadcastover_mc.play_mc.addEventListener(MouseEve nt.CLICK, playMovie_jon);
broadcastover_mc.play_mc.buttonMode = true;

function playMovie_jon(event:MouseEvent):void
{
ryan.stop();
scott.stop();
scott1.stop();
jon.seek(0);
jon.play();
}

hokeyplyr48
08-04-2007, 11:36 AM
have you uploaded the videos to the same server/location as the swf file?

rysotope
08-04-2007, 05:48 PM
have you uploaded the videos to the same server/location as the swf file?

yep...i think i figured it out though, i have instances of the flvplayback component, and their autoplay was auto set to true. i got so caught up in the actionscript side i forgot about the component settings. even though my actionscript told them to stop i guess the flv would load after the code and play anyways. but locally it would work because the flvs would load instantly.