
{"id":430,"date":"2008-07-16T11:04:27","date_gmt":"2008-07-16T10:04:27","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=430"},"modified":"2010-09-16T12:37:51","modified_gmt":"2010-09-16T11:37:51","slug":"lite-components-from-bit-101-minimalcomps","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2008\/07\/16\/lite-components-from-bit-101-minimalcomps\/","title":{"rendered":"Lite components from BIT-101: Minimalcomps"},"content":{"rendered":"<div class=\"update\"><strong>Update #1:<\/strong> there has been another update <a href=\"http:\/\/www.bit-101.com\/blog\/?p=1703\">New MinimalComp: WheelNav<\/a>, but I&#8217;m pretty sure I won&#8217;t been using this one very much&#8230;<\/div>\n<p>I&#8217;m using this for some time now, and it&#8217;s time to share this with you all: Minimalcomps from <a href=\"http:\/\/www.bit-101.com\/blog\/\">BIT-101<\/a>.<\/p>\n<p>This lite-weight components set is great, I can see what the code is doing, it&#8217;s easy to use and its simplicity is beautiful (and I love pixel font in Flash, I should use it more). <\/p>\n<blockquote><p>\nMinimal ActionScript 3.0 code only UI components\n<\/p><\/blockquote>\n<p>Do you need some reading material? Some documentation and introduction can be found on Keith Peters (BIT-101) site: <a href=\"http:\/\/www.bit-101.com\/blog\/?p=1126\">read the first post about the Minimalcomps<\/a>.<\/p>\n<p>But in short:<br \/>\nThis are some of the examples (since the first post there are some <a href=\"http:\/\/www.bit-101.com\/blog\/?p=1217\">new components<\/a> created, but they are not as frequently used as this set);<\/p>\n<div class=\"flash\">[swf]http:\/\/www.bit-101.com\/minimalcomps\/ComponentPlayground.swf, 500, 500[\/swf]<\/div>\n<p>For lazy readers (and a reminder for myself: the site of BIT-101 doesn&#8217;t have a very useful search, and the google code page doesn&#8217;t have documentation), here some code to <strike>create what you see above<\/strike> not entirely true, but I will keep the code here:<br \/>\n[as collapse=&#8221;true&#8221;]<br \/>\nvar panel:Panel = new Panel(this, stage.stageWidth \/ 4, stage.stageHeight \/ 8);<br \/>\npanel.setSize(stage.stageWidth \/ 2, stage.stageHeight * 3 \/ 4);<\/p>\n<p>var checkBox:CheckBox = new CheckBox(panel, 20, 20);<br \/>\ncheckBox.label = &amp;quot;Check it out!&amp;quot;;<\/p>\n<p>var label:Label = new Label(panel, 20, 40);<br \/>\nlabel.text = &amp;quot;This is a label&amp;quot;;<\/p>\n<p>var pushbutton:PushButton = new PushButton(panel, 20, 60);<br \/>\npushbutton.label = &amp;quot;Push Me!&amp;quot;;<br \/>\npushbutton.width = 100;<\/p>\n<p>var hSlider:HSlider = new HSlider(panel, 20, 90);<br \/>\nvar vSlider:VSlider = new VSlider(panel, 130, 20);<\/p>\n<p>var inputText:InputText = new InputText(panel, 20, 110);<br \/>\ninputText.text = &amp;quot;Input Text&amp;quot;;<\/p>\n<p>var _progressBar:ProgressBar = new ProgressBar(panel, 20, 140);<\/p>\n<p>var radio1:RadioButton = new RadioButton(panel, 20, 160);<br \/>\nradio1.label = &amp;quot;Choice 1&amp;quot;;<br \/>\nvar radio2:RadioButton = new RadioButton(panel, 20, 180);<br \/>\nradio2.label = &amp;quot;Choice 2&amp;quot;;<br \/>\nvar radio3:RadioButton = new RadioButton(panel, 20, 200);<br \/>\nradio3.label = &amp;quot;Choice 3&amp;quot;;<\/p>\n<p>var colorchooser:ColorChooser = new ColorChooser(panel, 20, 230);<br \/>\ncolorchooser.value = 0xff0000;<br \/>\n[\/as]<\/p>\n<p>This is the code you want to use, to create all the components (minus wheelnav&#8230; ) in a document class.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/minimalcomponents_collection.gif\" alt=\"MinimalComps collection\" title=\"MinimalComps collection\" width=\"436\" height=\"325\" class=\"alignnone size-full wp-image-984\" \/><br \/>\n[as]<br \/>\npackage<br \/>\n{<br \/>\n\timport com.bit101.components.*;<br \/>\n\timport flash.display.*;<br \/>\n\timport flash.events.*;<\/p>\n<p>\t\/**<br \/>\n\t * @author Matthijs Kamstra aka [mck]<br \/>\n\t *\/<br \/>\n\tpublic class MainCube extends MovieClip<br \/>\n\t{<\/p>\n<p>\t\tpublic function MainCube():void<br \/>\n\t\t{<br \/>\n\t\t\ttrace( &amp;quot;MainCube.MainCube&amp;quot; );<\/p>\n<p>\t\t\tvar panel:Panel = new Panel(this, 20, 20);<br \/>\n\t\t\tpanel.setSize(stage.stageWidth * .75, stage.stageHeight * .75);<\/p>\n<p>\t\t\tvar _CheckBox:CheckBox = new CheckBox(panel, 20, 20, &amp;quot;Check it out!&amp;quot;);<\/p>\n<p>\t\t\tvar _Label:Label = new Label(panel, 20, 40, &amp;quot;This is a label&amp;quot;);<\/p>\n<p>\t\t\tvar _PushButton:PushButton = new PushButton(panel, 20, 60, &amp;quot;Push Me!&amp;quot;);<br \/>\n\t\t\t_PushButton.width = 100;<\/p>\n<p>\t\t\tvar _HSlider:HSlider = new HSlider(panel, 20, 90);<br \/>\n\t\t\tvar _VSlider:VSlider = new VSlider(panel, 130, 20);<\/p>\n<p>\t\t\tvar _VUISlider:VUISlider = new VUISlider(panel, 150, 20, &#8216;VUISlider&#8217;);<br \/>\n\t\t\t_VUISlider.value = 55.5;<br \/>\n\t\t\tvar _HUISlider:HUISlider = new HUISlider (panel, 20, 260, &#8216;HUISlider&#8217;);<\/p>\n<p>\t\t\tvar _InputText:InputText = new InputText(panel, 20, 110, &amp;quot;Input Text&amp;quot;);<\/p>\n<p>\t\t\tvar _ProgressBar:ProgressBar = new ProgressBar(panel, 20, 140);<br \/>\n\t\t\t\/\/trace( &amp;quot;_ProgressBar.maximum : &amp;quot; + _ProgressBar.maximum );<br \/>\n\t\t\t_ProgressBar.value = .75;<\/p>\n<p>\t\t\tvar radio1:RadioButton = new RadioButton(panel, 20, 160, &amp;quot;Choice 1&amp;quot;, true);<br \/>\n\t\t\tvar radio2:RadioButton = new RadioButton(panel, 20, 180, &amp;quot;Choice 2&amp;quot;);<br \/>\n\t\t\tvar radio3:RadioButton = new RadioButton(panel, 20, 200, &amp;quot;Choice 3&amp;quot;);<\/p>\n<p>\t\t\tvar _ColorChooser:ColorChooser = new ColorChooser(panel, 20, 230, 0xff0000);<\/p>\n<p>\t\t\tvar _IndicatorLight:IndicatorLight = new IndicatorLight (panel, 250, 20, 0xff00ff, &amp;quot;IndicatorLight&amp;quot;);<\/p>\n<p>\t\t\tvar _Knob:Knob = new Knob (panel, 350, 20, &amp;quot;Knob&amp;quot;);<\/p>\n<p>\t\t\tvar _Meter:Meter = new Meter (panel, 200, 100, &amp;quot;Meter&amp;quot;);<\/p>\n<p>\t\t\tvar _RotarySelector:RotarySelector = new RotarySelector (panel, 270, 220, &amp;quot;RotarySelector&amp;quot;);<\/p>\n<p>\t\t\tvar _Text:Text = new Text (panel, 80, 170, &amp;quot;Text what ever you want to place in here&amp;quot;);<br \/>\n\t\t\t_Text.setSize (100, 50);<\/p>\n<p>\t\t}<\/p>\n<p>\t} \/\/ end class<\/p>\n<p>} \/\/ end package<br \/>\n[\/as]<\/p>\n<p>And it quite easy to create buttons:<br \/>\n[as]<br \/>\nvar myButton:PushButton = new PushButton(this, 10, 20, onClick);<br \/>\nfunction onClick (e:Event){<br \/>\n      trace (&#8216;onClick&#8217;);<br \/>\n     \/\/ do something else<br \/>\n}<br \/>\n[\/as]<\/p>\n<p>You can download the MinimalComps set at: <a href=\"http:\/\/code.google.com\/p\/minimalcomps\/\">http:\/\/code.google.com\/p\/minimalcomps\/<\/a><br \/>\nThe set includes a CheckBox, PushButton, HSlider, VSlider, InputText, ProgressBar, RadioButton, ColorChooser (text input only) and Panel.<\/p>\n<div class='highlight'><strong>One big fat tip from me:<\/strong><br \/>\nin the zip you will find a folder named &#8216;assets&#8217; and in there is a truetype font called &#8216;<a href=\"http:\/\/p.yusukekamiyamane.com\/fonts\/\">pf_ronda_seven.ttf<\/a>&#8216;. You need to install that on your computer (Windows: C:\\WINDOWS\\Fonts , Apple: ??) <strong>and<\/strong> add it to your Flash file.\n<\/div>\n<h3>How to add a font to the Flash Library<\/h3>\n<p>Goto your library, add a &#8220;New Font&#8221;<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/minimalcomps_library_newfont.jpg\" alt=\"Library add New Font\" title=\"Minimalcomps library newfont\" width=\"430\" height=\"486\" class=\"alignnone size-full wp-image-432\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/minimalcomps_library_newfont.jpg 430w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/minimalcomps_library_newfont-265x300.jpg 265w\" sizes=\"auto, (max-width: 430px) 100vw, 430px\" \/><br \/>\n<em>(sorry for the strange looking Flash, it has something to do with my screenshot programm)<\/em><\/p>\n<p><strong>Name:<\/strong> &#8220;PF Ronda Seven&#8221; (you need to spell this exactly as here, without the quotes (&#8220;))<br \/>\n<strong>Font:<\/strong> search for &#8220;PF Ronda Seven&#8221;, if you can&#8217;t find it, you probably need to restart Flash.<br \/>\n<strong>Size:<\/strong> 10<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/font_symbol_properties_pf_ronda_seven.jpg\" alt=\"Font Symbol screen\" title=\"Font Symbol properties for PF Ronda Seven\" width=\"433\" height=\"155\" class=\"alignnone size-full wp-image-431\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/font_symbol_properties_pf_ronda_seven.jpg 433w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/font_symbol_properties_pf_ronda_seven-300x107.jpg 300w\" sizes=\"auto, (max-width: 433px) 100vw, 433px\" \/><br \/>\n<em>(use this screenshot as an example if you don&#8217;t know what I mean)<\/em><\/p>\n<p>You need to embed the font from the library into the .FLA : search the font you just created in the library and Right Click >> choose Linkage. Just check &#8220;Export for Actionscript&#8221; (&#8220;Export in first frame&#8221; will be activated to). I didn&#8217;t change anything, press &#8220;OK&#8221;<br \/>\n<a href='http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/linkage_properties_font.png'><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/linkage_properties_font.png\" alt=\"\" title=\"Linkage properties for font\" width=\"447\" height=\"231\" class=\"alignnone size-full wp-image-447\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/linkage_properties_font.png 447w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/linkage_properties_font-300x155.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><\/p>\n<p>and you done!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update #1: there has been another update New MinimalComp: WheelNav, but I&#8217;m pretty sure I won&#8217;t been using this one very much&#8230; I&#8217;m using this for some time now, and it&#8217;s time to share this with you all: Minimalcomps from BIT-101. This lite-weight components set is great, I can see what the code is doing, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3,6],"tags":[68,51,398,171,170,169],"class_list":["post-430","post","type-post","status-publish","format-standard","hentry","category-as3","category-flash","category-open-source-freeware","tag-actionscript","tag-download","tag-flash","tag-keith-peters","tag-minimalcomps","tag-ui-components"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=430"}],"version-history":[{"count":4,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/430\/revisions"}],"predecessor-version":[{"id":1588,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/430\/revisions\/1588"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}