Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 04:46
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  MySQL, PostgreSQL, MS SQL, Access (Moderators: Flash-db, Musicman, Ronald Wernecke, Jorge Solis, Andries Seutens)
| | |-+  mysql->php->flash problem
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 Print
Author Topic: mysql->php->flash problem  (Read 10447 times)
mpxy
Server what's that
*
Posts: 18


View Profile
« 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?
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« 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
Logged

mpxy
Server what's that
*
Posts: 18


View Profile
« Reply #2 on: 03/12/07, 04:53 »

Thanks for your response, it looks better now but still not perfect  Undecided

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? Huh
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #3 on: 03/12/07, 05:39 »

The data is there, what's the problem?

Jorge
Logged

mpxy
Server what's that
*
Posts: 18


View Profile
« 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.  Undecided
Logged
mpxy
Server what's that
*
Posts: 18


View Profile
« 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.

Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« 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
Logged

mpxy
Server what's that
*
Posts: 18


View Profile
« Reply #7 on: 03/12/07, 07:36 »

Doesn't work  Embarrassed 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.  Undecided
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« 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
Logged

mpxy
Server what's that
*
Posts: 18


View Profile
« 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")
        }
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« 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
Logged

mpxy
Server what's that
*
Posts: 18


View Profile
« Reply #11 on: 03/13/07, 01:53 »

Thank you soo much, now it's working Grin
Logged
keeker
Server what's that
*
Posts: 12


View Profile
« 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?
Logged
keeker
Server what's that
*
Posts: 12


View Profile
« 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]
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #14 on: 03/29/07, 01:11 »

The file you download, not the code in the tutorial (that have some typos)

Jorge
Logged

Pages: [1] 2 3 Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything