| Author |
Message |
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Wed Sep 02, 2009 5:28 pm Post subject: Flash: LoadVars: SWF file stopped working by itself |
|
Hope someone knows a bit about Flash and ActionScript1.0, here it goes.
I have a flash file that a friend wrote for me long time ago. This file displays a countdown to an event. The event time, and current time is received via a PHP file, or for simplicity's sake, a .TXT file.
This file has been working fine for many years. Recently, during the past year or so, it fails at "LoadVars" and returns "Error opening URL"
The FLA code is as follows:
stop();
countdown = function ()
{
var currentMillisecs = myLoadVars.time + getTimer();
this.msecs = myLoadVars.event - currentMillisecs;
if (this.msecs <= 0)
{
play();
return(undefined);
} // end if
this.secs = Math.floor(this.msecs / 1000);
this.mins = Math.floor(this.secs / 60);
this.hours = Math.floor(this.mins / 60);
this.days = Math.floor(this.hours / 24);
this.msecs = String(this.msecs % 1000);
this.secs = String(this.secs % 60);
this.mins = String(this.mins % 60);
this.hours = String(this.hours % 24);
this.days = String(this.days);
while (this.msecs.length < 3)
{
this.msecs = "0" + this.msecs;
} // end while
if (this.secs.length < 2)
{
this.secs = "0" + this.secs;
} // end if
if (this.mins.length < 2)
{
this.mins = "0" + this.mins;
} // end if
if (this.hours.length < 2)
{
this.hours = "0" + this.hours;
} // end if
while (this.days.length < 3)
{
this.days = "0" + this.days;
} // end while
for (movie in this)
{
if (this[movie]._parent == this)
{
this[movie].evaluateFrameFrom(this);
} // end if
} // end of for...in
};
MovieClip.prototype.evaluateFrameFrom = function (variableClip)
{
var nameArray = this._name.split("_");
var numberSet = variableClip[nameArray[0]];
var character = Number(nameArray[1]);
var frame = 1 + Number(numberSet.charAt(character));
if (this._currentframe != frame)
{
this.gotoAndStop(frame);
} // end if
};
myLoadVars = new LoadVars();
myLoadVars.onLoad = function (ok)
{
if (!ok)
{
trace("Server error! Unable to obtain info from server");
return(undefined);
} // end if
counter.onEnterFrame = countdown;
counter._visible = true;
this.time = Number(this.time) * 1000 - getTimer();
};
myLoadVars.load("time.php?event=coolevent");
counter._visible = false;
The problem, I think, is right here in the
myLoadVars.load("time.php?event=coolevent");
if I remove the ?event=coolevent it works like it always used to.
myLoadVars.load("time.php");
But now time.php does not know which event info to send to it.
As for what causes the problem, it varies from computer to computer, my suspicion is an update somewhere for Vista has broken it. or is disallowing some part of LoadVars to happen.
Google has failed me (except this Experts-Exchange junk) and I'm not so sharp on my ActionScript (or java for that matter)
Anyone have any info about this? Or links to others that have this problem? Or any work around?
Thanks in advance
-Who? |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
CMTG
Leg Humper


Joined: 23 Feb 2002 Posts: 5449
Location: /var/log/cabin
|
Posted:
Thu Sep 03, 2009 7:42 am Post subject: |
|
What happens if you visit "time.php?event=coolevent" with your browser? |
_________________ Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.
Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.
I write more quotes than a fucking big book of quotes. - Scroobius Pip
http://fedoraproject.org/get-fedora
|
|
|
|
|
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Thu Sep 03, 2009 9:47 pm Post subject: |
|
CMTG wrote:What happens if you visit "time.php?event=coolevent" with your browser?
Works like it should:
time=1252002868&event=1264176000000
Using browsershots.org, it seems that very few browsers work with it, I've somewhat concluded that I need to go from ActionScript1 to 2 or 3.
Thanks for your time
Any other info or advice would be appreciated. |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
gregw
Tail-Wagger

