Skip to main content
February 25, 2013
Question

Embedding Flash swf in Google Site displays NaN output but works in Debug mode

  • February 25, 2013
  • 1 reply
  • 1144 views

Hello,

I am loading a text file with three variables into a flash file (CS5). The flash file then calculates and prints the three values based on some calculations. I am storing the text file as an attachment on the google page in which I am embedding the swf file. What's weird is that the flash file plays correctly in debugging mode (i.e., prints the 3 variables correctly), but as soon as I upload the swf to the Google site page (as an attachment in the same location as the text file), the flash file outputs NaN. I am stuck as to why the file works in debug mode in Flash, but not when it's uploaded to the google site page. I have tried storing the text file on SharePoint and referencing it from there, but I get the same results when viewing the swf on the Google site page.

Is it because the google site page is using SSL?

I am fairly new to flash, so any help would be appreciated.

Thanks!

Lori

________________________

Variables.txt stores this: "current=6950&goal=7175&low=6950"

Here is the code in my flash file:

_global.getPercent = "";

myvars = new LoadVars();

myvars.load("variables.txt");

myvars.onLoad = function(success){

          l = Number(myvars.low);

          c = Number(myvars.current);

          g = Number(myvars.goal);

 

          getPercent = (c-l)/(g-l);

          if (getPercent > 0) {

                    colorshow._height = (getPercent*colorshow._height);

          } else {

                    colorshow._height = 0;

          }

}

;

This topic has been closed for replies.

1 reply

Nabren
Inspiring
February 25, 2013

Are you positive the file is loading? Have you tried debugging and seeing what it loads for the file content before you start parsing the file?

February 25, 2013

I think so...if I comment out the parsing and add a trace, it displays the output correctly.

if(success){

trace("The low is "+myvars.low+", the current is "+myvars.current+" and our goal is "+myvars.goal+".");

} else {

trace("there was a problem loading the variables");

}

The output in flash displays:

The low is 6950, the current is 6950 and our goal is 7175.

Is that what you mean?

Nabren
Inspiring
February 25, 2013

Close, but how is the success boolean being set? Also, do you get that output statement when running from the Google Page?