Original quote: http://blog.soulwire.co.uk/code/actionscript-3/simple-flash-prototype-gui-tool#more-1242
A simple flash GUI tool
+Code: AS3 prototypes with the smallest and fastest comparison
Update: Keith himself has been working on similar ideas and releasing Minimalconfigurator .
Keith Peter's Smallest component any flash developer is a very good tool when adding a real-time configuration swf. I found myself using them in my demos and prototypes but with many edit sketch parameters it is still a hassle to write boilerplate code to set up and schedule components, as well as add appropriate event handlers.
inspired by such openframeworks GUI tools Ofxsimpleguitoo and the Ofxtweakbar , ControlP5 processing, I think it is time to have a project with the same quick and easy use of GUI tools Flash AS3.
introduction of Simplegui
The Simplegui AS3 Project is a class-practical program that developers need to quickly add UI control variables or functions to a sketch. The Simplegui property can control only one line of code using the smallest comparison set of various wonderful components , and the custom component is written as Filechooser .
Simplegui currently exposes the following methods, and the open AddControl method can pass any class definition:
- AddColumn : Start a new column component
- AddGroup : Start a component of a new group
- AddLabel : Add a text box label or description
- Addtoggle : Add a check box for a Boolean value
- AddButton : Add a button trigger callback
- Addslider : Create a Slider value
- AddRange : Create a slider two range of values
- Addstepper : Slider number for another component
- Addcolour : Add a color selector as an integer
- Addcombobox : Add a drop-down ListBox box to any object
- Addfilechooser : Allow user to load data
- Addsavebutton : How this trigger generated code is saved
Other features include:
- Hotkey : Show/Hide Assign hotkey GUI
- Context menus from context menu items: switching GUI
- Message : The message in the Pulse toolbar is given to the user
- Show Toggle : Toggle Hidden when GUI is displayed
- Save Settings : Generate AS3 code to submit your current value
using Simplegui
Each method accepts an optional parameter Options , which is a simple dynamic object, you can pass any parameter to the corresponding component of the value, and Callback and the Callbackparams each time the component property triggers a change in the method.
For example, to create a slider to control a number, set its width, execute a callback, and display a custom label, you would write:
_gui.addslider ("MyNumber", 0, +, {label: "My number", width:200, callback:onnumberchanged});
Although it is possible to omit this parameter by customizing the label for each component, it causes variable name resolution and uses the label. For example, a variable "MyNumber" will generate the label "My Number" .
Simplegui also supports nested attributes, any depth, using the normal point syntax. So you can control the position of a particle by writing:
_gui.addslider ("Myparticle.position.x", 0, 1000);
the code here Demo above. There are only 27 lines of code to control the entire sketch.
_gui = new Simplegui (this, "Example gui", "C"); _gui.addgroup ("General Settings"); _gui.addcolour ("Backgroundcolour"); _ Gui.addbutton ("Randomise Circle Position", {callback:positioncircle, width:160}); _gui.addsavebutton (); _ Gui.addcolumn ("Noise Options"), _gui.addslider ("noisebase.x", "Ten,") _gui.addslider ("Noisebase.y", 10, 200); _ Gui.addslider ("Noiseseed", 1, +), _gui.addslider ("Noiseoctaves", 1, 4), _gui.addslider ("turbulence.x",-10, 10); _ Gui.addslider ("Turbulence.y", -10), _gui.addgroup ("Wave Options"), _gui.addstepper ("Wavecount", 1, 20); _ Gui.addstepper ("Wavesteps", 2, Max_wave_steps), _gui.addslider ("amplitude", 0, $), _gui.addcolour ("Wavecolour"); _ Gui.addcolumn ("Circle Options"); _gui.addrange ("Mincirclesize", "maxcirclesize", "ten," {label: "Circle Size Range"}) ; _gui.addslider ("Rotationspeed", -10), _gui.addcombobox ("Circle.blendmode", [{label: "Normal", Data: Blendmode.normal},{label: "Darken", Data:blendmode.darken},{label: "Overlay", Data:blendmode.overlay},{label: " Difference ", DAta:BlendMode.DIFFERENCE},]); _gui.addfilechooser ("Circle Texture", Texturefileref, textureloaded, [New FileFilter (" Image Files "," *.jpg;*.jpeg;*.png ")]); _gui.addtoggle (" animatecircle "); _gui.addcolumn (" Instructions: "); _ Gui.addlabel ("Press ' C ' to toggle GUI"); _gui.addlabel ("Press's ' to copy setup code to clipboard"); _gui.show ();
so Simpelgui is actually a time-saving developer who wants a quick prototyping thing in Flash, or with control release demo. The actual hard work has been completed Keith minimum comparison
You can browse Source Code or download Simplegui the following class. Simplegui is part of the soulwire AS3 framework .
Download:Simplegui
Easy Flash GUI tools (simple flash GUI tool)