The pure as code Drawing Method of microui can make FLASH small, but the first version is not flexible enough. Each set of skin needs to be re-implemented by itself.
The new version wants to be more flexible and provides custom options for Corner, shadow, edge, gradient effect, and other style details. This may remove the skin function and add the style sheet function.
A prototype project was created in the evening to verify the feasibility. A pure code drawing and a imitation thunder skin Download button were used.
Comparison of results is as follows:
Comparison of new and old drawing codes:
Microui 0.1 |
New Drawing code |
|
|
The complete code is as follows:
Package {import flash. geom. matrix; import flash. text. textfield; import flash. text. textfieldautosize; import flash. filters. dropshadowfilter; import flash. display. sprite; import flash. display. movieclip; import flash. display. gradienttype;/*** a prototype for microui ** @ author bg5sbk * @ link www.microui.org */public class microui_prototype extends sprite {public function microui_prototype () {var matrix: matrix = new matrix (); var button: movieclip = new movieclip (); // the outter bordermatrix. creategradientbox (80, 23, math. PI/2); button. graphics. begingradientfill (gradienttype. linear, [0x5bb5d8, 0x278fc6], [1, 1], [0,255], matrix); button. graphics. drawroundrect (0, 0, 80, 24, 8, 8); button. graphics. endfill (); // The inner bordermatrix. creategradientbox (78, 21, math. PI/2); button. graphics. begingradientfill (gradienttype. linear, [0x60c8f1, 0x5aafe7], [1, 1], [0,255], matrix); button. graphics. drawroundrect (1, 1, 78, 22, 6, 6); button. graphics. endfill (); // The backgroundmatrix. creategradientbox (76, 19, math. PI/2); button. graphics. begingradientfill (gradienttype. linear, [0x44bdee, 0x329ade], [1, 1], [32,255], matrix); button. graphics. drawroundrect (2, 2, 76, 20, 4, 4); button. graphics. endfill (); // The textvar text: textfield = new textfield (); text. textcolor = 0 xffffff; text. TEXT = "Download skin"; text. selectable = false; text. mouseenabled = false; text. mousewheelenabled = false; text. autosize = textfieldautosize. center; text. X = (button. width-text. width)/2; text. y = (button. height-text. height)/2; button. addchild (text); // The shadowvar shadow: dropshadowfilter = new dropshadowfilter (1, 90, 0xa7bcd6, 1, 2, 2); button. filters = [shadow]; button. X = (stage. stagewidth-button. width)/2; button. y = (stage. stageheight-button. height)/2; addchild (button );}}}