1 Reply Latest reply on Dec 8, 2008 1:25 PM by kglad

    Flash AS2 Php MySQL loading swfs

    Odisey2
      Hello,


      I am using a DB and Php to communicate with the main flash movie and child movies. I am sending data to the db and parsing the db for data. I have the db set up and it is functioning perfectly. I am sending variable data from Flash to the db and populating records.

      Code I need to figure out yet is as follows:

      I have a php file that parses a table with three records: MC1 MC2 MC3. The Php file returns one of the records randomly. I am trying to figure out how to loadVariables or myLoadVariables() or whatEver() from the Php file to randomly load one of three MCs from the main directory into the main movie time-line; into a container_mc. This is so simple - I am all over it - not quite there yet though.

      I have this code - can someone help me with this?
      [CODE]

      _root.login_bn.onRelease = function(){

      // create a Load Var
      _root.logdata = new LoadVars();

      // pass a variable to it this I wont figure out for you
      randomNo = random(3);

      // this is what you will be sending to PHP
      _root.logdata.sendVideo = "yes";

      // now you can call a random page 1, 2 or 3
      _root.logdata.sendAndLoad("flashvideo"+randomNo+".php", _root.logdata);
      }

      then you add a onClip event or some kind of checker to wait for the VAR Video to load

      onClipEvent(enterFrame) {
      if (video > "") {
      loadMovie(video, empty_mc);
      }
      }


      on the PHP side-------------------------------

      if($_POST['sendVideo']){
      echo("&video=videoName.swf");
      }



      [/CODE]


      Thank you,
      Odisey
        • 1. Re: Flash AS2 Php MySQL loading swfs
          kglad Adobe Community Professional & MVP
          that's pretty confused.

          1. there's no database querying in your php
          2. in fact, nothing useful is happening in your php, at all.
          3. there's not much point to using 3 different php files. why not use one that parses randomNo and then returns the appropriate swf to load
          4. you should use distinct loadvars instances to send and to receive data
          5. you should have an onData (or onLoad) receive loadvars method defined to parse the data returned from you php.
          6. that enterframe loop appears to do nothing useful even if video and empty_mc were defined. and checking if(video > "") doesn't seem helpful.