How to read different values from different domain/website/database?

Can any expert help me with this…?

I have a flash file that reads variable from a text files(eg. myhobby.txt). That is easy.

&myHobbies=swimming

Now here is the complicated/difficult part

Using the same and only flash file how do I read from different sever/database?

e.g.

there is 3 website sharing the same and only flash files.
-if website ‘A’ load the flash files it will load ‘A’ hobbies
-if website ‘B’ load the flash files it will load ‘B’ hobbies
-if website ‘C’ load the flash files it will load ‘C’ hobbies

that means there is 3 myhobby.txt files altogether in 3 different sever/database.

This is very new to me. Please help.

Thanks!

just change the myHobbies to myHobbiesA, myHobbiesB and myHobbiesC… Would that help?

EDIT: Sorry, now I got what you mean. You can try this:

myLoadVars = new LoadVars();
myLoadVars.load("http://www.myserver.com/myHobbies.txt");

Just change the myserver.com to three website addresses you use. Would that help?

try using a variable in the embed:

<embed src=“myMovie.swf?server=1”…for your 1st server
<embed src=“myMovie.swf?server=2”…for your 2nd server
<embed src=“myMovie.swf?server=3”…for your 3rd server

and in your movie use an if statement to declare which txt file to load:

if (server == 1) {
this.loadVariables(“myhobby1.txt”);
} else if (server == 2) {
this.loadVariables(“myhobby2.txt”);
} else if (server == 3) {
this.loadVariables(“myhobby3.txt”);
}

I’m not an expert, but I used something similar in a project of mine and it proved to be very useful.

I hope it helps your issue too.

Good luck.

:slight_smile:

Thanks for the reply.

I know what you mean but there is 3 domain that call up the flash, and the indiviuals txt files are stored in each of these domain, so the questions is:

How how the flash know which domain call it up, so that it will load the collect text file.

Example,
Domain A loads the flash file, then the flash file will know its domain A, so it will .[COLOR=red]load the txt file from domain A[/COLOR] that is meant for Domain A.

forgot to said thanks…

Thanks.

Thanks for the reply… I will try that out.

Thanks

I merged both threads as they were identical.
Please dont crosspost minuet.

Anyone who read this question can also help me with this.

Hi Amaze and all,

I have tried you method, I know what you meant…
But it is not working.

Below are the codes I copied from my HTML, can you point out what’s wrong?

<object classid=“clsid:D27CDB6E-AE6D-11cf-96B8-444553540000” codebase=“http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0” width=“150” height=“453”>
<param name=“movie” value=“myHobby.swf”>
<param name=“quality” value=“high”>
<embed src=“myHobby.swf?domain=1” quality=“high” pluginspage=“http://www.macromedia.com/go/getflashplayer” type=“application/x-shockwave-flash” width=“150” height=“453”></embed></object>

From my Flash part,
if (domain == 1)
{
this.loadVariables(“myHobby_A.txt”, _root);
}
else if (domain = “BBB”)
{
this.loadVariables(“myHobby_B.txt”, _root);
}
else if (domain = “CCC”)
{
this.loadVariables(“myHobby_C.txt”, _root);
}

That’s all for the codes part.

Here are some questions.

-Where the flash loads the txt file, does it takes the (HTML page) or (the flash itself) as references to find the txt file.

-There is ‘param’ and ‘embed’ tag which one should I insert the &domain=1.

-when inserting the domain, should I use “&”(and) or “?”(question mark).
e.g
myHobby.swf?domain=1
or
myHobby.swf&domain=1

Sorrie about my long winded question but I am really stuck with this.

Thanks

Forgot to mention, the HTML codes are generated by dreamweaver MX.

In this part of your html code:

<param name=“movie” value=“myHobby.swf”>

add the parameter…

<param name=“movie” value=“myHobby.swf?domain=1”>

Also use the variable domain as root:
_root.domain

you use the question mark to start giving the variables and the “&” symbol to separate them.

As I told you above, you must insert “?domain=1” to both places.

Flash loads the txt file from where the page is and not from where the swf is.
As long as you load the swf in your page it’s part of it.
So if your txt is in another folder from the page, you have to target it.

Good luck m8.

Cool! It works. Thanks a lot lot lot.

Some bits and pieces.

<param name=“movie” value=“myHobby.swf?domain=1”>
<embed src=“myHobby.swf?domain=1” …

I use domain=1 to compare which is number(integer).It works!

but then

<param name=“movie” value=“myHobby.swf?domain=alvin”>
<embed src=“myHobby.swf?domain=alvin” …

in flash codes,

if( domain == “alvin”){

}

when I used string to compare it won’t work.

Any Idea where it is wrong.

Thanks.

Forget about the question above, I have sort it out.
It was my careless.

Thanks alot!

Anytime.

Glad I could help.

Some more questions about passing values.
Can I pass in value in HTML like the example below?

<param name=“Hobby” value=“swimming”>
<embed src=“myHobby.swf”>

instead of

<embed src=“myHobby.swf?Hobby=swimming”>

If can, can point out my mistake, because I tried and It wont work.

Thanks.

You can’t pass variables this way, as far as I know.

If you want to use strings in your variables use this in the fla:

if( Hobby eq “swimming”){

}

You can pass multiple variables by using the “&” symbol.

<embed src=“myHobby.swf?Hobby=swimming&petName=Boogie&favoriteColor=blue”>

Thanks!. That’s all I need to verify.