I think the Text component is setting the text format of its TextField to correspond to the CSS styles set on the Text component. The inheriting CSS styles must be recomputed every time a component is reparented.
Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tchredeemed Sent: Tuesday, November 18, 2008 6:31 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: TextFormat being reset? I created a new Text class that extended Text. I then change the textField.defaultTextFormat and call textField.setTextFormat(). It works when I set it on creationComplete, but then when I remove and add the editor again (which cntains the new Text), it takes all the textFormat styles off. --- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, "Keith Reinfeld" <[EMAIL PROTECTED]> wrote: > > What TextField? > > > > Regards, > > -Keith > http://keithreinfeld.home.comcast.net > <http://keithreinfeld.home.comcast.net/> > > > _____ > > From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On > Behalf Of tchredeemed > Sent: Tuesday, November 18, 2008 8:17 AM > To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: TextFormat being reset? > > > > Anyone?? :) > > --- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com, > "tchredeemed" <apthorp@> wrote: > > > > I have created my own CanvasStack (to replace the viewstack) because > > viewstacks and models do not mix. > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Canvas > > xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml> > com/2006/mxml" > > creationComplete="initApp()" height="100%" > > horizontalScrollPolicy="off" verticalScrollPolicy="off" > > > > > > > <mx:Metadata> > > [Event(name="changeSelectedIndex",type="flash.events.Event")] > > </mx:Metadata> > > > > <mx:Script> > > <![CDATA[ > > import com.gladhandle.AppGlobals; > > import com.gladhandle.handles.greeting_card.gcassets.Editor; > > > > [Bindable] > > private var _selectedIndex:int; > > public var dataProvider:Array; > > private function initApp():void { > > _selectedIndex = 0; > > addChild( dataProvider[_selectedIndex] ); > > } > > > > public function set selectedIndex( selectedIndex:int ):void { > > if( selectedIndex < 0 || selectedIndex > dataProvider.length ) { > > throw new Error( "selectedIndex out of range" ); > > return; > > } > > _selectedIndex = selectedIndex; > > dispatchEvent( new Event( "changeSelectedIndex", false ) ); > > this.removeAllChildren(); > > this.addChild( dataProvider[_selectedIndex] ); > > } > > > > [Bindable] > > public function get selectedIndex():int { > > return _selectedIndex; > > } > > > > ]]> > > </mx:Script> > > </mx:Canvas> > > > > --------------------------------------- > > > > This dataprovider is populated with custom components as well. > > > > When I change the selected index, it removes all the children (but > > they still exist in the dataprovider, so 'session' data should be > > saved), but when I navigate back to an index I have already visited, > > everything is still there, EXCEPT for the format of the text, it for > > some reason, is reset back to the original text, even though I have > > setTextFormat() and set the defaultTextFormat on the TextField. > > > > Any ideas? > > >