[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

Flash and passing variables to a movie from a php page

heys all.

Right. This is an oldie but a goodie. (well. not really a goodie. more like an out of date cookie with a little mould on it. kinda.)

ahem.

I've got a flash navigation movie (ie a bar with menu options on with a little bar that moves underneath the menu option that corresponds to the current page).

making the bar respond to a mouse rollover of the menu item is working fine.

given a variable in the script
ie
currentpage = 4;
if (currentpage==4)
{
<make bar go to this position>
}

then the bar will obediently go to that position.

However. I cant get this function above to respond correctly when the variable is not defined in the script, but defined by either

1) loadvariables from a php script (the script returns    currentpage=4    )
2) hardcoding the variable into the html object reference.

All this works fine, of course, when placing the variable into a dynamic text box but i cant get this damn thing to work when simply trying to test the damn thing.


Any ideas please?

thanks very much

Daryn
0
daryn
Asked:
daryn
  • 2
  • 2
1 Solution
 
negatyveCommented:
>Any ideas please?

yep, you are using the variable *before* it has been loaded. How are you using it (the script)?
0
 
darynAuthor Commented:
definitely using it _after_ i've run the load command.

the load command is based in the first frame of the "first" layer that existed in the animation (ie the bottom layer).

the command to move the bar to the desired position, depending on the condition, is in the actionscript attached to the bar itself.
0
 
negatyveCommented:
Wait, I'm sure that you try to use it after the load command, but not sure that:

- you are using it after it has been loaded
- you are using it in the desired format.

For example:

data_var = new LoadVars();
data_var.onLoad = function(success)
{
      
      if(success){ // data has been loaded
            if(Number(this.currentpage) == 4){ // convert it to a number, as it's loaded as string
                  // do something
            } else {
                  // do something else
            }
      } else {// data has *not* been loaded
            trace("PHP FILE MISSING");
      }
};
data_var.load("page.php");
0
 
darynAuthor Commented:
thanks very much
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now