FLV loading issue

Hi,

I have a slight issue with my movie at the moment. I have to use AS3 for a Flash assignment at Uni to create an IPTV site. I’m pretty new to all this Flash stuff, I’ve dabbled but never really used AS3 only AS2 very simply .

I have set up a pre-loader in the first scene of my movie for loading everything, the intro movie then comes in scene 2, and the main site is in scene 3 onwards.

The issue I have is that everything pre-loads fine except the FLA files. This causes issues as there is an FLA file that plays at a certain point in the intro with no controls. I want to make this FLA pre-load along with all the graphics so that there is no stuttering of the video but it can’t load as it’s about to play, as this will split up the flow. The file so far is here http://devarios.com/UniFlash/stargate_video_skip.html

I can’t for the life of me figure out how to do this. Can someone help me please?

Here is the AS I’m using so far.

Frame 1 Scene 1 Preloader


stop();    
import flash.display.MovieClip;    
import flash.events.Event;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;
import fl.controls.Label;

//Add progress bar vaiable then display the bar

var myProgressBar:ProgressBar = new ProgressBar();
myProgressBar.indeterminate = false;
myProgressBar.mode = ProgressBarMode.MANUAL;
myProgressBar.maximum = 256;
myProgressBar.setSize(180, 16);
myProgressBar.move(205, 240)
addChild(myProgressBar);

//Add the percent label variable then display the label

var myLabel:Label = new Label();
myLabel.text = "";
myLabel.autoSize = TextFieldAutoSize.LEFT;
myLabel.move(260, 205 + myProgressBar.height);
addChild(myLabel);

this.addEventListener("enterFrame",onEnterFrame);    
    
function onEnterFrame(e:Event):void {    
     var nProg:int = (Math.ceil((this.loaderInfo.bytesLoaded/this.loaderInfo.bytesTotal)*100));    
     UpdatePreloader(nProg);  
     if(this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
         this.removeEventListener(Event.ENTER_FRAME,onEnterFrame);
         removeChild(myLabel);
         removeChild(myProgressBar);
         gotoAndPlay("startmovie");     
     }    
}
  
function UpdatePreloader(nProg:int):void {  
     //trace(nProg + '% Loaded');    
     myLabel.text = ( nProg.toString() + '% Loaded'); 
     myProgressBar.setProgress(nProg, 100);
}

Frame 1 Scene 2 Intro


//Skip button listeners and events to allow skiping anytime in the intro

skip_btn.addEventListener(MouseEvent.CLICK, onClick);
skip_btn.addEventListener(MouseEvent.ROLL_OVER, onOver);
skip_btn.addEventListener(MouseEvent.ROLL_OUT, onOut);

function onClick(event:MouseEvent):void {
    gotoAndPlay(1, "Home");
}

function onOver(event:MouseEvent):void {
    event.target.alpha = .5;
}

function onOut(event:MouseEvent):void {
    event.target.alpha = 1;
}

//Load the encoded soundfile

var encodeSound:URLRequest = new URLRequest("encodedSound.mp3");
var encodedSound:Sound = new Sound();
encodedSound.load(encodeSound);

Frame 230 Scene 2 Intro


//Stop the timeline to allow the video to play

stop();

//Connect to the video stream and set the video sizes and location on the stage, buffer the video until it is needed

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);
//ns NetStream.setBufferTime:5;
ns.client = this;
ns.play("stargate1.flv");

var vid:Video = new Video();
vid.attachNetStream(ns);
vid.x = 0.1;
vid.y = 57.5;
vid.height = 484.1;
vid.width = 798.7;

addChild(vid);

//Set the onCuePoint function to go to Frame 1 of the Home scene when a cuePoint is found in the video, with the onMetaData to avoid compilation errors

function onMetaData(infoObject:Object):void
{
    trace("metadata");
}
function onCuePoint(infoObject:Object):void
{
    trace("cue data");
    gotoAndPlay(1, "Home");
}

//Remove the old skip button listeners as they do not apply to streaming content

skip_btn.removeEventListener(MouseEvent.CLICK, onClick);
skip_btn.removeEventListener(MouseEvent.CLICK, onOver);
skip_btn.removeEventListener(MouseEvent.CLICK, onOut);

//Skip button listeners and events to allow skiping anytime in the streaming video

skip_btn.addEventListener(MouseEvent.CLICK, onClickV);
skip_btn.addEventListener(MouseEvent.ROLL_OVER, onOverV);
skip_btn.addEventListener(MouseEvent.ROLL_OUT, onOutV);

function onClickV(event:MouseEvent):void {
    gotoAndPlay(1, "Home");
    ns.close();
    removeChild(vid);
}

function onOverV(event:MouseEvent):void {
    event.target.alpha = .5;
}

function onOutV(event:MouseEvent):void {
    event.target.alpha = 1;
}

Frame 1 Scene 3 Home


//Define the upgrade flash link location

var upgradeFlash:URLRequest = new URLRequest("http://www.macromedia.com/go/getflashplayer");

//Add the listeners to the navigation buttons

home_btn.addEventListener(MouseEvent.CLICK, homeClick);
profiles_btn.addEventListener(MouseEvent.CLICK, profileClick);
media_btn.addEventListener(MouseEvent.CLICK, mediaClick);
upgrade_btn.addEventListener(MouseEvent.CLICK, upgradeClick);

function homeClick(event:MouseEvent):void {
    trace("Home");
}

function profileClick(event:MouseEvent):void {
    trace("Character Profiles");
}

function mediaClick(event:MouseEvent):void {
    trace("Media");
}

function upgradeClick(event:MouseEvent):void {
    navigateToURL(upgradeFlash);
    trace("Upgrade");
}

//Halt the timeline here

stop();

Thanks for the help in advance
Adam