LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Wed Sep 02, 2009 5:28 pm   Post subject: Flash: LoadVars: SWF file stopped working by itself Reply with quote Back to top  

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:

Code: Select all

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
Code: Select all
myLoadVars.load("time.php?event=coolevent");


if I remove the ?event=coolevent it works like it always used to.

Code: Select all
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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 5302
Location: /var/log/cabin

Post Posted: Thu Sep 03, 2009 7:42 am   Post subject: Reply with quote Back to top  

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.


The number you have dialled is complex. Please rotate your phone ninety degrees and dial again.
View user's profile Send private message Send e-mail Visit poster's website
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Thu Sep 03, 2009 9:47 pm   Post subject: Reply with quote Back to top  

CMTG wrote:
What happens if you visit "time.php?event=coolevent" with your browser?


Works like it should:
Code: Select all
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 Smile

Any other info or advice would be appreciated.

_________________
I have no profound enlightenment in my sig
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
gregw
Tail-Wagger
Tail-Wagger


Joined: 25 May 2003
Posts: 2856
Location: About 2000 miles south of where I want to be.

Post Posted: Thu Sep 03, 2009 11:03 pm   Post subject: Reply with quote Back to top  

You might have better luck generating and parsing XML from your PHP script:

Code: Select all
<?xml version="1.0" ?><rows><row time="1252002868" event="1264176000000"/></rows>

Then in your Flash:

Code: Select all
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.
View user's profile Send private message
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Thu Sep 03, 2009 11:46 pm   Post subject: Reply with quote Back to top  

gregw wrote:
You might have better luck generating and parsing XML from your PHP script:


Thanks Gregw, however I run into the same problem.

Code: Select all
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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 5302
Location: /var/log/cabin

Post Posted: Fri Sep 04, 2009 12:24 am   Post subject: Reply with quote Back to top  

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.

Code: Select all
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.


The number you have dialled is complex. Please rotate your phone ninety degrees and dial again.
View user's profile Send private message Send e-mail Visit poster's website
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Fri Sep 04, 2009 12:54 am   Post subject: Reply with quote Back to top  

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
CMTG
Leg Humper
Leg Humper


Joined: 23 Feb 2002
Posts: 5302
Location: /var/log/cabin

Post Posted: Fri Sep 04, 2009 1:57 am   Post subject: Reply with quote Back to top  

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.


The number you have dialled is complex. Please rotate your phone ninety degrees and dial again.
View user's profile Send private message Send e-mail Visit poster's website
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Fri Sep 04, 2009 2:50 am   Post subject: Reply with quote Back to top  

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Who
Stray Dog


Joined: 03 May 2002
Posts: 54
Location: Southern California

Post Posted: Tue Sep 08, 2009 1:35 am   Post subject: Reply with quote Back to top  

Well, reverting back to my old "always had worked" flash file, I installed different versions of flash on my computer.

Code: Select all
 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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!