[flexcoders] Flex 3 RichTextEditor - move controlbar to top

2009-12-18 Thread Greg Lafrance
I want to move the controlbar of the RichTextEditor above the TextArea instead 
of the default of being below the TextArea.
 
I've been playing around with it as follows but I have a feeling I should not 
do this in the updateDisplayList method.
 
Should I do it in the initialize method?
 
?xml version=1.0 encoding=utf-8?
mx:RichTextEditor xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:Script
![CDATA[
  import mx.controls.TextArea;
  import mx.core.UIComponent;
  
  override protected function updateDisplayList(unscaledWidth:Number, 
unscaledHeight:Number):void{
var txt:TextArea = TextArea(super.removeChild(textArea));
var cb:DisplayObject = DisplayObject(super.removeChild(this.controlBar 
as DisplayObject));
super.addChild(cb);
super.addChild(new TextArea());
super.updateDisplayList(unscaledWidth, unscaledHeight);
  }
]]
  /mx:Script
/mx:RichTextEditor

 
 
This doesn't work either:

 
 
?xml version=1.0 encoding=utf-8?
mx:RichTextEditor xmlns:mx=http://www.adobe.com/2006/mxml;
  creationComplete=setupUI();
  mx:Script
![CDATA[
  import mx.controls.TextArea;
  import mx.core.UIComponent;
  
  private function setupUI():void{
var taIndex:uint;
var cbIndex:uint;
for(var a:uint=0;athis.rawChildren.numChildren;a++){
  trace(this.rawChildren.getChildAt(a));
  if(a==2){
var disObj:DisplayObject = this.rawChildren.removeChildAt(a);
this.rawChildren.addChildAt(disObj, 1);
  }
}
trace(**);
for(var b:uint=0;bthis.rawChildren.numChildren;b++){
  trace(this.rawChildren.getChildAt(b));
}
  }
]]
  /mx:Script
/mx:RichTextEditor




re: [flexcoders] Flex 3 RichTextEditor - move controlbar to top

2009-12-18 Thread Wally Kolcz
Not sure if this helps, but I use this and it works at runtime.

?xml version=1.0 encoding=utf-8?
mx:RichTextEditor xmlns:mx=http://www.adobe.com/2006/mxml; width=100% 
height=100% initialize=init()
mx:Script
![CDATA[
import flash.display.DisplayObject;

public function init():void {
var displayObj:DisplayObject = this.toolbar;
this.toolbar.parent.removeChild(displayObj);
this.addChildAt(displayObj, 0);
}
]]
/mx:Script
/mx:RichTextEditor



From: Greg Lafrance glafra...@chikaradev.com
Sent: Friday, December 18, 2009 10:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 3 RichTextEditor - move controlbar to top

 







I want to move the controlbar of the RichTextEditor above the TextArea instead 
of the default of being below the TextArea.

I've been playing around with it as follows but I have a feeling I should not 
do this in the updateDisplayList method.

Should I do it in the initialize method?

?xml version=1.0 encoding=utf-8?
mx:RichTextEditor xmlns:mx=http://www.adobe.com/2006/mxml;
mx:Script
![CDATA[
import mx.controls.TextArea;
import mx.core.UIComponent;

override protected function updateDisplayList(unscaledWidth:Number, 
unscaledHeight:Number):void{
var txt:TextArea = TextArea(super.removeChild(textArea));
var cb:DisplayObject = DisplayObject(super.removeChild(this.controlBar as 
DisplayObject));
super.addChild(cb);
super.addChild(new TextArea());
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
]]
/mx:Script
/mx:RichTextEditor

This doesn't work either:

?xml version=1.0 encoding=utf-8?
mx:RichTextEditor xmlns:mx=http://www.adobe.com/2006/mxml;
creationComplete=setupUI();
mx:Script
![CDATA[
import mx.controls.TextArea;
import mx.core.UIComponent;

private function setupUI():void{
var taIndex:uint;
var cbIndex:uint;
for(var a:uint=0;athis.rawChildren.numChildren;a++){
trace(this.rawChildren.getChildAt(a));
if(a==2){
var disObj:DisplayObject = this.rawChildren.removeChildAt(a);
this.rawChildren.addChildAt(disObj, 1);
}
}
trace(**);
for(var b:uint=0;bthis.rawChildren.numChildren;b++){
trace(this.rawChildren.getChildAt(b));
}
}
]]
/mx:Script
/mx:RichTextEditor