PDA

View Full Version : [FMX] loadvars and aim



innui
April 16th, 2003, 02:24 PM
Well, I've come across a problem and i'm stumped. Anyway, I stumbled upon this aim online presence check in an old AIM pdf file. There is a server check at an aol server to see if a person is online, if they are it sends the browser to the "on_url" setting, if not, it sends the browser to the "off_url" setting. I realized that it doesn't work for some screen names for some reason, but it does for mine, so i wanted to use it in flash. I've tried three ways, and two of them WORK! But, only when I run them from my computer... When I upload it to my host, it doesn't work! Here's the two ways I've tried:

aimcheck = new LoadVars();
aimcheck.load("http://big.oscar.aol.com/St5f1n?on_url=http://www.stefangomez.com/aimchecky.html&off_url=http://www.stefangomez.com/aimcheckn.html");
aimcheck.onLoad = function (){
testo.text = aimcheck.aim;
}

all this does is set the text of "testo" to what the value for aim is depending on what the bigoscar sends the html page to. This next one does the same but with sendAndLoad instead.

aimcheck = new LoadVars();
aimcheck.load("http://big.oscar.aol.com/St5f1n?on_url=http://www.stefangomez.com/aimchecky.html&off_url=http://www.stefangomez.com/aimcheckn.html");
aimcheck.onLoad = function (){
testo.text = aimcheck.aim;
}

then lastly i tried to use parameters to send, and i don't know how to code it so that it doesn't change all my characters into the escape() form of it.

aimcheck = new LoadVars();
aimcheck.on_url = "http://www.stefangomez.com/aimchecky.html");
aimcheck.off_url = "http://www.stefangomez.com/aimcheckn.html");
aimcheck.load("http://big.oscar.aol.com/St5f1n", aimcheck, "GET");
aimcheck.onLoad = function (){
testo.text = aimcheck.aim;
}


Again, the first two WORK when running the SWF locally, but for some reason not on a couple of hosts that i've tried.. maybe i'm going about this the wrong way. I've thought about making some php script to do this then have AS read the PHP, but then i'm not sure about the PHP code on that.

Thanks for all the help!
Stefan

innui
April 16th, 2003, 04:38 PM
Well I pretty much figured it out and fixed it. I had PHP get the info, then got AS to read the PHP. If anybody wants to see how i did it, just ask...

stefan

innui
April 17th, 2003, 08:08 AM
Well, I thought I had everything figured out, but now I've come across another problem. I don't know if it's just my computer/connection, or if there's a problem with my set up but once again I have a problem that only seems to be apparent when I access my uploaded file off the web. I have AS loading a PHP every 60 seconds. When I run it locally, it will run fine and actually update every 60 seconds. When I run it from the web it seems like the PHP file is being cached and not refreshed. It sounds like the problem I had earlier, but at least I have it loading the correct information now.

So, I figured, okay, maybe it's caching something so I'll just reload the page and see if by reloading the SWF file, it'll at least then reload the php file with the new settings. It didn't work! The only way I could get it to work is by closing my browser and then re going to my page...

Anybody have any Ideas as to why this is happening, or is the reason because of my internet conn/computer...

Thanks,
Stefan

innui
April 17th, 2003, 02:28 PM
It seems as though i've been answering my own questions here, and I have come closer to figuring out the answer to my last one, but can anyone help? Maybe I'll have to post this one to the server-side scripting forum also...

Okay, so I figured out that the browser is either caching the php, or the php is not reloading each time AS gets info from it. And again, for some reason it works when I run it locally!

What I'm wondering is how to get either a) the PHP to reload each time AS tries to access it, or b) do something in AS that forces the PHP to reload.

What happens now is that I run my SWF using getVars method and it gets the data from the PHP file. Then I'll update content that would cause the PHP file's output to change. However, when I have AS reload the php file(it's on a timer), it doesn't get the new PHP output. It doesn't even work if I simply reload my HTML page. I figured out that it somehow must be the PHP file because I'll point to the php file in a different browser window, and the new updated data appears. And behold, the SWF is updated! So what can I do either in AS or PHP to fix this??

Again, the weird thing is, it works when I run it locally.

I'm confused... however it may come to me later today..

-Stefan

innui
April 17th, 2003, 05:34 PM
Once again I answered my own question. Thank you ME! lol. well all I had to do was add some changing variables to force the php to be refreshed, because i figured out it was a caching problem. Just added a timer, and added an unnecessary string with a number from the timer to the end of the php file I was looking up. Easy as that, and now there are correct refreshes all the time!

Yay me!:)

-Stefan