Help me please!

Discussion in 'Programming' started by ryan.katy, Apr 3, 2007.

  1. #1
    Hiya....i really need hepl asap with this one. K here we go...i have a game in flash but i want the user to enter their name and score and for these to be posted to a db thro coldfusion. the code i have in the swf is

    _global.myLoadVars_lv:LoadVars=newLoadVars();
    //create variables to send
    myLoadVars.username=name_txt.text;
    myLoadVars.score=score_txt.text;
    //send to coldfusion
    myLoadVars.send("score.cfm", "_blank", "POST");

    I've tried looking for coldfusion recieving code in books, sites, other projects i've done. i'm at my wits

    please help!
     
    ryan.katy, Apr 3, 2007 IP
  2. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    What exactly is the problem, does the page score.cfm not load? Is it that you don't know how to insert data in a db - help us out what's wrong?
     
    datropics, Apr 3, 2007 IP
  3. ryan.katy

    ryan.katy Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i can post data to a database...however when i send the variables from flash i don't know to accept them to coldfusion. there's a receiving code i need and i'm not sure what it is.
     
    ryan.katy, Apr 4, 2007 IP
  4. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    in terms of on the flash side, you are doing what you need to do. Let us see what you have in score.cfm. You will need something similiar to:

    <cfif IsDefined("Form.score")>
    <!--- Carry out some procedure to make sure the data submitted is clean --->


    <!--- Insert the data into the database --->
    <cfquery datasource='yourdatasource' password='Password' username='username'>
    Insert into TableName(score, username)
    Values (#CleanedScore#, '#CleanedUserName#')
    </cfquery>
    </cfif>
     
    datropics, Apr 4, 2007 IP
  5. ryan.katy

    ryan.katy Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i have the insert code however i've been told that because coldfusion and flash dont run together 'in harmony' i suppose, that my coldfusion file will need some recieving code to read the flash variables.
     
    ryan.katy, Apr 4, 2007 IP
  6. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #6
    Have you actually tried without this 'receive code'?
     
    datropics, Apr 4, 2007 IP
  7. ryan.katy

    ryan.katy Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    you know what datropics?
    i actually haven't. I think i'm just assuming it won't work as so many of my classmates are saying it wont work without it....il try it without and let you know yeah? Thanks!
     
    ryan.katy, Apr 5, 2007 IP