4 Replies Latest reply on Apr 28, 2009 1:38 PM by Budd Tugly

    feeding data to colorPicker inside RichTextEditor

    Budd Tugly

      Hello all,
      new to the forum, kinda new to Flex. I have searched the forums, but cannot find anything related to my problem, so here goes:

      I have a RTE and I want to use the colorpicker subcontrol, but I need to load the color names and hex values from a data provider. I have this process working with a plain ol' colorPicker (just to test it), but I cannot get the colorPicker within the RTE to accept data.

      My data comes in a s XML from a PHP page, and is set to an ArrayCollection. With the standard colorPicker I can just set the dataProvider to the name of my ArrayCollection and it works dandy. But with the picker inside the RTE I get nothing. How can I accomplish getting this data to the RTE colorPicker? Thanks.

        • 1. Re: feeding data to colorPicker inside RichTextEditor
          Gregory Lafrance Level 6

          myRTE.colorPicker.dataProvider = myArrayColl;

          • 2. Re: feeding data to colorPicker inside RichTextEditor
            Budd Tugly Level 1

            Thanks.

             

            Yep, that's what I thought as well. but no luck. I get standard hex values populated into the colorPicker. this colorpicker  is inside a TabNavigator. Do I need to target it as such? I ask because I have a function to remove unneeded buttons from my RTE which states:

            myRTE.toolbar.removeChildAt(0);

             

            and it works fine. I do not need to specify it as myTabNavigator.myCanvas.myRTE.toolbar.removeChildAt(0);

            • 3. Re: feeding data to colorPicker inside RichTextEditor
              Gregory Lafrance Level 6

              Can you post your code to create and set the colorpicker, and the colection?

              • 4. Re: feeding data to colorPicker inside RichTextEditor
                Budd Tugly Level 1

                Okay, my data is formated thusly:

                 

                 

                <root>
                     <item>
                          <label>185 Red</label>
                          <color>0xee3a43</color>
                     </item>
                     <item>
                          <label>186 Red</label>
                          <color>0xe51937</color>
                     </item>
                     <item>
                          <label>199 Red</label>
                          <color>0xed174f</color>
                     </item>
                ...
                </root>

                 

                 

                 

                 

                Here is my code to retrieve the data via HTTPService:

                 

                 

                [Bindable]

                private var myInk:ArrayCollection;

                 

                private function getInkData() :void

                {

                var inkparams:Object;

                myInkService.send(inkparams);

                }

                 

                private function inkresultHandler(event:ResultEvent):void

                {

                myInk = event.result.root.item as ArrayCollection;

                }

                 

                 

                 

                Which set the data to an ArrayCollection named myInk. And this works fine with my colorpicker:

                 

                 

                <mx:ColorPicker x="298" y="445" dataProvider="{myInk}"/>

                 

                 

                BUt when I try to format the RTE ("textInputBox") with the following function (called upon RTE creationComplete)

                 

                 

                public function formatRtfBox():void

                    {

                    textInputBox.toolbar.removeChildAt(2);

                    textInputBox.toolbar.removeChildAt(3);

                    textInputBox.toolbar.removeChildAt(4);

                    textInputBox.toolbar.removeChildAt(5);

                    textInputBox.toolbar.removeChildAt(10);

                    textInputBox.toolbar.removeChildAt(11);

                    textInputBox.colorPicker.dataProvider = myInk;

                    }

                 

                 

                 

                no dice.

                 

                I hope I didn't leave anything out.