-
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_thickness, 0xFFFFFF);
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.
-
AKA [ Paul Bainbridge]
assuming the instance name of the text field is "line_thickness"
code:
var myline_thickness:Number = parseInt(line_thickness.text);
-
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!
-
AKA [ Paul Bainbridge]
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?
-
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 =)
-
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*2 <<8));
-
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.
-
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.
-
It would be a helluva lot of work. I suggest avoiding it. Then again, I suggest that for most work.
-
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?
-
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!
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|