A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: ListBox variable?

  1. #1
    Senior Member carbonX's Avatar
    Join Date
    Jul 2001
    Location
    Virginia
    Posts
    261

    ListBox variable?

    Here's my code:

    FlowRate = "";
    dia = "";
    answer = "";
    inSq = 144;

    if (componet.name == "mgd") {
    num = 1.547;
    }
    if (componet.name == "gpd") {
    num = .000001547;
    }
    if (componet.name == "gph") {
    num = .0000371334877;
    }
    if (componet.name == "gpm") {
    num = .00222800926;
    }

    How do I get the variables "mgd","gpd","gph" and "gpm" out of the listBox componet so flash knows what value to apply to "num"?

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    What is "componet.name"?

  3. #3
    Senior Member carbonX's Avatar
    Join Date
    Jul 2001
    Location
    Virginia
    Posts
    261
    don't laugh.... componet.

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Hihihi!

    Component?
    "mgd","gpd","gph" and "gpm"?
    Are these 4 different listboxes? Or are these data in 1 list box?

  5. #5
    Senior Member carbonX's Avatar
    Join Date
    Jul 2001
    Location
    Virginia
    Posts
    261
    They're the data in one ListBox. I haven't played around with the ListBox very often, if ya can't tell.

  6. #6
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    myListBox.getSelectedItem().data


    -myk

  7. #7
    Senior Member carbonX's Avatar
    Join Date
    Jul 2001
    Location
    Virginia
    Posts
    261
    myListBox.getSelectedItem().data

    So...it'd be
    componet.getSelectedItem(2).data;
    to get gph?

    And off that subject for a second, Why is the very bottom of the listBox covering the bottom of letters like "g" and "p"?

  8. #8
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    close.. nothing goes inside the parenthesis.. it'd be:
    Code:
    componet.getSelectedItem().data;
    that'd return the data of the currently selected item..
    as for lowercase letters with tails, if anyone knows how to fis that, please speak up now!

    -myk

  9. #9
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    here's a link that explains all available methods for a list box:


    http://www.macromedia.com/support/fl...ionary241.html



    -myk

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Still wondering what a "componet" is?

    I'd use the Change Handler and put your if statements in the function.

    As for the lower case letters, how about adding an empty label on the bottom?

  11. #11
    Senior Member carbonX's Avatar
    Join Date
    Jul 2001
    Location
    Virginia
    Posts
    261
    I'll give that a try guys, Thanks!
    And a "componet" is some insight to my magnificent spelling abilities.

  12. #12
    -Iron Myk- mykrob's Avatar
    Join Date
    Dec 2001
    Location
    Jackson, TN
    Posts
    1,356
    wont help.. what i think he means is:

    lets say you have a list box with 4 rows visible.. Anything on the 4th row will cut off the tails of lowercase letters. Even if you add blank rows, whatever is currently on that last row will mysteriously be chopped...

    go figure..
    -myk

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Open up the Library...

    Flash UI Components->Components Skins->Global Skins...

    Double-click the Flabel component

    Unlock layers, open up the actions window...

    Change the value in this line from 2 to 4:

    this.labelField._height = this.labelField.textHeight + 4;

    The label field will then NOT cut off tails of lower case letters.

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