Welcome, Guest
  • Author Topic: mysql->php->flash problem  (Read 11119 times)

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #15 on: 03/29/07, 04:46 »
    Hi again Jorge,
    I have dowloaded the sample files and it still not working
    I am using php with a local server.
    The php file shows the following:
    Title0=Anastasio&Comments0=This is a nice guy&Image0=an1.jpg&Title1=In the car&Comments1=Heres Anastasios car&Image1=an2.jpg&cant=2

    I assume this is correct. All the files are in the same folder -- try
    this is the flash code:
    I have also changed the url

    //Create LoadVars object and load file
    myData = new LoadVars()
    //myData.load("anastasio.asp") //asp line
    myData.load("http://localhost/try/anastasio.php") //php line
    myData.ref = this
    //Fetch data
    myData.onLoad = function(succes){
       if(succes){
          for(var i=0; i<this.cant; i++){
             this.ref["Title_txt"+i].htmlText = "<b>"+this["Title"+i]+"</b>"
             this.ref["Comments_txt"+i].text = this["Comments"+i]
             this.ref["holder_mc"+i].loadMovie(this["Image"+i])
          }
       } else trace("Error loading data")
    }
    stop()
     
    What am I doing wrong I have tried everything. It is not happening for me.

    I would really appreciate it if you could look in to it.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #16 on: 03/29/07, 05:44 »
    Add a trace inside the onLoad handler:

    if(succes){
       trace(this)

    What do you get?

    jorge

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #17 on: 03/29/07, 06:06 »
    Thanks for replying Jorge

    I did what you suggested I received this output

    cant=2%0D%0A&Image1=an2%2Ejpg&Comments1=Heres%20Anastasios%20car&Title1=In%20the%20car&Image0=an1%2Ejpg&
    Comments0=This%20is%20a%20nice%20guy&%0D%0A%0D%0ATitle0=Anastasio&onLoad=%5Btype%20Function%5D&ref=%5Flevel0

    I am new to Flash what does this mean

    Thank you
    « Last Edit: 03/29/07, 07:14 by Jorge Solis »

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #18 on: 03/29/07, 07:16 »
    That means: data is arriving. So check that you have Title_txt0, Title_txt1, Comments_txt0, Comments_txt1 textfields, holder_mc0, holder_mc1 MC ... basically, read with attention the tutorial

    Jorge

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #19 on: 03/29/07, 07:24 »
    Thanks Jorge

    I do have those movie clips.

    I am using the loadDB.fla file you provide, so they are there

    Look I am really sorry but I really don't understand what is going wrong I did do the tutaorial couple of times before I came to the forum.
    « Last Edit: 03/29/07, 07:32 by keeker »

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #20 on: 03/29/07, 08:27 »
    As far as I understand it should look like that when I call the function:

    Title0=Anastasio&Comments0=This is a nice guy&Image0=an1.jpg&Title1=In the car&Comments1=Here's Anastasio's car&Image1=an2.jpg&cant=2

    but it looks like that:

    cant=2&Image1=an2.jpg&Comments1=Here's Anastasio's car&Title1=In the car&Image0=an1.jpg&Comments0=This is a nice guy&Title0=Anastasio&onLoad=[type Function]&ref=_level0

    I also couldn't understand the "onLoad=[type Function]&ref=_level0" part at the end.  :-\

    Hi mate I am having exactly the same problems that you had
    Can you please tell me how you resolved them.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #21 on: 03/29/07, 12:11 »
    This is because you're tracing the complete LoadVars object, so onLoad and ref are a build-in callback and an added property (LoadVars is a dinamyc class)
    Try the text file example to see if it works

    Jorge

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #22 on: 03/29/07, 12:16 »
    Thanks Jorge

    The text file examples are working.

    So where does this leave me?

    Can you please help me with the dynamic (php) one?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #24 on: 03/30/07, 03:49 »
    Hi Jorge,
    the images are there in the folder and everything else, I can't see any of the text either.

    I disabled the loop like "mpxy"

    this.ref["Comments_txt0"] then I managed to see the comments only but couldn't see the images or the titles.
     
    I know this has been going on for a while and you must be getting bored of this.

    Is there anything else you could tell me to get this working?

    Many thanks


    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #25 on: 03/30/07, 03:59 »
    As you can see in the other thread, has worked for muralidhara3d (I have changed a little the source, did you download again?)
    All fixing tips are explained in the tutorial, try harder

    Jorge

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #26 on: 03/30/07, 04:34 »
    Jorge

    I don't know how to thank you.

    I will donate some money, promise.

    Many thanks again.

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #27 on: 03/30/07, 05:06 »
    Jorge

    one small issue it won't show the first title Title_txt0.

    any ideas?

    Thank you

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #28 on: 03/30/07, 05:28 »
    Hi Jorge I think I might have sorted out my last question.

    I have changed the query to the following.
    $result = mysql_query("SELECT * FROM titles");
    $cant = 0;
    while($row=mysql_fetch_array($result)){
       echo

    "ID$cant=$row[ID]&Comments$cant=$row[Comments]&Title$cant=$row[Title]&Image$cant=$row[

    Image]&";
       $cant++;
    }
    echo "cant=$cant";
    ?>
    included the id field because I don't need to display that it really doesn't matter.
    but I must tell you somehow it just won't display the first ever record in the value pairs in the original file which is the first title

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #29 on: 03/31/07, 08:27 »
    Hi Jorge,

    I am back again ;D

    As you know, the tutorial "loading data from databases using name/value pairs (php-asp code)"
    only has two records in the database. If we had more than two records would it be possible to page records and how could we dynamically create the dynamic text fields and image holders to macth the number of records in the database.

    Can you please help