Jump to content
Search Community

Loading videos dynamically works only when compiled using relative directory

MGT_Jose test
Moderator Tag

Recommended Posts

Hello fellow Greensockers,

 

I have ran in to this issue where I am trying to load a video dynamically based on an xml file. The file should load dynamically without having to compile the Air application.

 

It works just fine for Swf loading with the same method other than it loading a video. It works for both compile time and when opening the Air or swf file like this:

public function createSwf(swf:String, clipName:String, xPos:Number = 0, yPos:Number = 0):void
{
    _swfLoader = new SWFLoader("./swf/" + swf, { onComplete: onSWFLoaded, name: clipName, x: xPos, y:xPos, container:StarlingEntry.getInstance().loadedSWFContainer } );
    _swfLoader.load();
			
     if (CONFIG::DEBUG)
     {
	trace(this, "Loading swf...");
     }
}

However it does not work doing the same thing but with loading videos via the VideoLoader utility:

public function createVideo(fileName:String, videoName:String = "videoName", scaleX:Number = 1, scaleY:Number = 1, xPos:Number = 0, yPos:Number = 0):void
{
    	_videoLoader = new VideoLoader("./video/" + fileName, { name: videoName, container: StarlingEntry.getInstance().loadedVideoContainer, scaleX: scaleX, scaleY: scaleY, x:0, y:0, onComplete: onVideoLoaded, repeat: -1 } );
     	//_videoLoader = new VideoLoader("video.flv", { name: videoName, container: StarlingEntry.getInstance().loadedVideoContainer, scaleX: scaleX, scaleY: scaleY, x:0, y:0, onComplete: onVideoLoaded, repeat: -1 } );
    	_videoLoader.load();
			
	 if (CONFIG::DEBUG)
	 {
            trace(this, "Loading video...");
    	 }
}

For organizational purposes I need to use relative directory's. It works just fine when I stick the video right next to the swf. Has anybody seen anything like this before? Another thing I noticed is when remote debugging

I get the error where the file is not loading "Error on VideoLoader 'video' (./video/video.flv): NetStream.Play.StreamNotFound". I am 100% sure the file is there and also like I mentioned it workes when I compile with no errors.  Thanks in advanced for any replies.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...