Adobe Dreamweaver Forums



Last 10 THreads :         DIV in Table not working. (Last Post : Jay Jay - Replies : 12 - Views : 13 )           »          Library is missing names from splitter bar (Last Post : Mad Dog - Replies : 11 - Views : 12 )           »          pop up blocker jacking my login (Last Post : Jay Jay - Replies : 5 - Views : 6 )           »          Can Anyone Help With Sub Menus (Last Post : drafted - Replies : 7 - Views : 8 )           »          Why is this not working!!! (Last Post : Boxing Boom - Replies : 11 - Views : 12 )           »          CF8 Enterprise gives 500 errors (Last Post : BJFranz - Replies : 0 - Views : 1 )           »          cfimage error (Last Post : masoud_amen - Replies : 0 - Views : 1 )           »          Flash Controls Not Displaying in Embedded File (Last Post : QADesign - Replies : 4 - Views : 5 )           »          Scollbar theme (Last Post : vcorey - Replies : 0 - Views : 1 )           »          Scollbar theme (Last Post : vcorey - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-23-2008, 04:03 PM
Tschouba2
 
Posts: n/a
Diggs:
Default mx:Text autoSize?

Hi!

I have a mx:Text component with a specified width. On every change of the text
property in this Text component the height should be updated to fit the whole
text. How is that possible?
Anyone knows a work-around with other classes?


When I try following...
---------------------------
myText.text = "targettext, can grow multiline";
myText.height = myText.textHeight;
---------------------------
... the height property changes, however always too late (on the next
programmturn).

change="updateMyText()" in the .mxml also haven't worked.

Eventlistener on FlexEvent.DATA_CHANGE won't get called.

validateNow() haven't worked.


I'm very tired of this problem and hope, someone can help me.

mfg Tschouba



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-23-2008, 08:53 PM
myIP
 
Posts: n/a
Diggs:
Default Re: mx:Text autoSize?

The height of mx.controls.Text should be adjusted automatically when text is
assigned. If you assigned a function to the dataChange property, then that
will fire off an event (FlexEvent.DATA_CHANGE) to that assigned function when
the *data* property of Text gets assigned a value. The data property takes an
Object type for its value.

Reply With Quote
  #3 (permalink)  
Old 11-24-2008, 11:43 AM
Tschouba2
 
Posts: n/a
Diggs:
Default Re: mx:Text autoSize?

Thanks for your reply!

The height of the mx.controls.Text gets only adjusted automatically, when I
set the text property in the .mxml file on initialize (<mx:Text text="myText"
/>).
But I want to change the text dynamically while the program flow with
myText.text="myNewText". Then the height should be adjusted to fit the whole
new text.

Can I use the data property to display the text?

Reply With Quote


  #4 (permalink)  
Old 11-24-2008, 08:02 PM
myIP
 
Posts: n/a
Diggs:
Default Re: mx:Text autoSize?

The data property is designed to be used when a Text instance is implemented as
an item render or for data binding. So as always when troubleshooting, limit
the amount of variables to the equation.

Below is a minimalist example of a Text instance that will get its height
adjusted when a Button is clicked.

Does this help?

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[

import mx.events.FlexEvent;

private function buttonClickHandler(event:MouseEvent):void
{
text1.text = "Hello World...Lorem ipsum dolor sit amet, " +
"consectetur adipisicing elit, sed do eiusmod tempor " +
"incididunt ut labore et dolore magna aliqua.";
}
]]>
</mx:Script>
<mx:Text id="text1" x="323" y="157" text="Hello World" width="156"
opaqueBackground="0x00ff00"/>
<mx:Button id="button1" x="368.5" y="264" label="Button"
click="buttonClickHandler(event)"/>
</mx:Application>

Reply With Quote
  #5 (permalink)  
Old 11-25-2008, 11:03 AM
Tschouba2
 
Posts: n/a
Diggs:
Default Re: mx:Text autoSize?

You're right, the height gets adjusted automatically in your example.
However, in my target programm it wasn't so, althougt it was the same
text-component-code as in yours.

So again I tried around and finally I found my error: At the canvas tag
autoLayout was set to false. Because of that the height of the text inside
wasn't adjusted automatically.
autoLayout="true" --> all works fine

Thanks for your help, myIP!

Greets, Tschouba

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:01 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk