Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 6 of 6
  1. #1

    Default I need help with a script

    It's a fairly simple problem, but I'm relatively new to action scripting.

    I want an Input Text Field with a button that when clicked, will check to see what's in the Input Text Field. If the Text Field has the words "Robert" in it, the movie will advance to frame 10. If it has anything else, it will give the alert "Access Denied" and the movie will not continue.

    I tried to script this myself, but I received an abundance of errors in the output menu that I have not been able to fix.

    Thanks in advance for any help.

    Regards,

    -Eric

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2003
    Location
    india
    Posts
    202

    Default use of if statement

    hi Eric,

    Use the below code on click the button

    Code:
    if (InputFieldName eq "Robert") {
        gotoAndPlay (10);
    } else {
        message = "Access Denied";
    }
    change the above code according to your requirement, you can use another TextField and named it message if there is an error in InputFieldName , it will show you the ERROR,

    Try it

    If you have another question feel free to put here!

    Regards
    Jeet

  4. #3

    Default RE:

    Thanks for the help Jeet, but I'm still having problems!

    When using this code:

    Code:
     on (release) {
    if (InputFieldName eq "Robert")
        gotoAndPlay (10); 
    } else { 
        message = "Access Denied"; 
    }
    I get this error:

    Scene=Scene 1, Layer=Enter (Button), Frame=1: Line 4: 'else' encountered without matching 'if'
    } else {

    When I attempted to fix the problem by removing the brackets around "else" I received no errors in the output menu, but it still did not work correctly. Is the problem having to do with substituting "InputFieldName" with something else, and if so, how do I know what to replace it with?

    Thanks for any help

    Your friend,

    -Eric

  5. #4

    Default Re:

    // Accidentally disabled BBCode //
    ----------------------------------------------------------------
    Thanks for the help Jeet, but I'm still having problems!

    When using this code:

    Code:
     on (release) { 
    if (InputFieldName eq "Robert") 
    gotoAndPlay (10); 
    } else { 
    message = "Access Denied"; 
    }
    I get this error:

    Scene=Scene 1, Layer=Enter (Button), Frame=1: Line 4: 'else' encountered without matching 'if'
    } else {

    When I attempted to fix the problem by removing the brackets around "else" I received no errors in the output menu, but it still did not work correctly. Is the problem having to do with substituting "InputFieldName" with something else, and if so, how do I know what to replace it with?

    Thanks for any help

    Your friend,

    -Eric

  6. #5
    Join Date
    May 2003
    Location
    india
    Posts
    202

    Default

    hi eric,

    Use the below code and try it

    Code:
    on (release) {
    	if (my eq "jeet") {
    		message = "";
    		gotoAndStop (5);
    	} else {
    		message = "Access Denied";
    		gotoAndPlay (5);
    	}
    }
    Or use the attechment file

    Feel free to put more queries!

    Regards
    Jeet
    Attached Files

  7. #6

    Default thanks

    Thanks for all the help Jeet, I'm no longer encountering any problems.



    -Eric

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

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
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial