Tried it in a seperate mxml file. As soon as the Text component is inside a repeater, it throws an error. Works fine when Text comp is not inside a repeater.
TextArea component always throws an error, repeater or not. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"> <mx:Script> <![CDATA[ import flash.text.StyleSheet; import mx.events.FlexEvent; // private var _stylesheet:StyleSheet; [Bindable] private var rep_arr:Array = [{id:0},{id:1}]; // private function repeaterEndHandler(evt:FlexEvent):void { this._stylesheet = new StyleSheet(); this._stylesheet.setStyle("p", {fontFamily:"Verdana", fontSize:10, color:"#996600"}); this._stylesheet.setStyle(".boldStyle", {fontWeight:"bold"}); var len:uint = _txt.length; for(var i:uint=0; i<len; i++) { _txt[i].styleSheet = _stylesheet; } } ]]> </mx:Script> <mx:Canvas width="100%" height="100%"> <mx:Panel width="200" height="300"> <mx:Repeater dataProvider="{rep_arr}" repeatEnd="repeaterEndHandler(event);"> <mx:Text id="_txt" width="100%" height="100"/> </mx:Repeater> </mx:Panel> </mx:Canvas> </mx:Application> regards, Muzak ----- Original Message ----- From: "Matt Chotin" <[EMAIL PROTECTED]> To: <flexcoders@yahoogroups.com> Sent: Monday, April 17, 2006 12:35 AM Subject: RE: [flexcoders] beta 2: possible styleSheet bug with Text and TextArea component > I've forwarded it on for bug checking > > -----Original Message----- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Muzak > Sent: Saturday, April 15, 2006 3:51 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] beta 2: possible styleSheet bug with Text and > TextArea component > > When setting a styleSheet of a Text or TextArea component I get the > following errors when assigning text to the htmlText property: > > IllegalOperationError: Error #2009: This method cannot be used on a text > field with a style sheet. > at mx.core::UITextField/validateNow() > at mx.core::UITextField/set text() > at mx.controls::Label/mx.controls:Label::commitProperties() > at mx.controls::Text/mx.controls:Text::commitProperties() > at mx.core::UIComponent/validateProperties() > at mx.managers::LayoutManager/validateProperties() > at mx.managers::LayoutManager/::doPhasedInstantiation() > at mx.core::UIComponent/::callLaterDispatcher2() > at mx.core::UIComponent/::callLaterDispatcher() > > IllegalOperationError: Error #2009: This method cannot be used on a text > field with a style sheet. > at mx.core::UITextField/validateNow() > at mx.core::UIComponent/::callLaterDispatcher2() > at mx.core::UIComponent/::callLaterDispatcher() > > In this case, <mx:Text> is inside a repeater component and the > stylesheet is applied when data is received from a webservice call. > > import flash.text.StyleSheet; > // > private var article_ss:StyleSheet; > private function initBlogPanel():void { > this.article_ss = new StyleSheet(); > this.article_ss.setStyle("a", {color:"#99FF00"}); > } > > private function getBlogItemsResultHandler(evt:ResultEvent):void { > var result:ArrayCollection = new ArrayCollection(evt.result as > Array); > // note: at this time, the repeater has already executed > // loop through recordset and assign stylesheet to text > var len:uint = result.length; > var _txt:Text; > for(var i:uint = 0; i<len ;i++) { > _txt = articleText_txt[i]; > _txt.styleSheet = this.article_ss; > } > } > > <mx:Repeater id="blog_rep" > width="100%" height="100%" > dataProvider="{blog_ws.getBlogItems.result}" > repeatEnd="blogRepRepeatEndHandler(event);"> > <mx:Text id="articleText_txt" width="100%" > htmlText="{blog_rep.currentItem.BLOGSHORTTEXT}"/> > </mx:Repeater> > > > I also noticed that the repeaterEnd event (of the Repeater component) is > triggered *before* the result event of the webservice > method call. > That doesn't seem right to me. I'd expect the result event to be invoked > before the repeater executes. > > regards, > Muzak > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/