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

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    mysql->php->flash problem
    « on: 03/12/07, 04:19 »
    Hi,
    I tried to go through with the stuff in http://flash-db.com/Tutorials/loading to connect mysql and flash. The connection worked, but all the variables were "unidefined". I added trace(this.toString()) function to see what was going on. It returned some weird stuff:

    cant=2&Image1=an2%2Ejpg&Comments1=Here%27s%20Anastasio%27s%20car&Title1=In%20the%20car&Image0=an1%2Ejpg&Comments0=This%20is%20a%20nice%20guy&Title0=Anastasio&onLoad=%5Btype%20Function%5D

    instead of,

    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


    Can anyone please help me about that?

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #1 on: 03/12/07, 04:24 »
    This is because the data is urlencoded, write

    trace(unescape(this))

    And you will see you're getting the data

    Jorge

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #2 on: 03/12/07, 04:53 »
    Thanks for your response, it looks better now but still not perfect  :-\

    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

    What's still wrong? ???

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #3 on: 03/12/07, 05:39 »
    The data is there, what's the problem?

    Jorge

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #4 on: 03/12/07, 06:04 »
    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.  :-\

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #5 on: 03/12/07, 06:39 »
    I think I found the problem. When I use,
    this.Title0, this.Title0, and soon it works. Infact, the row below in the for loop
    returns "undefined":

    this.ref["Title_txt"+i].text = this["Title_txt"+i];

    Could you tell me the reason? Thanks.


    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #6 on: 03/12/07, 07:24 »
    The variable name is

    Title1

    And you're using:

    this["Title_txt"+i];

    try using

    this["Title"+i];

    Jorge

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #7 on: 03/12/07, 07:36 »
    Doesn't work  :-[ In the sample code it's like that:

    this.ref["Comments_txt"+i].text = this["Comments_txt"+i]

    so it should work any way, but still, I haven't find the problem.  :-\

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #8 on: 03/12/07, 09:27 »
    This is the code I see tin the database file:

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

    it's not the same you mention. This is the one in loadSingle_txt:

    myData.onLoad = function(succes){
       if(succes){
          Title_txt.htmlText = "<b>"+this.Title+"</b>"
          Comments_txt.text = this.Comments
          holder_mc.loadMovie(this.Image)
       } else trace("Error loading data")
    }

    is not the same you mention. This is the one in loadMultiple_txt:

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

    Again not the same. I'm always refering to source code (as I mentioned, tutorial could jhave some typo)

    Now, which one are you using?

    Jorge

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #9 on: 03/12/07, 13:11 »
    I'm using that code in this link http://flash-db.com/Tutorials/loading/loadingData.php?page=5

    myData = new LoadVars()
            myData.ref = this
            myData.load("anastasio.php")
            myData.onLoad = function(succes){
                if(succes){
                    for(var i=0; i<this.cant; i++){
                        this.ref["Title_txt"+i].text = this["Title_txt"+i]
                        this.ref["Comments_txt"+i].text = this["Comments_txt"+i]
                        this.ref["holder_mc"+i].loadMovie(this["Image"+i])
                    }
                } else trace("Error loading data")
            }

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #10 on: 03/12/07, 13:19 »
    Quote
    I'm always refering to source code (as I mentioned, tutorial could have some typo)

    use SOURCE CODE

    Jorge

    mpxy

    • Server what's that
    • *
    • Posts: 18
      • View Profile
    Re: mysql->php->flash problem
    « Reply #11 on: 03/13/07, 01:53 »
    Thank you soo much, now it's working ;D

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #12 on: 03/28/07, 16:26 »
    Hi Jorge what exactly do you mean when you say use the source code to mpxy
    I am having the same problems as him

    I can't see anything it is just blank

    Can you please help?

    keeker

    • Server what's that
    • *
    • Posts: 12
      • View Profile
    Re: mysql->php->flash problem
    « Reply #13 on: 03/28/07, 16:31 »
    Hi Jorge what exactly do you mean when you say use the source code to mpxy
    I am having the same problems as him

    I can't see anything it is just blank

    Can you please help?
    [what is the difference between sane and insane]

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: mysql->php->flash problem
    « Reply #14 on: 03/29/07, 01:11 »
    The file you download, not the code in the tutorial (that have some typos)

    Jorge