Joined: 25 May 2003 Posts: 2999
Location: About 2000 miles south of where I want to be.
|
Posted:
Thu Sep 03, 2009 11:03 pm Post subject: |
|
You might have better luck generating and parsing XML from your PHP script:
<?xml version="1.0" ?><rows><row time="1252002868" event="1264176000000"/></rows>
Then in your Flash:
var myXML:XML = new XML();
myXML.load("time.php?event=coolevent");
myXML.onLoad = function() {
var codeXML:Array = this.firstChild.childNodes;
MyTime = codeXML[0].attributes.time;
MyEvent = codeXML[0].attributes.event;
}
This is totally off the top of my head. There are tons of tutorials out there on how to do this. |
_________________ Some people are like slinkys... not really good for anything but they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
|
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Thu Sep 03, 2009 11:46 pm Post subject: |
|
gregw wrote:You might have better luck generating and parsing XML from your PHP script:
Thanks Gregw, however I run into the same problem.
Error opening URL 'file:///C|/FLASH/time.php?'
But once again, if I remove the ? it works fine. Is there some other way I'm supposed to pass the URL QUERY_STRING info back to the server? |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
CMTG
Leg Humper


Joined: 23 Feb 2002 Posts: 5449
Location: /var/log/cabin
|
Posted:
Fri Sep 04, 2009 12:24 am Post subject: |
|
Who wrote:gregw wrote:You might have better luck generating and parsing XML from your PHP script:
Thanks Gregw, however I run into the same problem.
Error opening URL 'file:///C|/FLASH/time.php?'
But once again, if I remove the ? it works fine. Is there some other way I'm supposed to pass the URL QUERY_STRING info back to the server?
The PHP has to be on a webserver to work, it won't be run from your C: drive alone... |
_________________ Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.
Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.
I write more quotes than a fucking big book of quotes. - Scroobius Pip
http://fedoraproject.org/get-fedora
|
|
|
|
|
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Fri Sep 04, 2009 12:54 am Post subject: |
|
CMTG wrote:The PHP has to be on a webserver to work, it won't be run from your C: drive alone...
I know that, which is why its just a .txt file with the correct PHP response, renamed to .php (to totally eliminate php, network, servers ect.. as a possible cause of problem) |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
CMTG
Leg Humper


Joined: 23 Feb 2002 Posts: 5449
Location: /var/log/cabin
|
Posted:
Fri Sep 04, 2009 1:57 am Post subject: |
|
Who wrote:CMTG wrote:The PHP has to be on a webserver to work, it won't be run from your C: drive alone...
I know that, which is why its just a .txt file with the correct PHP response, renamed to .php (to totally eliminate php, network, servers ect.. as a possible cause of problem)
But the question mark is not valid in file names or directory names on Windows... You are trying to open a local file named "time.php?" which obviously cannot exist.
And if the PHP on the webserver works as expected, like you say, then it's probably not the network, the server or PHP itself at fault. |
_________________ Pie. I wish I could
constrain my hungry greed but...
Sadly, defeated.
Charlene's Law: There's no such thing as can't.
Charlene's Corollary: Unless it's followed by be arsed.
I write more quotes than a fucking big book of quotes. - Scroobius Pip
http://fedoraproject.org/get-fedora
|
|
|
|
|
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Fri Sep 04, 2009 2:50 am Post subject: |
|
Either way, it does not work on the server, or in a local mock environment.
Going to have a friend compile it in CS4, or try different flash versions.
All I can restate is that this whole setup has been on a server for a long time, and suddenly has stopped working, as well as my mock environment. Presumably, due to a flash update.
I'll try a fresh approach tomorrow. Thanks again for all your help, keeps giving me new ideas. |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
Who
Stray Dog
Joined: 03 May 2002 Posts: 54
Location: Southern California
|
Posted:
Tue Sep 08, 2009 1:35 am Post subject: |
|
Well, reverting back to my old "always had worked" flash file, I installed different versions of flash on my computer.
8,0,42, 0 YES
10,0, 2,54 YES
10,0,12,36 YES
10,0,22,87 NO
10,0,32,18 NO
Version 8, works fine.
then at version 10,0,22 it stops working. =( |
_________________ I have no profound enlightenment in my sig
|
|
|
|
|
|
|