A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: check lettres in an string

  1. #1
    Junior Member
    Join Date
    Sep 2004
    Posts
    26

    check lettres in an string

    hi is there any way to get flash to check each letter or number in an string

    for eg

    _root.string = 123456789

    if _root.string = ="2" then

    somthing ...

    i ent sure if this is possable any help would be grate

    thats in advance

  2. #2
    Uses MX 2004 Pro Quixx's Avatar
    Join Date
    Nov 2004
    Location
    U.S.
    Posts
    877
    You can loop through the characters in the string and use an if statment to compare the variables.

    PHP Code:
    var myString:String "abc123";
    var 
    i:Number 0;
    while (
    i<myString.length) {
        if (
    myString.charAt(i) == 2) {
            
    trace("true at character "+i);
            break;
        }
        
    i++;


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