A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Deprecated ne - Inequality Operator

  1. #1
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120

    Deprecated ne - Inequality Operator

    This is a super simple question I'm guessing, but my tiny and out-of-practice actionscripting brain just can't make the translation.

    I'm trying to make a simple user/pass login form respond good/bad via status text depending on the password entered.

    I'm trying to mark up the following code to make it work:

    Code:
    on (release) {
    	if (password eq "Password123") {
    		status = "You're VIP, baby!";
    	} else if (password ne "Password123") {
    		status = "Access is Denied.";
    	}
    }
    I'm recently moved to CS3 but still using AS 2 for this particular file.

    The "ne" method is deprecated now (and also, in my movie, is only working when pass is wrong, not when it is right) - and I would like to accomplish the same thing using the new lingo.

    Could anyone translate it using the "!= inequality operator" method? Or maybe recommend a tutorial or download?

    Many, many thanks for any help...
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    try a simple if/else -

    if (password == "Password123") {
    status = "You're VIP, baby!";
    } else {
    status = "Access is Denied.";
    }

  3. #3
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    != means "is not equal to". it is used interchangeably with ne.
    == means "is equal to". it is used interchangeably with eq.

    PHP Code:
        if (password == "Password123") {
            
    status "You're VIP, baby!";
        } else if (
    password != "Password123") {
            
    status "Access is Denied.";
        } 

  4. #4
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120

    Refuses to Work!

    Gents - many thanks to both of you for your responses.

    However - I cannot get this little darn thing to work - it gives the "bad" or "else" response no matter what - even if the password is correct.

    Attaching the files (in FL8, some reason the CS3 version wouldn't upload) - if you have time, could you take a glance? What am I doing wrong here - it seems like it should be so simple.
    Attached Files Attached Files
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you are accessing a TextInput Component,
    so you need to add .text to your code

    Code:
    on (press, release) {
    	if (password.text == "Password123") {
    		status = "You're VIP, baby!";
    	} else if (password.text != "Password123") {
    		status = "Access is Denied.";
    	}
    }

  6. #6
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120

    Thanks!

    You are a gentleman and a scholar.

    Many thanks.
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  7. #7
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120

    Temporary "status" Text

    Thank you SO MUCH for your help thus far - could I trouble you for one more tweak?

    Is there a simple way I could put a timer on the status messages?

    So "Access is Denied." would render for say 10 seconds and then vanish.

    Since the whole site uses internal nav, a user could have that stuck on the screen for their entire web experience otherwise...
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  8. #8
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    move the code to the timeline:

    PHP Code:
    submitButtonName.onRelease = function {
        if (
    password.text == "Password123") {
            
    status "You're VIP, baby!";
        } else if (
    password.text != "Password123") {
            
    status "Access is Denied.";
            
    statusTimer setInterval(clearStatus10000);
        }
    }

    function 
    clearStatus(){
        
    status "";
        
    clearInterval(statusTimer);


  9. #9
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120
    Thank you so much for the expert response(s) - and so quick!

    I'm going to take a stab at implementing this in an hour or two (caught up with something else presently) - and will let you know if all went well once I've done so.

    Thanks again.
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  10. #10
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120
    Ah - just noticed:

    Maybe this is irrelevant, as it is actionscript and embedded in Flash - we are running Windows server actually, and ASP.NET (not that anything on the site is dynamic yet so we're not using it) - but does that mean that this PHP code will not work for our app, or am I confused?
    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

  11. #11
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    ignore the "PHP Code" around that selection. it's just there because I used the PHP tags in my message instead of the generic CODE tags as a way to have the code highlighted and formatted. The code there is all actionscript.

  12. #12
    Special Agent drumatic's Avatar
    Join Date
    Aug 2000
    Location
    nyc
    Posts
    120

    $50-100 Gig - Includes Finishing this Issue

    | KeMeK | drumatic | Threshold Theater | KeMeK Technology |

    ::If you don't know, learn; If you know, teach::

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center