SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Problem with Flash/ASP Login System

    Hi,

    I've downloaded the files for the Flash/ASP Login System in the tutorial on http://www.flashmagazine.com/html/695.htm .

    Even without changing any of the code in the files I can't get the darn thing to work. I tested out the ASP page by manually inputting the username and password values into the code and it worked fine so I am thinking the problem maybe with the way Flash is sending and receiving the variables to the ASP page.

    The other thing is that this tutorial was written in 2002, so I guess it is possible that some of the Flash Actionscript isn't current.

    Here's the actionscript:

    Code:
     
    // first we create the object
    login_lv = new LoadVars();
     
    //now we create the function that will happen 
    //when this object recieves data
    login_lv.onLoad=function(){
     
    //check to see if the users info is correct
     if(this.userInfo == "true"){
      trace("Welcome");
     }else{
    
    //if the users info was not correct, trace an error, and clean the text fields
      trace("Invalid data");
      login_txt.text="";
      password_txt.text="";
     }
    }
     
    //the function for the login button
    onLogin=function(){
    
    //an error will occur if the user didn't enter a login name
     if(login_txt.text.length<1){
      trace("please provide a login name");
    
    //an error will occur if the password is not the right length
     }else if(password_txt.text.length<5){
      trace("invalid password");
     
    //and clean out the password
      password_txt.text="";
     }else{
     
    //this is if everything is fine to send
     
     //we will store the user information as properties of the LoadVars object
      login_lv.username=login_txt.text;
      login_lv.password=password_txt.text;
     
    //now we send the data, and wait to recieve something back
      login_lv.sendAndLoad("login.asp", login_lv, "POST");
     }
    }
    If anyone can help, that'd be great, or if any more info is needed, please let me know.

    Thanks.

  2. #2
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh and the ASP code that communicates with the flash file is:
    Code:
     
    '''''''First, get the stuff from flash
     Dim inUserName, inPassword
      inUserName = Trim(Request("username"))
      inPassword = Trim(Request("password"))
     
    ''''''''A couple of if/thens that assigns "userInfo=true" to mainMessage if the username and password are correct and "userInfo=false" to mainMessage if the login is not correct.
     
    '''''''Now send the data back to flash
     Response.Write(mainMessage)

  3. #3
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok figured it out. The problem is that I was testing the file in Flash (because it uses TRACE to tell the user if it works or not). Once I published the HTML file from Flash and ran that, it worked fine....just had to jump to another frame in the movie to tell the user ifd the login was sucessful.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •