1 Reply Latest reply on Aug 2, 2006 6:35 AM by Rothrock

    Better solution?


      I am very new to Actionscript andhave been looking for a way to load data from a php/mysql source into flash upon clicking buttons in my flash movie. I have created this method below and i simply would like to know if this is the/a correct way of doing it or is there a simpler way?

      1) I have X number of keyframes in my movie.
      2) Have X number of navigation buttons in my movie which each move the timeline to an associated keyframe on(Release)
      3) On each keyframe I have the following code (but the ?id= i pass to the php page is different depending on the keyframes, therefore retrieving different data each time:

      var reply_lv = new LoadVars();
      var send_lv = new LoadVars();

      send_lv.sendAndLoad(" http://localhost/test/test.php?id=3", reply_lv, "POST");
      reply_lv.onLoad = loadedVars;
      function loadedVars(success){

      if(success) {
      mytext_txt.text = reply_lv.title;
      myid_txt.text = reply_lv.link;
      } else {

      // operation failed


      Could any gurus out there tell me if this is a standard approach or have I just managed to make a complet mess of my movie?

      Kind Regards and thanks in advance.
        • 1. Re: Better solution?
          Rothrock Level 5
          Probably have made a mess of your movie! :)

          I'm not really following why you need to have X keyframes. And I don't see a stop here or a nextFrame(), so what is controlling the position of the playhead? (In other words there is so more stuff in that on (release), right?)

          Also, you seem to be redefining the LoadVars() objects each frame. I don't know, but to me that might get confusing.

          Finally, if you are using on (release) you seem to be using a mix of old style coding an new style with the LoadVars and all.

          Here is maybe what I would do.

          Have only one frame, with the button and the text fields, etc. Then put this code on the FRAME itself.

          curID=1; \\ or whatever it starts at.

          var reply_lv=new LoadVars();
          var send_lv=new LoadVars();

          } else{


          Or something like that. I'm not quite clear if the info is sent automatically at each new "frame" or only on user interaction or what.

          Even if you do need different keyframe for the art/info on screen/etc. I would still only have the two LoadVars and the associated event handlers defined once. And I would only define the button once as well. This will save you from having to go into X different frames and make changes should something need it.

          Am I making any sense?