Adobe Flex

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentAdobe Flex

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old July 27th, 2011, 09:57 AM
bon_t bon_t is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 25 bon_t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 51 m 26 sec
Reputation Power: 0
Img tag magically appears in htmlText of Halo TextArea component

Hi All,

I am using Flex 4, ActionScript 3.

I am using an AdvancedDataGrid in which one of the columns uses a custom itemRenderer that extends the Halo TextArea (I had to use the Halo component because I needed to automatically recalculate the height of the TextArea).

This column, Labels, is not editable from this grid. It gets populated with the selection from a pop-up dialog.

These are my requirements:
1. If there is no selection and hence the Labels cell is empty, I need to display an icon.
2. If there is a selection and hence the Labels cell is not empty, I need to display the selection and not the icon.

Here is the code from the custom TextArea component that handles these requirements.

Code:
override public function set text(val:String):void
{
	textField.htmlText = null;
	super.verticalScrollPolicy = "off";
				
	if ( val != " " )
	{
		// Need to split the string into an array for processing
		var arr:Array = val.split(",");
				
		// Parse the strings to see if an asterisk is at the beginning 
		for (var idx:int = 0; idx < arr.length; idx++)
		{
			var str:String = arr[idx];
			if (str.indexOf("*") > -1) 
				str = "<font color=\"#7A7A7A\">[" + str.substr( 1, str.length - 1 ) + "]</font><br/>";
			else 
				str = str + "<br/>";
			arr[idx] = str;
		}
				
		// Finally join the string back together...
		textField.htmlText = arr.join("");
	}
	else
	{
		textField.htmlText = "<img src='" + mx.utils.ObjectUtil.getClassInfo( iconWarning ).name + "'/>";
	}
				
	validateNow();
				
	// Set height of box to the height of the text + 1 line
	height = textField.textHeight +
		textField.getLineMetrics(0).height;
}


The issue is as follows:
1. This works for the first row that gets a selection, meaning the icon does not show up. Note that it doesn't matter which row in the grid gets the first selection.
2. For all selections after the first one, both the selection and the icon are displayed. Note that it doesn't matter if the second selection is for a row in the grid that comes before or after the row that got the first selection.

Debugging through the code, I am surprised to see the following (this is right after the textField.htmlText = arr.join("") assignment, and right before this assignment, textField.htmlText is null).

For the first selection:
arr = [] (@bbe7b29)
[0] = "miscellaneous-possible_rejects<br/>"
[1] = "vague-billing<br/>"
[2] = "vague-delivery<br/>"
length = 3

textField.htmlText = "<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0">miscellaneous-possible_rejects</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0">vague-billing</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0">vague-delivery</FONT></P></TEXTFORMAT>"

For the next selection:
arr = [] (@bda7859)
[0] = "activate-access_account_secure<br/>"
[1] = "request-contact<br/>"
[2] = "vague-order<br/>"
length = 3

textField.htmlText = "<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0"><IMG SRC="com.nuance.csportal.components.applicationDefiniti onComponents::ElasticTextArea_iconWarning">activate-access_account_secure</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0"><IMG SRC="com.nuance.csportal.components.applicationDefiniti onComponents::ElasticTextArea_iconWarning">request-contact</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Arial" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="0"><IMG SRC="com.nuance.csportal.components.applicationDefiniti onComponents::ElasticTextArea_iconWarning">vague-order</FONT></P></TEXTFORMAT>

As you can see, the <img> tag magically appeared 3 times in the htmlText!

Does anybody have any idea how I can fix this? Or perhaps another solution?
Thanks,
Bonnie

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentAdobe Flex > Img tag magically appears in htmlText of Halo TextArea component


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap