Helpful Information
 
 
Category: Flash Help
LoadvariablesNum Issues

Flash MX / Windows 2000

I have load variables working sort of. First of all I have loadVariablesNum working with text files.

function openFile () {
loadVariablesNum ("test.txt", 0);
body_text.text = body;
}

That code works.

But if I switch to PHP files it no longer loads a value into the text box, plus it seems to spawn the PHP file in a new window like an _blank command in html.

function openFile () {
loadVariablesNum ("test.php", this, "POST");
body_text.text = body;

}

Figured it out.

so..... what was causing the problem?

I had my php script set up with HTML code included which I didn't need. I seemed to interfere with flash.

But I found a new problem that I don't think I can get around. Flash sends all variables through the URL string. The URL string has a maximum limit of around 2000 characters depending on method and browser used. If you want to open files and send them back and forth with flash and PHP it just doesn't work.

Flash is still a long way from being ready for web applications considering every web application I have worked on requires editing text or HTML files.

Just found this board. In case you still have a problem with all those variables being sent, try this:

First, send the variables to a hidden movie clip -- just the variables you want to send. Say, something like this:

myClip.name=_root.name;
myClip.score=_root.score;

Then, let the clip do your getVariables action.... and only the name and score will be sent.

Kewl, huh?

But doesn't the same problem apply in that you have to send the variables to a php script? The only way to do that is through loadVariableNum. If I am wrong maybe you could point me to a tutorial. Thanks.

E.

Hiya EggMan;

Well, I'm just getting started on this type of functionality myself. But I believe you could also use "getURL". Your php page would, of course, be the URL you get. Something like the following would go in the frame actions of the movie clip that catches your "short list" of variables:

getURL ("mypage.php", _blank, GET);


As I said, I'm just diving into this myself, so if anyone has better suggestions, please comment.

From what I've seen getURL acts the same as loadVariableNum.

If you want to pass variables it still has to be added on to the URL string. So it is the same problem different actionscript.

Thanks.

E.

Please see my earlier post.

Use a movie clip to capture only the required variables. Then getURL or loadVariables from the CLIP to "GET" the variables out to your PHP. Thus, only those required variables will attach to the URL.

Don't use loadVariablesNum. Or if you MUST, don't specify level 0, because then you WILL send all the variables that are at the root level.... see?

Level 0 = root, aka main timeline. Movie Clip on main timeline = level 1, Movie Clip within that clip = level 2....

Does that help?

P.S. If you must send large strings of variables, use the POST method instead of the GET method. POST, according to on-line help, "sends the variables in a separate HTTP header and is used for long strings of variables."

I understand what you are saying and it good practice if you have many variables in your movie.

You hit the problem at the end of your post. I want to send a SINGLE VARIABLE that could be 2,000 or could be 20,000 characters. If you try to send a single variable through a URL string that is over 2000 characters it generates an error.

Whether you use POST or GET you run into the problem that URL strings which Flash uses to send variables are limited to something like 2000 characters. That is the problem with the way Flash sends information back and forth from the server.

Thanks for your ideas. I probably should have been more clear about what I was wanting to do.

E.

From what I've seen getURL acts the same as loadVariableNum.

If you want to pass variables it still has to be added on to the URL string. So it is the same problem different actionscript.

Thanks.

E.
I have an asp page that does a database lookup and returns the result with:
response.write "msg=" & variablename

When I call this asp from flash, it open a new browser page with contents of the response.write instaed of sending the date to flash. Anybody know how to fix this?

Theeggman,
If Flash only lets you use variables of 2000 characters or less, then you could dynamically split up the larger-than-2K variables into smaller variables.

Also, myleslawrence, I would suggest using a new post for your issue, as this one is over 3 years old.

Thanks,
TM










privacy (GDPR)