0 Replies Latest reply on Aug 28, 2007 3:32 AM by irie7even

    dataBinding troubles

    irie7even
      hi!

      I am trying to create an application where you can easily change text in a textarea. when the user clicks on a textarea field a richtexteditor appears and he/she should be able to edit the text.
      the text typed in the editor should show up in the textarea automatically. the dataBinding doesn't work right.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" initialize="initBinding()">

      <mx:Script>
      <![CDATA[

      import flash.events.MouseEvent;
      import mx.events.CloseEvent;
      import mx.controls.RichTextEditor;
      import mx.containers.TitleWindow;
      import mx.managers.PopUpManager;
      import mx.binding.utils.BindingUtils;
      import mx.controls.TextArea;
      import mx.events.CloseEvent;
      //import mx.binding.utils.ChangeWatcher;

      //private var _changeWatcher:ChangeWatcher;


      public function initBinding():void {
      BindingUtils.bindProperty(TextArea, "text", RichTextEditor, "text");
      }




      private var _window:TitleWindow;

      private function newtextbox(event:MouseEvent):void
      {
      var eingabeText:TextArea = new TextArea();
      eingabeText.height=100;
      eingabeText.width=150;
      eingabeText.id="meinText";
      //eingabeText.htmlText=texteditor;
      eingabeText.visible=true;
      eingabeText.addEventListener(MouseEvent.CLICK, showWindow);
      addChild(eingabeText);

      //eingabeText.htmlText="
      }

      private function showWindow(event:MouseEvent):void {

      var texteditor:RichTextEditor = new RichTextEditor();
      texteditor.id="texteditor";
      texteditor.height=250;
      texteditor.width=300;
      _window = TitleWindow(PopUpManager.createPopUp(this, TitleWindow));
      _window.addChild(texteditor);
      _window.showCloseButton = true;
      _window.addEventListener(CloseEvent.CLOSE, closeHandler);

      }

      private function closeHandler(event:CloseEvent):void {

      PopUpManager.removePopUp(_window);

      }


      ]]>
      </mx:Script>

      <mx:Button id="textclose" x="520" y="324" label="ok" width="33" click="newtextbox(event)" />
      <!--<mx:Button id="test2" x="520" y="324" label="test" width="33" click="BindingUtils.bindProperty(meinText, 'htmltext', texteditor, 'htmltext')" />-->

      </mx:Application>

      I would be glad if anybody can help me out of this.

      thanks.