A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Substring this!

  1. #1

    Post

    I want to make some buttons selected according to this variable set on input:

    Selections=1,4,10

    How can I substract these number out of the string, so I can say:

    If (x=10)
    Tell target "/Button10"
    Go to and stop "Selected State"
    End Tell target
    End if

    Kim

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Wink

    Try this:

    <pre>
    Set Variable: "a" = 1
    Set Variable: "Number" = ""
    Loop While (a <= Length (Selections))
    If (Substring (Selections, a, 1) eq "," or a = Length(Selections))
    Set Variable: "Number" = ""
    If (Number ne "")
    Begin Tell Target ("/Button" & Number)
    Go to and Stop ("Selected State")
    End Tell Target
    End If
    Else
    Set Variable: "Number" = Number & Substring (Selections, a, 1)
    End If
    Set Variable: "a" = a + 1
    End Loop
    </pre>



    [This message has been edited by scottris (edited 26 March 2000).]

  3. #3

    Smile

    Ok, your script had a few bugs. Here's my version that works with the original variables:

    Set Variable: "a" = 1
    Set Variable: "number" = ""
    Loop While (a<= Length (selections))
    If (Substring ( selections, a, 1 ) eq ",")
    Set Variable: "number" = ""
    Else
    Set Variable: "number" = Substring ( selections, a, 1 )
    If ("Number" ne "")
    Begin Tell Target ("/MC"&Number)
    Go to and Stop ("S2")
    End Tell Target
    End If
    End If
    Set Variable: "a" = a+1
    End Loop

    Thx for helping me out finding it!

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Red face

    Oh my! you're quite correct.. That script that I posted had several bugs..

    I am afraid that in my haste to help, I neglected to sufficiently check my work. My apologies.

    However, I am glad that you figured it out!

  5. #5
    Junior Member
    Join Date
    Apr 2000
    Posts
    3

    Post

    eww. This language seems a lot like a Mickey Mouse version of C++. And i thought programming in DOS was lame, not it can actually be applied to something semi-practical. woo yea. IN YOUR FACE MARTHA STUART. I hope that didn't make sense to anyone.

    ------------------
    "so, sup b?"
    "watchin' the game, havin' a bud"
    "tru, tru"

    -Nuclearholocat
    says "wazzzzup"
    and "i'm hep"

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