Link to home
Start Free TrialLog in
Avatar of srujanmiryala
srujanmiryalaFlag for India

asked on

Flex Autoscrolling textComponent

Hello All,

I am working on autoscrolling of text . when the application is loaded the component gets the data from xml file using http service.
i need to make the text which is displayed in the autoscrolling component as multiline.
Right now i did not given any width for the autoscroll component. when i mention width property i am unable to see the complete text.i need to make this text to multiline or wordwrap when i fix the width property .

how to achive this .
ScrollingData.txt
ScrollingData.txt
test.xml
Avatar of mah8473
mah8473

You attached ScrollingData twice, rather than the 2nd attachement being your scrollingText component.

On the assumption that your scrollingText component extends Text, you should know that Text class extends the Label class which supports single line text only.

Ii suggest you look at using the mx.core.UIFieldText class that supports mulit-line text and scrolling

I had a similiar issue where I was trying to add mulitline text to Checkbox labels, obviously the label only supports sinlge line text...attached is the custom class I wrote to get around the issue....it might help

Alternatively update the code samples you attached so I can have a look at the ScrollingText component.
package com.common.controls
{
	import mx.controls.CheckBox;
	import mx.core.UITextField;
	import flash.text.TextFieldAutoSize;

	import flash.display.DisplayObject;
	
	public class ANZMultilineCheckbox extends CheckBox
	{
		public function ANZMultilineCheckbox()
		{
			super();
		}

		override protected function createChildren():void{
			// Create a UITextField to display the label.
			if (!textField)	{
				textField = new UITextField();
				textField.styleName = this;
				addChild(DisplayObject(textField));
			}
			super.createChildren();
			textField.multiline = true;
			textField.wordWrap = true;
			textField.autoSize = TextFieldAutoSize.LEFT;
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			textField.width = 795;
		}
		
		override public function get measuredWidth():Number {
	        validateNow();
	        return textField.width + 10;
		}
		
	}
}

Open in new window

Avatar of srujanmiryala

ASKER

Attached Scrolling text Component
ScrollingText.txt
ASKER CERTIFIED SOLUTION
Avatar of mah8473
mah8473

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will do that and let you know the result
Hey man8473,

Thanks for the help.
Now i am using UITextField in  place of Text. it is working fine.
awesome, glad I could help....