actionscript 3 - Invisible height in Flash's CheckBox when used in a ScrollPane for auto-calculation of height -
when using fl.controls.checkbox
inside fl.controls.scrollpane
, seems whenever last item in scrollpane's children container checkbox
, scrollpane
's update()
method leaves significant blank space below checkbox, although set size of checkbox.
question: how remove invisible height checkbox?
i've researched in many places , found useful post awesome person in link below. credits goes him, infineon. can't trace flash support forum referring though.
http://www.actionscript.org/forums/showpost.php3?p=842806&postcount=6
the solution above invisible height problem hard find dig of flash as3 documentation doesn't turn override protected function configui():void
method easily. @ least haven't found till now, , never have known either without kind of prior knowledge inner workings.
*note:* solution doesn't work on checkbox
. other form ui widgets fl.controls.radiobutton
works same way.
as noted below, because of package hard-coding width , height of rectangle in super class of widget. need override invisible rectangle becomes smaller or editable.
i reproduce code verbatim here prevent link rot:
package com.your.package.here { import fl.controls.checkbox; import flash.display.displayobject; import flash.display.graphics; import flash.display.shape; import flash.text.textfieldautosize; public class widgetcheckbox extends checkbox { public function widgetcheckbox() { } override protected function configui():void { super.configui(); // remove background movie clip added in superclass removechild(background); // redraw hit area of checkbox component var bg:shape = new shape(); var g:graphics = bg.graphics; g.beginfill(0, 0); // draw background area using width , height of // component, instead of hardcoding these properties ( in // superclass width , height of rectangle 100 , 100 g.drawrect(0, 0, _width, _height); g.endfill(); background = bg displayobject; // add new background addchildat(background, 0); } override public function set label(value:string):void { super.label = value; // in superclass size of label textfield set // 100 100 px; instead of using these values, autosize // textfield every time new label set textfield.multiline = false; textfield.autosize = textfieldautosize.left; } } }
then need import new class have extended:
var checkbox:widgetcheckbox = new widgetcheckbox();
hope helps people relieve head-scratching.
Comments
Post a Comment