A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: User Input Variables (Using Input Boxes)

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25

    Post User Input Variables (Using Input Boxes)

    Hey everyone! I need to call on your wisdom for something, probably won't take a minute!

    I've had a good hard look in the forums, and all over the internet, couldn't find anything about this.

    Basically, I need to be able to let a user put in a value into an Input box, and have flash turn it into a variable, and be able to use that as a property, for lets say, line thickness.

    Example:

    -User writes 3 into the text box. (input box's Instance name is line_thickness)

    -The movie is one frame, so apon enter frame, flash sees it, and turns that "3" into a variable.
    PHP Code:
    var myline_thickness:String String(line_thickness); 
    -Further down the code, that variable is used.
    PHP Code:
    line.graphics.lineStyle(myline_thickness0xFFFFFF); 
    I've tried using an ouput box to see what flash sees the variable as, and it only says: [object TextField]

    I hope I've made it as clear as possible!
    Thanks in advance to any replies!
    Last edited by raven3962; 02-08-2008 at 10:17 AM.

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    assuming the instance name of the text field is "line_thickness"
    code:

    var myline_thickness:Number = parseInt(line_thickness.text);

    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    Cool, thats that cleared up, just one more, what if i was wanting to use it for a color? (0xFFFFFF)

    Thanks for the quick reply!

  4. #4
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Quote Originally Posted by raven3962
    Cool, thats that cleared up, just one more, what if i was wanting to use it for a color? (0xFFFFFF)

    Thanks for the quick reply!
    can you be a bit clearer?
    What would you be looking for the user to input?
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  5. #5
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    The standard hex value, it would be used in the same way as the line thickness.

    so if the user put in 0xFF0000, then that is what flash would use to color the line.

    I think thats what u mean =)

  6. #6
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    Just found that it does that already! =D

    If you got time, can u tell me how to get it so you can put more than just a number in there? So people could put in something like:
    PHP Code:
    line.graphics.lineStyle (0xFF0000| (circlenum*<<8)); 

  7. #7
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    That last question is a lot bigger than you'd think. Previous versions of Actionscript had an eval method which would interpret a String as script. AS3 does not have such a method, so in order to implement such functionality you'd have to write your own mini-script parser, classes to represent all sorts of expressions and return values.

    I could be wrong about that, but I think it's a fairly large hole in the current AS3. Someone please correct me.

  8. #8
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25

    resolved

    Sounds like a helluva lot of work, if someone has the patience to step-by-step me through, then I'll listen, and listen hard, but it isn't that bigger deal.

    I'm working on flash music things at the moment, all reacts and stuff, I've added the customization things so far, the only ones that don't work are the speed ones. Need a bit of debugging. Let me know what you think if you decide to have a butchers!

    http://www.sof2badclan.net/ravenspec/custom_viz.html

    For now, I'll call this one resolved.

    Thanks for all that helped!

    *Update*
    Won't let me edit first post, ah well.

  9. #9
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It would be a helluva lot of work. I suggest avoiding it. Then again, I suggest that for most work.

  10. #10
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    heh, well I like doing this stuff, sense of acheivment n all, I'll probably try n figure out how to let people open their own track from their computer with it, but I guess thats along the same lines as the last thing I wanted right? Or is there an easy way of doing it?

  11. #11
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Actually, that would be along completely different lines, and probably easier.

    The big roadblock there is that flash won't let you open local files from the web, so you'd actually have to have them upload their track to your server (or any other server with appropriate crossdomain policy), then load it from there like any other file. It's a lot of work to go through to download a file you already have!

  12. #12
    Junior Member
    Join Date
    Jan 2008
    Location
    Somerset, UK
    Posts
    25
    Well, I could always make another version with the "Open File" ability, and make it a windows projector file, it isnt too big, no more than 3mb, and people would only need to download it once!
    So thats possible, I know a few people who would wanna try their own songs out on it!

    Do you have a link to learn how to do it? Or can someone quickly explain it here.

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