actionscript 3 - Fix the label width on text length increase -
i have label, textinput , button. on button click text of textinput assign text of label. width of label 50.
but if textinput length greater 8 label appears below image
objective:- want output below image
and code looks
<?xml version="1.0" encoding="utf-8"?> <s:windowedapplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="200"> <fx:declarations> </fx:declarations> <fx:script> <![cdata[ import com.greensock.tweenlite; import com.greensock.tweenmax; protected function btn_clickhandler(event:mouseevent):void { lbl.text = inputtxt.text; trace(lbl.text.length,lbl.width); if(lbl.text.length > 8) { //need code here..... } } ]]> </fx:script> <s:bordercontainer height="100%" width="100%" backgroundcolor="green" /> <s:hgroup gap="10"> <s:textinput id="inputtxt"/> <s:button id="btn" click="btn_clickhandler(event)"/> </s:hgroup> <s:label id="lbl" width="50" top="50"/> </s:windowedapplication>
i think maxdisplayedlines
you: http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/spark/components/supportclasses/textbase.html#maxdisplayedlines
it should automatically truncate text (add ... @ end). set 1.
Comments
Post a Comment