PDA

View Full Version : Using a variable as FLV contentPath


yoogie8
01-09-2007, 09:07 PM
I have looked at lots of discussions about assiging a variable as the contentPath for a media component, none seem to fully resolve this issue.

If I hard code the contentPath the video loads fine:

videoName = "http://myserver.com/video/file_example.flv";
videoBox.load(videoName);

However as a variable (from XML) it does not work:

videoBox.load(_root.video_2);

I have tried using setMedia() but with no joy.

Help!!!

yoogie8
01-10-2007, 09:56 AM
I have looked at lots of discussions about using variable's for a FLV contentPath, to play it in a media component. I am still stuck.

If I hard code the contentPath the video loads fine:

videoName = "http://myserver.com/video/file_example.flv";
video.load(videoName);

However as a variable (from XML) it does not work:

videoBox.load(_root.video_2);

I have traced _root.video_2 and is it definately the correct path and filename and it is a string.

I have also tried using setMedia() but with no joy.

Help!!!

inhan
01-10-2007, 10:53 AM
It's probably recognized as mere string, that's what I think. What I mean is relevant to the array example below

myArray = ["myMC", "yourMC"];
btn.onRelease = function() {
myArray[0].play();
};

If myMC and yourMC are movie clips, then they had to be defined like:

myArray = [myMC, yourMC];

This I think may be happening to you.

yoogie8
01-10-2007, 11:39 AM
Ok, this works:

videoURL = "http://mywebsite/video/";
videoName = "video_1";
videoExt = ".flv";
videoBox.load(videoURL + videoName + videoExt);

In this example videoName is a string (trace typeof)

But this does not work:

videoURL = "http://mywebsite/video/";
videoName = video_1;
videoExt = ".flv";
videoBox.load(videoURL + videoName + videoExt);

In this example videoName is undefined (trace typeof)

inhan
01-10-2007, 11:49 AM
Yeah I know, in this case it wouldn't. Anyway in which method are you taking the information/variable name from the xml file and loading that? Can you post the code?

yoogie8
01-10-2007, 12:07 PM
It's actually from php. The video variable is assigned as follows:

_root["video_" + i] = this.video;

So as an example:
videoBox.load(_root.video_2);

does not work even though on trace _root.video_2 = http://mywebsite/video/video_1.flv

inhan
01-11-2007, 12:22 AM
I think I can solve that out, but yet without all the crucial code, I can't do anything.

eskee
03-28-2007, 12:54 AM
Can I test the SWF that sits at my desktop computer to connect the FLV that sits on External server.

by using the AS you suggested:

videoBox.load(videoURL + videoName + videoExt);

inhan
03-28-2007, 10:42 AM
It's been a while and I've forgot the issue. But I'm not sure if that is possible.