Flash and passing variables to a movie from a php page

Posted on 2004-11-22
Last Modified: 2010-04-03
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.)


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
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

Question by:daryn
    LVL 27

    Expert Comment

    >Any ideas please?

    yep, you are using the variable *before* it has been loaded. How are you using it (the script)?

    Author Comment

    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.
    LVL 27

    Accepted Solution

    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");

    Author Comment

    thanks very much

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now