PDA

View Full Version : LoadVars works locally, but not live?????


hifu
04-14-2003, 08:14 PM
First, sorry for the repost, but...

Can anyone tell me why this works from my machine, but not when I post it? I'm trying to pull in random quotes from a database and populate dynamic text field on stage (named "barf" in this case). I've tried it with the _root.loadVariables() too, but I get the same result. I know the php call is working since it pulls in fine on my local machine when viewing in flash player (and putting in url field of browser)


//frame 1
quoteVariable= new LoadVars();
quoteVariable.load("http://ipa.premierelink.com/daystests/newton/GetRandomQuote.php?program=18");


//frame5
//dynamic text box named "barf" placed on stage
barf=quoteVariable.quote;
trace(quote);

stop();
---------------------
Also, if you can help me with a side-problem–both of these end up tracing when placed right after the "quoteVariable.load..." in frame 1.

quoteVariable.onLoad = function(success){
trace("success");
};

quoteVariable.onLoad = function(fail){
trace("fail");
};

freddycodes
04-14-2003, 09:15 PM
Double-posting is highly discouraged here.
http://www.actionscript.org/forums/showthread.php3?s=&threadid=26240

Possible reasons you have no answer
1) You did not explain your problem well enough.
2) You have not supplied anything but bits of actionscript, and it may not be enough to figure out whats wrong
3) Try posting an fla and php script.

hifu
04-14-2003, 10:09 PM
Alright, my bad. Sorry I posted in general MX instead of scripting and backend that's why I thought nobody was answering. Won't happen again.

here's a description of the test file:
It has two keyframes, one on frame 1 and one on frame 7. On frame 7 there's a dynamic text box set to display html, have a border and be selectable and is named "barf". The php call returns this:

quote=As a training facilitator, James Newton has an uncanny way of seeing conflicting sides of an issue and very quickly, in a non-threatening way, cut to the core and resolve the issue, with all participants feeling respected in the end. He’s a very positive role model for a win-win.
-Barbara Berman, Director of Program Development, TEC

here's the a/s
...............................................
//frame 1
quoteVariable= new LoadVars();
quoteVariable.load("http://ipa.premierelink.com/daystests/newton/GetRandomQuote.php?program=18");

//frame 5
barf.htmlText=quoteVariable.quote;
stop();
.................................................
flash (newtontext.fla) file here:
http://198.107.23.21/

See file (not) work here:
http://10.10.10.6/newtontext.html

works locally, but not live. Can you help a poor repentant re-poster?

freddycodes
04-14-2003, 10:15 PM
Chances are in the remote version you are not giving flash enough time to return the result before you are trying to use it. Thats what the onLoad handler is for. Try taking out all the extra frames put the LoadVars and the barf text box on the first frame.


quoteVariable= new LoadVars();
quoteVariable.load("http://ipa.premierelink.com/daystests/newton/GetRandomQuote.php?program=18");
trace(quoteVariable.quote);
quoteVariable.onLoad = function(success){
if(success) {
trace(this.quote);
barf.htmlText=this.quote;
}
};
stop();

hifu
04-14-2003, 10:24 PM
That's what I thought too, which is why I put the frames between the call and the display. You solution works exactly like mine–works locally, not posted.

your idea posted here:
http://10.10.10.6/newtontext.html

Any other ideas?

freddycodes
04-14-2003, 10:30 PM
A 10 network is a local network, I cannot access it over the web. Also keep in mind that you cannot access remote php scripts when viewing over the web. So you need to reference the php script that is on the same server that the movie is playing from.