TextArea.htmlText ### newline pb

Hi
Im using a TextArea to display HTML text.
<mx:TextArea width="100%" height="100%"
htmlText="{data.text}" />
it contains :
<![CDATA[
something here
<li> one </li>
<li> two </li>
]]>
it seams to insert 2 new line between each <li> or \n
in the text !
Can you help me ?

I don't think it's a case of TextArea.htmlText not working so much as it's a case of there not being an htmlText property for the TextArea in AS2.  AS3 versions support it, but I believe in AS2 you need to specify the html property to be true and assign the text to the text property.
ta.html = true;
ta.text = "<b>your html text</b> here";

Similar Messages

  • Search text & highlight it in textarea htmltext

    Hello All,
    how to search perticular word in textarea htmltext? and how to highlight those all found word in textarea htmltext?
    i have tried many way but not perfectly implemented.
    any idea please....

    Tejas S Patel wrote:
    yes i have seen this.
    But its possible for static textarea contains.
    I am fatching data from database and display in textarea and then search & highlight them.
    I am confused for using this example.
    it is perfectly possible to link that example up to dynamic data instead, it just requires of bit of reading into it and understanding their code, and then a sit down and think for a few minutes of using the functions already created for you.
    i'm somewhat skeptical about spoon feeding an answer when 95% of the work has already been done and found for you, there's nothing to learn that way.
    personally i'd suggest going away and have a play with it for a while and try to get it working, if you still can't figure it out come back with what you've tried and i'd be more then happy to help you with it then

  • Flex TextArea HTMLText issue.

    Hi All,
             I am using a Flex textArea control and recently i found an interesting behaviour while using htmlText property of the TextArea.
    By default the htmlText has "<P align=''left' /> tag.When i added bullets to the text it adds the "<LI>" tag to the text and get rid of the the "<P/>" tag.
    The problem is that,when i add bullets and the right align the text,it displays fine on the textArea ,but since the htmlText does not have the "<P/>" tag,when i send the htmlText to the backend to generate the .jpg preview of the screen,it is not aligning the text to right.
    Bottom line:"when text right aligned with bullets,htmlText does not have "<P/>" tag and only have "<LI/>" tag.
    Does anyone know about this issue?
    Any ideas to overcome this issue?
    Thanks
    Kartik B

    Thanks for reply,
    i am taking htmlText from another textarea..
    code:
    var htmltext:String = txtarea.htmlText
    var textarea1:TextArea = new TextArea();
    textarea1.htmlText = htmltext;
    vboxName.addChildAt(textarea1,0);
    while tracing value of htmltext
    <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="11" COLOR="#000101"
    LETTERSPACING="0" KERNING="0">agenda descriptyion</FONT></P></TEXTFORMAT>
    <TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="11" COLOR="#000101"
    LETTERSPACING="0" KERNING="0">neethu<FONT FACE="none" COLOR="#FFFFFF"></FONT></FONT></LI></TEXTFORMAT>
    Regards,
    Manu Lal

  • TextArea + htmlText + image + last line = BOOOM !!!

    Hi all... I'm trying to implement a simple chat with smile. ( AS3 with Flash CS3, 9 )
    Here's a screen result ( with "msn smile" for test )
    Now my problem is that when i reach to the end line of the textarea ( or textarea changes its size ) if i try to insert another smile i get this exception and TextArea get mad and ugly!
    ArgumentError: Error #2025: Il valore fornito per DisplayObject deve essere un elemento secondario del chiamante.
        at flash.text::TextField/set htmlText()
        at fl.controls::TextArea/set htmlText()
    (Sorry for the italian language of the error text. It says that the value sent to DisplayObject must be a secondary element of the caller)
    If i try to insert simple text it work without problem.
    Here's the code:
                mReader.htmlText += "<font color=\"#0000FF\"><b>"+ user + " scrive :</b></font><br>";
                var obj:Object = checkForSmile( msg );
                if(obj.result == 0 )
                    mReader.htmlText += "<b>" + msg + "</b><br>";
                else if( obj.result != -1 )
                    mReader.htmlText += "<textformat leading=\"17\"><img src=\"" + obj.source + "\" width=\"19\" height=\"19\" hspace=\"0\" vspace=\"0\"/></textformat>";
                mReader.verticalScrollPosition = mReader.maxVerticalScrollPosition;
    This problem make me crazy... please someone ever had this problem ? or know how to avoid it ?

    Hi kglad.. Thanks for reply.
    I did it ( called invalidateRect() ) but it doesn't fix the problem.
    Another strange thing is that if i try to continue to insert smile it overwrite all the present smileys with this result:
    When i overwrite all the smileys... and continue to add them no others error happens... And the app seems to work properly :\ sob sob....

  • How to displaying an image inline in TextArea  ,htmlText

    Here My code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:TextArea id="myChat" width="271" height="238" backgroundColor="#ffffff" borderThickness="0" editable="false" enabled="true" horizontalScrollPolicy="off" wordWrap="true">
        <mx:htmlText>
        <![CDATA[
              test...<img src='close.png' height='15' width='15'/>test...
        ]]>                                     
        </mx:htmlText>
    </mx:TextArea>
    </mx:Application>
    Thanks in advanced...

    You can do in this way...
    <?xml version="1.0"?>
    <!-- textcontrols/ImgTagWithHyperlink.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" borderStyle="solid">
      <mx:TextArea width="100%" height="100%">
         <mx:htmlText>
            <![CDATA[
               <a href='http://www.adobe.com'><img src='../assets/butterfly.gif'/></a>
            ]]>
         </mx:htmlText>
      </mx:TextArea>
    </mx:Application>
    Hope you got my point!!!
    If this post answers your question or helps, please kindly mark it as such.

  • How to insert embedded image into TextArea htmlText (and add IOErrorEvent.IO_ERROR listener).

    I unsuccessfully tried to find way to insert embedded image into TextArea via <img> tag. Can you point me out how to do this?
    Also, please, tell me how to handle IOErrorEvent from TextArea because adding IOErrorEvent.IO_ERROR listener to TextArea doesn't cause any effect when image url of img tag has not been found.
    Thanks

    i 've successfully inserted the image into the database... here is my code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.io.File;
    import java.io.FileInputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class Browse_java
    static Connection con=null;
    public static void main(String args[])
    try{
    System.out.println("(browse.java) just entered in to the class");
    con = new PMS.DbConnection().getConnection();
    System.out.println("(browse.java) connection string is"+con);
    PreparedStatement ps = con.prepareStatement("INSERT INTO img_exp VALUES(?,?)");
    System.out.println("(browse.java) prepare statement object is"+ps);
    File file =new File("C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    FileInputStream fs = new FileInputStream(file);
    byte blob[]=new byte[(byte)file.length()];
    fs.read(blob);
    ps.setString(1,"C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    ps.setBytes(2, blob);
    System.out.println("(browse.java)length of picture is"+fs.available());
    int i = ps.executeUpdate();
    System.out.println("image inserted successfully"+i);
    catch(Exception e)
    e.printStackTrace();
    finally
    try {
    con.close();
    } catch (SQLException ex) {
    ex.printStackTrace();
    }

  • Using link event on textarea with right click

    I added 'event:' to the links in a textarea.htmlText because
    i need to be able to track when the link is clicked, but
    unfortunately this makes the link not work if they try to right
    click it to open it in a new window, it also doesn't track the
    click, the 'event:' shows in the new browser window url. Is the a
    way to disable rightclicking on links in a text area?

    Hey there,
    Make sure you have all the proper drivers installed for Boot Camp, which at this point you may have already done. Then below, is an article from Apple explaining how to right->click using BootCamp Windows. Hope this helps.
    http://docs.info.apple.com/article.html?path=BootCamp/2.0/en/bc1142.html
    B-rock

  • Identify the size of unwrapped text in TextArea

    Here is the deal.
    I have a popup of fixed width where I dynamically add the textAreas. The PercentWidth of textArea is 100.
    Once the long url (as my custom text) is added into the definite textArea.htmlText, the text is wrapped.
    What I need is: I'd like to dynamically widen the width of popup if any of textArea has a long text that is going outside the popup borders, so it would not wrap. So far I'd like to have the textArea.textWidth correctly returned, without any wrapping. But since the textArea has already been added as a child to the popup's stage, its size cannot be dynamically extended.
    If I simply set the textArea.width to, say, the width of popup, the textArea.textWidth is still the same small like before.
    I'm really stopped at this point. Please assist. Thanks.

    Which version of Flex?  If you don't want wrapping text, use Label

  • Clearing TextArea text

    Attached below is a code that creates a TextArea and is
    programmed to clear the TextArea if the "enter" key is pressed. It
    does not seem to work well. The code shows a button control using
    the exact same call, but it works on that. Can someone please shed
    some light on this. Cheers
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application name="TextAreaClearText" xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    verticalAlign="middle" backgroundColor="white">
    <mx:Script>
    <![CDATA[
    private function onKeyDown(e:KeyboardEvent):void{
    if (e.keyCode == Keyboard.ENTER){
    textArea.htmlText="";
    ]]>
    </mx:Script>
    <mx:Button label="Clear text"
    click="textArea.htmlText = '';" />
    <mx:TextArea id="textArea"
    textAlign="justify"
    width="10%"
    height="10%" keyDown="onKeyDown(event)"/>
    </mx:Application>

    I suspect the issue you are having is one of focus. The
    onKeyDown event is only triggered when you click enter AND have
    focus on the TextArea. You might want to add a more
    universally-triggered event like a keyDown on the application
    object. There's more info about this sort of thing here:
    http://livedocs.adobe.com/flex/3/html/events_11.html#254464
    hth,
    matt horn
    flex docs

  • Not able to see legends on Internet Explorer 8

    I have a Flex Application that works great in Internet Explorer 9 and Firefox. However with Internet Explorer it does not show the colors for the legends, just the values. Do you guys could give me any ideas what I need to change in my code so that IE 8 shows the legend colors? You can see on the image attached that the colors show correctly on the map but the legend does not show the colors for each values.! Thank you for any help!
    Here is the code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application       
                    xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:esri="http://www.esri.com/2008/ags"
                    paddingBottom="8" paddingLeft="8"
                    paddingRight="8" paddingTop="8"
                    backgroundColor="0xffffff"
                    layout="vertical" >
        <!-- Start Declarations -->
    <fx:Declarations>
            <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
                <esri:SimpleLineSymbol width="0" color="#000000"/>
            </esri:SimpleFillSymbol>
            <esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0"   >
                <esri:SimpleLineSymbol width="1" color="#000000"/>
            </esri:SimpleFillSymbol>
        <!-- End Declarations -->
    </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import com.esri.ags.Graphic;
                import com.esri.ags.SpatialReference;
                import com.esri.ags.events.GraphicEvent;
                import com.esri.ags.geometry.Extent;
                import com.esri.ags.layers.*;
                import com.esri.ags.symbols.SimpleFillSymbol;
                import com.esri.ags.symbols.SimpleLineSymbol;
                import mx.collections.ArrayCollection;
                import mx.controls.RadioButton;
                import mx.controls.TextArea;
                import mx.events.DropdownEvent;
                import mx.events.ItemClickEvent;
                private function closeHandler(evt:DropdownEvent):void
                try
                    myLabel.text = ComboBox(evt.target).selectedItem.label;
                catch(error:Error){
                    trace("Caught Error: "+error);
                private function loadLayerName():void
                    myLegend.layers = null;
                    layerPanel.removeAllChildren();
                    //loop through each layer and add as a radiobutton
                    for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
                        var radioBtn:RadioButton = new RadioButton;
                        radioBtn.groupName = "radioBtnGroup";
                        radioBtn.value = i;
                        radioBtn.label = dynamicLayer.layerInfos[i].name;
                        if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
                            radioBtn.label = "Direct Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
                        {radioBtn.label = "Direct Impact";
                        else
                        {radioBtn.visible= false;
                        layerPanel.addChild(radioBtn);
                    /*     myDividerBox.getDividerAt(0).visible = false; */
                    //set the visible layer the first radio button
                     radioBtnGroup.selectedValue = 0;
                     dynamicLayer.visibleLayers = new ArrayCollection([0]);
                    myLegend.layers = [dynamicLayer];
                    myLegend.visible = true;
                private function radioClickHandler(event:ItemClickEvent):void
                    myLegend.layers = null;
                    // update the visible layers to only show the layer selected
                    dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
                    myLegend.layers = [dynamicLayer];
                    myLegend.visible = true;
                private function changeEvt(event:Event):void {
                if (yearcombo.selectedItem.year == "2007")
                    measures.filterFunction=filter1
                    measures.refresh()
                    myURL.dataProvider=measures
                    myLegend.visible = true;
                else if (yearcombo.selectedItem.year == "2009")
                    measures.filterFunction=filter2
                    measures.refresh();
                    myLegend.visible = true;
            public function filter1(item:Object):Boolean
                if (item.year=="2007") return true
                else return false
                public function filter2(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEvt(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter3
                        measures.refresh()
                        myURL.dataProvider=measures
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter4
                        measures.refresh();
                public function filter3(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter4(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEv2(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter5
                        measures.refresh()
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter6
                        measures.refresh();
                    else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
                        myLegend.layers = null;
                        layerPanel.removeAllChildren();
                public function filter5(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter6(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                /* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
                if (myURL.selectedIndex==0)
                myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
                + "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
                    public function fLayer_graphicAddHandler(event:GraphicEvent):void
                        event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
                        event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
                    public function onMouseOverHandler(event:MouseEvent):void
                        //Place the lines of code that don't change based on the selections once.
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        textArea.width= 110
                        textArea.height = 25
                        //The particular year doesn't seem to have an impact on anything but the definetionExpression
                        //so there is no need to evaluate it each time
                    /*     if (yearcombo.selectedItem.year == "2007"){
                            fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'";
                        }else if(yearcombo.selectedItem.year == "2009"){
                            fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'";
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '"+ yearcombo.selectedItem.year+"'";
                        //This part is always the same so only do it once
                        textArea.htmlText = myURL.selectedItem.label; */
                        /* for each (var item:object in fLayer.getItemAt(i)
                        if (myURL.selectedItem.namefield == fLayer.tableDetails.fields){ */
                        /* if (myURL.selectedItem.namefield == fLayer.outFields 
                            textArea.htmlText = graphic.attributes.ForDirIndOut.toString();
                        private function locateBoundary(event:Event) : void
                        layerCOUNTIES.definitionExpression = "STATE = '" + (event.currentTarget as TextArea).data.STATEFP + "'";
                        try{
                            if (radioBtnGroup.selectedValue == 0){
                                if(myURL.selectedIndex == 0){
                                    textArea.htmlText = graphic.attributes.ForDirIndOut.toString();
                                }else if(myURL.selectedIndex == 1 ){
                                    textArea.htmlText = graphic.attributes.ForDirEmp.toString();
                                }else if(myURL.selectedIndex == 2){
                                    textArea.htmlText = graphic.attributes.ForDirLabInc.toString();
                                }else if(myURL.selectedIndex == 3){
                                    textArea.htmlText = graphic.attributes.ForIndirBusTax.toString();
                                }else if(myURL.selectedIndex == 4){
                                    textArea.htmlText = graphic.attributes.LogDirIndOut.toString();
                                }else if(myURL.selectedIndex == 5){
                                    textArea.htmlText = graphic.attributes.LogDirEmp.toString();
                                }else if(myURL.selectedIndex == 6){
                                    textArea.htmlText = graphic.attributes.LogDirLabInc.toString();
                                }else if(myURL.selectedIndex == 7){
                                    textArea.htmlText = graphic.attributes.LogIndirBusTax.toString();}
                                else if(myURL.selectedIndex == 8){
                                    textArea.htmlText = graphic.attributes.PrimaryPaperDirIndOut.toString();}
                                else if(myURL.selectedIndex == 9){
                                    textArea.htmlText = graphic.attributes.PrimaryPaperDirEmp.toString();}
                                else if(myURL.selectedIndex == 10){
                                    textArea.htmlText = graphic.attributes.PrimaryPaperDirLabInc.toString();}
                                else if(myURL.selectedIndex == 11){
                                    textArea.htmlText = graphic.attributes.PrimaryPaperIndirBusTax.toString();}
                                else if(myURL.selectedIndex == 12){
                                    textArea.htmlText = graphic.attributes.PrimarySolidIndOut.toString();}
                                else if(myURL.selectedIndex == 13){
                                    textArea.htmlText = graphic.attributes.PrimarySolidEmp.toString();}
                                else if(myURL.selectedIndex == 14){
                                    textArea.htmlText = graphic.attributes.PrimarySolidLabInc.toString();}
                                else if(myURL.selectedIndex == 15){
                                    textArea.htmlText = graphic.attributes.PrimarySolidIndBusTax.toString();}
                                else if(myURL.selectedIndex == 16){
                                    textArea.htmlText = graphic.attributes.SecondPaperDirIndOut.toString();}
                                else if(myURL.selectedIndex == 17){
                                    textArea.htmlText = graphic.attributes.SecondPaperDirEmp.toString();}
                                else if(myURL.selectedIndex == 18){
                                    textArea.htmlText = graphic.attributes.SecondPaperDirLabInc.toString();}
                                else if(myURL.selectedIndex == 19){
                                    textArea.htmlText = graphic.attributes.SecondPaperIndirBusTax.toString();}
                                else if(myURL.selectedIndex == 20){
                                    textArea.htmlText = graphic.attributes.SecondSolidDirIndOut.toString();}
                                else if(myURL.selectedIndex == 21){
                                    textArea.htmlText = graphic.attributes.SecondSolidDirEmp.toString();}
                                else if(myURL.selectedIndex == 22){
                                    textArea.htmlText = graphic.attributes.SecondSolidDirLabInc.toString();}
                                else if(myURL.selectedIndex == 23){
                                    textArea.htmlText = graphic.attributes.SecondSolidBusTax.toString();}
                                myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
                            else if (radioBtnGroup.selectedValue == 1){
                                    if(myURL.selectedIndex == 0){
                                        textArea.htmlText = graphic.attributes.ForTotImpIndOut.toString();
                                    }else if(myURL.selectedIndex == 1 ){
                                        textArea.htmlText = graphic.attributes.ForTotImpEmp.toString();
                                    }else if(myURL.selectedIndex == 2){
                                        textArea.htmlText = graphic.attributes.ForTotImpLabInc.toString();
                                    }else if(myURL.selectedIndex == 4){
                                        textArea.htmlText = graphic.attributes.LogTotImpIndOut.toString();
                                    }else if(myURL.selectedIndex == 5){
                                        textArea.htmlText = graphic.attributes.LogTotImpEmp.toString();
                                    }else if(myURL.selectedIndex == 6){
                                        textArea.htmlText = graphic.attributes.LogTotImpLabInc.toString();}
                                    else if(myURL.selectedIndex == 8){
                                        textArea.htmlText = graphic.attributes.PrimaryPaperTotImpIndOut.toString();}
                                    else if(myURL.selectedIndex == 9){
                                        textArea.htmlText = graphic.attributes.PrimaryPaperTotImpEmp.toString();}
                                    else if(myURL.selectedIndex == 10){
                                        textArea.htmlText = graphic.attributes.PrimaryPaperTotImpLabInc.toString();}
                                    else if(myURL.selectedIndex == 12){
                                        textArea.htmlText = graphic.attributes.PrimarySolidTotImpIndOut.toString();}
                                    else if(myURL.selectedIndex == 13){
                                        textArea.htmlText = graphic.attributes.PrimarySolidTotImpEmp.toString();}
                                    else if(myURL.selectedIndex == 14){
                                        textArea.htmlText = graphic.attributes.PrimarySolidTotImpLabInc.toString();}
                                    else if(myURL.selectedIndex == 16){
                                        textArea.htmlText = graphic.attributes.SecondPaperTotImpIndOut.toString();}
                                    else if(myURL.selectedIndex == 17){
                                        textArea.htmlText = graphic.attributes.SecondPaperTotImpEmp.toString();}
                                    else if(myURL.selectedIndex == 18){
                                        textArea.htmlText = graphic.attributes.SecondPaperTotImpLabInc.toString();}
                                    else if(myURL.selectedIndex == 20){
                                        textArea.htmlText = graphic.attributes.SecondSolidIndOut.toString();}
                                    else if(myURL.selectedIndex == 21){
                                        textArea.htmlText = graphic.attributes.SecondSolidEmp.toString();}
                                    else if(myURL.selectedIndex == 22){
                                        textArea.htmlText = graphic.attributes.SecondSolidLabInc.toString();}
                                myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
                            myMap.infoWindow.content=textArea;
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.width = 120;
                        catch(error:Error){
                            trace("Caught Error: "+error);
                        //Place the lines of code that don't change based on the selections once.
                public function onMouseOutHandler(event:MouseEvent):void
                        var gr:Graphic = Graphic(event.target);
                        gr.symbol = defaultsym;
                        myMap.infoWindow.hide();
            ]]>
        </fx:Script>
        <fx:Style>
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace components "com.esri.ags.components.*";
            components|InfoWindow
                background-alpha : 0.7;
                border-style : solid;
        </fx:Style>
        <mx:HBox   width="930" height="800"  id="mapHbox"  horizontalAlign="center" >   
        <mx:HBox width="80">
        </mx:HBox>
        <mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff"  >
            <mx:VBox  height="590" width="358"  >
            <!--    <mx:Panel
                    width="356" height="100%"
                    color="0x000000"
                    borderAlpha="0.15"
                    >
                    -->
                    <mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
                        <esri:Map id="myMap" openHandCursorVisible="false"
                                  height="100%" 
                                  logoVisible="false"
                                  doubleClickZoomEnabled="false"
                                  scrollWheelZoomEnabled="false"
                                  zoomSliderVisible="false"
                                  scaleBarVisible="false" scale="4000000" >
                            <esri:extent>
                                <esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100"      >
                                    <esri:SpatialReference wkid="102100"/>
                                </esri:Extent>
                            </esri:extent>
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
                                                               url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
                                                               alpha="1"
                                                               load="loadLayerName()"
                                                       url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer"   />
                            <esri:FeatureLayer id="fLayer"
                                               graphicAdd="fLayer_graphicAddHandler(event)"
                                               mode="snapshot"
                                               outFields="*"
                                               symbol="{defaultsym}"
                                               url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
                        </esri:Map>
                    </mx:Canvas>
            <!--    </mx:Panel>-->
            </mx:VBox>       
            <mx:VBox  height="590" width="20"  >
            </mx:VBox>       
            <mx:Canvas height="500" width="400" backgroundColor="0xffffff"
                       horizontalScrollPolicy="off"
                       verticalScrollPolicy="off" >
                <mx:VBox  width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
                         verticalGap="8">
                    <mx:Form  >
                        <mx:FormItem label="Year        :"  >
                            <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
                                <mx:ArrayCollection id="year"  >
                                    <fx:Object label="2007"  year="2007" />
                                    <fx:Object label="2009"  year="2009" />
                                </mx:ArrayCollection>
                            </mx:ComboBox>
                        </mx:FormItem>
                        <mx:FormItem label="Measure:">
                            <mx:ComboBox   id="myURL" selectedIndex="48" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)" >
                            <mx:ArrayCollection id="measures"   >
                                <fx:Object id="forindout07"  label="Forestry Industry Output" value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" labeltext="Industry Output"  />
                                <fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
                                <fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
                                <fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
                                <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output2" year="2009"  />
                                <fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
                                <fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome2" year="2009" />
                                <fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
                                <fx:Object id="logindout07" label="Logging Industry Output"  value="RADIO_BUTTONS/TFEI_07_logging_industry_output" year="2007"  />
                                <fx:Object id="logemp07" label="Logging Employment " value="RADIO_BUTTONS/TFEI_07_logging_employment" year="2007" />
                                <fx:Object id="loglabinc07" label="Logging Labor Income " value="RADIO_BUTTONS/TFEI_07_logging_labincome" year="2007" />
                                <fx:Object id="logindbustax07" label="Logging Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_logging_business_tax" year="2007" />
                                <fx:Object id="logindout09" label="Logging Industry Output " value="RADIO_BUTTONS/TFEI_09_logging_industry_output" year="2009"  />
                                <fx:Object id="logemp09" label="Logging Employment " value="RADIO_BUTTONS/TFEI_09_logging_employment" year="2009" />
                                <fx:Object id="loglabinc09" label="Logging Labor Income " value="RADIO_BUTTONS/TFEI_09_logging_labincome" year="2009" />
                                <fx:Object id="logindbustax09" label="Logging Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_logging_business_tax" year="2009" />
                                <fx:Object id="ppindout07" label="Primary Paper Industry Output"  value="RADIO_BUTTONS/TFEI_07_primary_paper_industry_output" year="2007"  />
                                <fx:Object id="ppemp07" label="Primary Paper Employment " value="RADIO_BUTTONS/TFEI_07_primary_paper_employment" year="2007" />
                                <fx:Object id="pplabinc07" label="Primary Paper Labor Income " value="RADIO_BUTTONS/TFEI_07_primary_paper_labincome" year="2007" />
                                <fx:Object id="ppindbustax07" label="Primary Paper Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_primary_paper_business_tax" year="2007" />
                                <fx:Object id="ppindout09" label="Primary Paper Industry Output " value="RADIO_BUTTONS/TFEI_09_primary_paper_industry_output" year="2009"  />
                                <fx:Object id="ppemp09" label="Primary Paper Employment " value="RADIO_BUTTONS/TFEI_09_primary_paper_employment2" year="2009" />
                                <fx:Object id="pplabinc09" label="Primary Paper Labor Income " value="RADIO_BUTTONS/TFEI_09_primary_paper_labincome2" year="2009" />
                                <fx:Object id="ppindbustax09" label="Primary Paper Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_primary_paper_business_tax" year="2009" />
                                <fx:Object id="psindout07" label="Primary Solid Industry Output"  value="RADIO_BUTTONS/TFEI_07_primary_solid_industry_output" year="2007"  />
                                <fx:Object id="psemp07" label="Primary Solid Employment " value="RADIO_BUTTONS/TFEI_07_primary_solid_employment" year="2007" />
                                <fx:Object id="pslabinc07" label="Primary Solid Labor Income " value="RADIO_BUTTONS/TFEI_07_primary_solid_labincome" year="2007" />
                                <fx:Object id="psindbustax07" label="Primary Solid Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_primarysolid_business_tax" year="2007" />
                                <fx:Object id="psindout09" label="Primary Solid Industry Output " value="RADIO_BUTTONS/TFEI_09_primary_paper_industry_output" year="2009"  />
                                <fx:Object id="psemp09" label="Primary Solid Employment " value="RADIO_BUTTONS/TFEI_09_primary_solid_employment" year="2009" />
                                <fx:Object id="pslabinc09" label="Primary Solid Labor Income " value="RADIO_BUTTONS/TFEI_09_primary_solid_labincome" year="2009" />
                                <fx:Object id="psindbustax09" label="Primary Solid Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_primarysolid_business_tax" year="2009" />
                                <fx:Object id="spindout07" label="Secondary Paper Industry Output"  value="RADIO_BUTTONS/TFEI_07_secondary_paper_output" year="2007"  />
                                <fx:Object id="spemp07" label="Secondary Paper Employment " value="RADIO_BUTTONS/TFEI_07_secondary_paper_employment" year="2007" />
                                <fx:Object id="splabinc07" label="Secondary Paper Labor Income " value="RADIO_BUTTONS/TFEI_07_secondary_paper_labincome" year="2007" />
                                <fx:Object id="spindbustax07" label="Secondary Paper Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_secondary_paper_business_tax" year="2007" />
                                <fx:Object id="spindout09" label="Secondary Paper Industry Output " value="RADIO_BUTTONS/TFEI_09_secondary_paper_output2" year="2009"  />
                                <fx:Object id="spemp09" label="Secondary Paper Employment " value="RADIO_BUTTONS/TFEI_09_secondary_paper_employment" year="2009" />
                                <fx:Object id="splabinc09" label="Secondary Paper Labor Income " value="RADIO_BUTTONS/TFEI_09_secondary_paper_labincome" year="2009" />
                                <fx:Object id="spindbustax09" label="Secondary Paper Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_secondary_paper_business_tax" year="2009" />
                                <fx:Object id="ssindout07" label="Secondary Solid Industry Output"  value="RADIO_BUTTONS/TFEI_07_secondary_solid_industry_output" year="2007"  />
                                <fx:Object id="ssemp07" label="Secondary Solid Employment " value="RADIO_BUTTONS/TFEI_07_secondary_solid_employment" year="2007" />
                                <fx:Object id="sslabinc07" label="Secondary Solid Labor Income " value="RADIO_BUTTONS/TFEI_07_secondary_solid_labincome" year="2007" />
                                <fx:Object id="ssindbustax07" label="Secondary Solid Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_secondary_solid_business_tax" year="2007" />
                                <fx:Object id="ssindout09" label="Secondary Solid Industry Output " value="RADIO_BUTTONS/TFEI_09_secondary_solid_industry_output" year="2009"  />
                                <fx:Object id="ssemp09" label="Secondary Solid Employment " value="RADIO_BUTTONS/TFEI_09_secondary_solid_employment" year="2009" />
                                <fx:Object id="sslabinc09" label="Secondary Solid Labor Income " value="RADIO_BUTTONS/TFEI_09_secondary_solid_labincome" year="2009" />
                                <fx:Object id="ssindbustax09" label="Secondary Solid Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_secondary_solid_business_tax" year="2009" />
                                <fx:Object id="blank" label=" "  />
                            </mx:ArrayCollection>
                        </mx:ComboBox>
                        </mx:FormItem>
                    </mx:Form>
                    <mx:VBox  id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
                        <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"  />
                    </mx:VBox>
                    <mx:VBox   height="2%">
                    </mx:VBox>
                    <mx:VBox paddingLeft="17" height="10%"  >
                    <mx:Canvas  id="legendPanel" width="100%"  >
                        <mx:Label id="myLabel" text=" " fontWeight="bold" />
                        <esri:Legend id="myLegend"
                                     layers="{[dynamicLayer]}"
                                     map="{myMap}" visible="false"
                                     respectCurrentMapScale="false" />
                    </mx:Canvas>
                    </mx:VBox>
                    <mx:VBox>
                    <mx:TextArea width="275"  borderAlpha="0" height="200"  >
                        <mx:htmlText   >
                            <![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
                            ]]>
                        </mx:htmlText>
                    </mx:TextArea>
                    </mx:VBox>   
                </mx:VBox>
            </mx:Canvas>
        </mx:HBox>
        </mx:HBox>   
    </mx:Application>

    Here is the HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Texas Forestry Economic Impact</title>
    <style type="text/css">
    <!--
    body {
        font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
        background: #42413C;
        margin: 0;
        padding: 0;
        color: #FFF;
    p {
        margin-top: 0;     /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
        padding-right: 14px;
        padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
        font-size: medium;
        color: #333;
        font-family: Calibri;
        text-align: left;
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
        border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
        color: #FFF;
        text-decoration: none; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
        color: #FFF;
        text-decoration: none;
    .container table tr td Menu a {
        color: #FFF;
        text-decoration: none;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
        text-decoration: underline;
        color: #FFF;
        font-size: small;
    /* ~~ this fixed width container surrounds the other divs ~~ */
    .container {
        width: 960px;
        background: #FFF;
        margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    /* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
    .header {
        background: #6f8d5c;
    /* ~~ This is the layout information. ~~
    1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
    .content {
        padding: 10px 0;
    /* ~~ The footer ~~ */
    .footer {
        padding: 10px 0;
        background: #6f8d5c;
    /* ~~ miscellaneous float/clear classes ~~ */
    .fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
        float: right;
        margin-left: 8px;
    .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
        float: left;
        margin-right: 8px;
    .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
        clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    .container .content table tr td {
        color: #FFF;
        font-weight: bold;
        text-align: center;
    .container table tr td {
        text-align: center;
        color: #FFF;
        font-family: Calibri;
        font-size: small;
    .container table {
        font-size: xx-small;
    table {
        font-size: 9px;
    .container table tr td p a {
        text-align: center;
    table tr td p a {
        text-align: center;
    .container .footer table tr td .footer {
        color: #FFF;
        font-size: small;
        text-align: center;
    .container p {
        font-size: medium;
    -->
    </style>
    <script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
    <script type="text/javascript">
    function updateSwfSize(myHeight, myWidth)
        var flexibleGorillaSwf = document.getElementById("FlashID");
        flexibleGorillaSwf.height = myHeight;
        flexibleGorillaSwf.width = myWidth;
    </script>
    </head>
    <body id="body" >
    <div class="container">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
           <tr>
        <td bgcolor="#6f8d5c"><img src="assets/Banner5.jpg" width="960" height="120" alt="banner" /></td>
      </tr>
          <tr>
        <td height="31" bgcolor="#6f8d5c"><a href="Home.html">Home</a>  -  <a href="Highlights.html">Highlights</a>  -  <a href="EcoImpactTX.html" title="Map" target="_self">Summary Tool</a>  -  <a href="maps.html"  style="font-weight: bold; font-size:medium; target="_self">Maps</a>  -  <a href="charts.html" target="_self">Charts</a>  -  <a href="Report.html" target="_self">Download Reports</a>  -   <a href="FAQs.html" target="_self">FAQs</a>  -  <a href="ContactUs.html" target="_self"> Contact Us</a>  -  <a href="http://txforestservice.tamu.edu/main/default.aspx"> TFS Home</a><a href="http://txforestservice.tamu.edu/main/default.aspx"></a></td>
      </tr>
       <tr>
        <td height = "0" bgcolor="#FFFFFF"> </td>
      </tr>
    </table>
    <p >                                                                                                        <span style="font-size:x-large; color:#000">Thematic Maps</span></p>
    <p>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="930" height="1950" id="FlashID" title="map">
        <param name="movie" value="maps.swf" />
        <param name="quality" value="high" />
        <param name="swfversion" value="6.0.65.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
        <param name="expressinstall" value="Scripts/expressInstall.swf" />
        <param name="SCALE" value="exactfit" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object data="maps.swf" type="application/x-shockwave-flash" width="930" height="1950">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="swfversion" value="6.0.65.0" />
          <param name="expressinstall" value="Scripts/expressInstall.swf" />
          <param name="SCALE" value="exactfit" />
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
            </div>
          <!--[if !IE]>-->
          </object>
        <!--<![endif]-->
      </object>
    </p>
    <p><!-- end .content --></p>
    <div class="footer">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="0"  bgcolor="#6f8d5c"><p class="footer"><a href="Home.html">Home</a>  -  <a href="Highlights.html">Highlights</a>  -  <a href="EcoImpactTX.html" title="Map" target="_self">Summary Tool</a>  -  <a href="maps.html"><span style="font-weight:bolder"><span style="font-size:medium">Maps</span></span></a></a>  -  <a href="charts.html">Charts</a>  -  <a href="Report.html" target="_self">Download Reports</a>  -  <a href="FAQs.html" target="_self">FAQs</a>  -  <a href="ContactUs.html" target="_self">Contact Us</a>  -  <a href="http://txforestservice.tamu.edu/main/default.aspx">TFS Home</a><a href="http://txforestservice.tamu.edu/main/default.aspx"></a></p></td>
      </tr>
    </table>
    </div>
    </div>
      <!-- end .container --></div>
    <script type="text/javascript">
    swfobject.registerObject("FlashID");
    </script>
    </body>
    </html>

  • Looping through an array to get the index for each measure in a combo box

    Hi folks,
    I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I  have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards  can give me any tips on how to code this according to my code below ? Any  help is greatly appreciated! (the print scree is attached)
    Below is the code snippet:
    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
    fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
    var graphic:Graphic = Graphic(event.currentTarget);
    graphic.symbol = mouseOverSymbol;
    var htmlText:String = graphic.attributes.htmlText;
    var textArea:TextArea = new TextArea();
    try{
    textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
    myMap.infoWindow.content=textArea
    myMap.infoWindow.label = graphic.attributes.NAME;
    myMap.infoWindow.closeButtonVisible = false;
    myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
    catch(error:Error) {
    trace("Caught Error: "+error);
    And below is the combo boxes with the arrays
    <mx:FormItem label="Year        :"  >
    <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
    <mx:ArrayCollection id="year"  >
    <fx:Object label="2007"  year="2007" />
    <fx:Object label="2009"  year="2009" />
    </mx:ArrayCollection>
    </mx:ComboBox>
    </mx:FormItem>
    <mx:FormItem label="Measure:">
    <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
    <mx:ArrayCollection id="measures"   >
    <fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
    <fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
    <fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
    <fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
    <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
    <fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
    <fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
    <fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
    <fx:Object id="blank" label=" "  />
    </mx:ArrayCollection>

    And here is the entire code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application       
                    xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:esri="http://www.esri.com/2008/ags"
                    paddingBottom="8" paddingLeft="8"
                    paddingRight="8" paddingTop="8"
                    backgroundColor="0xffffff"
                    layout="vertical" >
        <!-- Start Declarations -->
    <fx:Declarations>
            <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
                <esri:SimpleLineSymbol width="0" color="#000000"/>
            </esri:SimpleFillSymbol>
            <esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0"   >
                <esri:SimpleLineSymbol width="1" color="#000000"/>
            </esri:SimpleFillSymbol>
        <!-- End Declarations -->
    </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import com.esri.ags.Graphic;
                import com.esri.ags.SpatialReference;
                import com.esri.ags.esri_internal;
                import com.esri.ags.events.GraphicEvent;
                import com.esri.ags.geometry.Extent;
                import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
                import com.esri.ags.symbols.SimpleFillSymbol;
                import com.esri.ags.symbols.SimpleLineSymbol;
                import flash.utils.flash_proxy;
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                import mx.controls.RadioButton;
                import mx.controls.TextArea;
                import mx.events.DropdownEvent;
                import mx.events.ItemClickEvent;
                import mx.rpc.Fault;
                import mx.rpc.events.FaultEvent;
                import flash.display.Sprite;
                import flash.events.ErrorEvent;
                import flash.events.MouseEvent;
                private function closeHandler(evt:DropdownEvent):void {
                    myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
                private function loadLayerName():void
                    myLegend.layers = null;
                    layerPanel.removeAllChildren();
                    //loop through each layer and add as a radiobutton
                    for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
                        var radioBtn:RadioButton = new RadioButton;
                        radioBtn.groupName = "radioBtnGroup";
                        radioBtn.value = i;
                        radioBtn.label = dynamicLayer.layerInfos[i].name;
                        if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
                            radioBtn.label = "Direct Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
                        {radioBtn.label = "Direct Impact";
                        else
                        {radioBtn.visible= false;
                        layerPanel.addChild(radioBtn);
                    /*     myDividerBox.getDividerAt(0).visible = false; */
                    //set the visible layer the first radio button
                     radioBtnGroup.selectedValue = 0;
                     dynamicLayer.visibleLayers = new ArrayCollection([0]);
                    myLegend.layers = [dynamicLayer];
                    myLegend.visible = true;
                private function radioClickHandler(event:ItemClickEvent):void
                    myLegend.layers = null;
                    // update the visible layers to only show the layer selected
                    dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
                    myLegend.layers = [dynamicLayer];
                private function changeEvt(event:Event):void {
                if (yearcombo.selectedItem.year == "2007")
                    measures.filterFunction=filter1
                    measures.refresh()
                    myURL.dataProvider=measures
                else if (yearcombo.selectedItem.year == "2009")
                    measures.filterFunction=filter2
                    measures.refresh();
            public function filter1(item:Object):Boolean
                if (item.year=="2007") return true
                else return false
                public function filter2(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEvt(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter3
                        measures.refresh()
                        myURL.dataProvider=measures
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter4
                        measures.refresh();
                public function filter3(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter4(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEv2(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter5
                        measures.refresh()
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter6
                        measures.refresh();
                    else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
                        myLegend.layers = null;
                        layerPanel.removeAllChildren();
                public function filter5(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter6(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                /* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
                if (myURL.selectedIndex==0)
                myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
                + "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
                public function fLayer_graphicAddHandler(event:GraphicEvent):void
                    event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
                    event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
                public function onMouseOverHandler(event:MouseEvent):void
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                        textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                        myMap.infoWindow.content=textArea
                        myMap.infoWindow.label = graphic.attributes.NAME;
                        myMap.infoWindow.closeButtonVisible = false;
                        myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                public function onMouseOutHandler(event:MouseEvent):void
                    var gr:Graphic = Graphic(event.target);
                    gr.symbol = defaultsym;
                    myMap.infoWindow.hide();
            ]]>
        </fx:Script>
        <fx:Style>
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace components "com.esri.ags.components.*";
            components|InfoWindow
                content-background-alpha : 0.4;
                background-color : #4A7138;
                background-alpha : 0.7;
                border-style : solid;
        </fx:Style>
        <mx:HBox   width="930" height="800"  id="mapHbox"  horizontalAlign="center" >   
        <mx:HBox width="80">
        </mx:HBox>
        <mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff"  >
            <mx:VBox  height="590" width="358"  >
            <!--    <mx:Panel
                    width="356" height="100%"
                    color="0x000000"
                    borderAlpha="0.15"
                    >
                    -->
                    <mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
                        <esri:Map id="myMap" openHandCursorVisible="false"
                                  height="100%" 
                                  logoVisible="false"
                                  doubleClickZoomEnabled="false"
                                  scrollWheelZoomEnabled="false"
                                  zoomSliderVisible="false"
                                  scaleBarVisible="false" scale="4000000" >
                            <esri:extent>
                                <esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100"      >
                                    <esri:SpatialReference wkid="102100"/>
                                </esri:Extent>
                            </esri:extent>
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
                                                               url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
                                                               alpha="1"
                                                               load="loadLayerName()"
                                                       url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer"   />
                            <esri:FeatureLayer id="fLayer"
                                               graphicAdd="fLayer_graphicAddHandler(event)"
                                               mode="snapshot"
                                               outFields="*"
                                               symbol="{defaultsym}"
                                               url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
                        </esri:Map>
                    </mx:Canvas>
            <!--    </mx:Panel>-->
            </mx:VBox>       
            <mx:VBox  height="590" width="20"  >
            </mx:VBox>       
            <mx:Canvas height="500" width="400" backgroundColor="0xffffff"
                       horizontalScrollPolicy="off"
                       verticalScrollPolicy="off" >
                <mx:VBox  width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
                         verticalGap="8">
                    <mx:Form  >
                        <mx:FormItem label="Year        :"  >
                            <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
                                <mx:ArrayCollection id="year"  >
                                    <fx:Object label="2007"  year="2007" />
                                    <fx:Object label="2009"  year="2009" />
                                </mx:ArrayCollection>
                            </mx:ComboBox>
                        </mx:FormItem>
                        <mx:FormItem label="Measure:">
                            <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
                            <mx:ArrayCollection id="measures"   >
                                <fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
                                <fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
                                <fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
                                <fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
                                <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
                                <fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
                                <fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
                                <fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
                                <fx:Object id="blank" label=" "  />
                            </mx:ArrayCollection>
                        </mx:ComboBox>
                        </mx:FormItem>
                    </mx:Form>
                    <mx:VBox  id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
                        <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"  />
                    </mx:VBox>
                    <mx:VBox paddingLeft="17" height="50%" >
                    <mx:Canvas  id="legendPanel" width="100%"  >
                        <mx:Label id="myLabel" text=" " fontWeight="bold" />
                        <esri:Legend id="myLegend"
                                     layers="{[dynamicLayer]}"
                                     map="{myMap}" visible="false"
                                     respectCurrentMapScale="false"/>
                    </mx:Canvas>
                    <mx:TextArea width="275"  borderAlpha="0" height="200"  >
                        <mx:htmlText   >
                            <![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
                            ]]>
                        </mx:htmlText>
                    </mx:TextArea>
                    </mx:VBox>   
                </mx:VBox>
            </mx:Canvas>
        </mx:HBox>
        </mx:HBox>   
    </mx:Application>

  • Passing variables in an array to jtextarea?

    What method could I use to pass different Strings in an array to a jtextarea each time the "Next" button (a JButton) in my JFrame is pressed? So, for example, if i hit next, i might want the word "frank" to print in the jtextarea, but the next time i hit it, i might want it to print "joe" Thank you!!
    This is my code:
    public class discardedSaluteMyShorts extends JPanel implements ActionListener
        JTextArea textArea;
        String newline = "\n";
        static final public String NEXT = "next";
        public discardedSaluteMyShorts()
            super(new BorderLayout());
            //Create the toolbar.
            JToolBar toolBar = new JToolBar("Still draggable");
            addButtons(toolBar);
            //Create the text area used for output.  Request
            //enough space for 5 rows and 30 columns.
            textArea = new JTextArea(5, 30);
            textArea.setEditable(false);
            JScrollPane scrollPane = new JScrollPane(textArea);
            //Lay out the main panel.
            setPreferredSize(new Dimension(450, 130));
            add(toolBar, BorderLayout.PAGE_START);
            add(scrollPane, BorderLayout.CENTER);
        public void addButtons(JToolBar toolBar)
            JButton button = null;
            //third button
            button = makeNavigationButton("Forward24", NEXT,
                    "Next light or sound cue",
                    "Next");
            toolBar.add(button);
        public JButton makeNavigationButton(String imageName,
                String actionCommand,
                String toolTipText,
                String altText)
            //Look for the image.
            String imgLocation = "images/"
                    + imageName
                    + ".gif";
            URL imageURL = discardedSaluteMyShorts.class.getResource(imgLocation);
            //Create and initialize the button.
            JButton button = new JButton();
            button.setActionCommand(actionCommand);
            button.setToolTipText(toolTipText);
            button.addActionListener(this);
            if (imageURL != null)
            {                      //image found
                button.setIcon(new ImageIcon(imageURL, altText));
            else
            {                                     //no image found
                button.setText(altText);
                System.err.println("Resource not found: "
                        + imgLocation);
            return button;
        public void actionPerformed(ActionEvent e)
            String cmd = e.getActionCommand();
            String cmd1 = e.getActionCommand();
            String description="";
            String description1 = "";
            String description2 = "";
            // Handle each button.
            if (NEXT.equals(cmd))
            { // third button clicked
                description="23 up";
                description1 ="23 down";
                description2="adsfsd";
                displayResult(description, description1, description2);
        public void displayResult(String description, String description1, String description2)
            JButton button = new JButton();
            button.getActionCommand();
            textArea.append(description + newline);//adds description to document
            if(button.getActionCommand()!=null)
            textArea.append(description1 + newline);
            textArea.append(description2 + newline);
            textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
        public void nextCue1()
            String description2 = "asdfasasdf";
            displayResult2(""+description2);
        public void displayResult2(String description2)
            String description3 = ".";
            textArea.append(description2 + newline);//adds description to document
            textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
        public void displayResult3(String description3)
            textArea.append(description3 + newline);//adds description to document
            textArea.setCaretPosition(textArea.getDocument().getLength());//scrolls down
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event dispatch thread.
        public static void createAndShowGUI()
            //Create and set up the window.
            JFrame frame = new JFrame("ToolBarDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Add content to the window.
            frame.add(new discardedSaluteMyShorts());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args)
            //Schedule a job for the event dispatch thread:
            //creating and showing this application's GUI.
            SwingUtilities.invokeLater(new Runnable()
                public void run()
                    //Turn off metal's use of bold fonts
                    createAndShowGUI();
    }Edited by: cubswar on Apr 1, 2008 8:47 PM

    First you declare the array and the index you currently are on in your class on the global variables section so for example:
    public class discardedSaluteMyShorts extends JPanel implements ActionListener {
        private int index = 0;
        private String arr[] = new String[] { "frank", "joe" };
        // The code would be here
    }Then in the method which displays the next value:
    public void showNextValue() {
        textArea.setText(arr[index]);
        index = (index + 1) % arr.length;
    }You probably want to call the method from the action performed of the button.

  • Scroll bar with flowlayout still does not work

    Why does the scrollbar with my textArea not work?
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class JEmail extends JFrame implements ActionListener
         JPanel panel = new JPanel(new FlowLayout());
         private final static String newline = "\n";
         JButton button = new JButton("Send");
         JLabel to = new JLabel("TO:");
         JLabel from = new JLabel("From:");
         JTextField tobox = new JTextField(8);
         JTextField frombox = new JTextField(8);
         //     JTextArea email = new JTextArea(5,10);
              JLabel message = new JLabel("Message:");
         //     JScrollPane scroll = new JScrollPane(email);
              JTextArea textArea = new JTextArea(5,10);
              JScrollPane scroll = new JScrollPane(textArea);     
         //JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
         //     JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         public JEmail()
              super("Email");
              panel.setLayout(new FlowLayout());
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              panel.add(to);
              panel.add(tobox);
              panel.add(from);
              panel.add(frombox);
              panel.add(message);
              panel.add(textArea);
         panel.add(scroll);
              panel.add(button);
              button.addActionListener(this);
         //     email.addAdjustmentListener(this);
              setContentPane(panel);
         public void actionPerformed(ActionEvent e)
              Object source = e.getSource();
              if (source == button)
              textArea.append(newline + "Mail has been sent\n");
              tobox.setText("");
              frombox.setText("");
         public void adjustmentValueChanged(AdjustmentEvent e)
              Object source = e.getSource();
         public static void main(String[] args)
              JFrame aFrame = new JEmail();
              aFrame.setSize(400, 400);
              aFrame.setVisible(true);
    }

    Post the code again, this time using the [ code ] tags.

  • Display HTML Tags on web browser

    My problem is display Html code in web browser.
    i try TextArea.htmlText, Label.htmlText... but they don't
    work...
    i'm searching in google.com and i know Html Component can do
    that, but it not well because i don't have money for that.
    Some body help me for my problem.
    Thanks so much. !
    nice day every body.

    The htmlText property should work however only a few basic
    html tags are supported as far as I know.

  • Flex Mobile 4.6 introduces Stage Text - how do you render HTML text with it?

    I have a little chat component in a Flex Mobile app that I just upgraded to SDK 4.6.  The chat component has a text area displaying messages and they are HTML formatted via the following:
    StyleableTextField(textArea).htmlText += myHTMLText;
    Worked in SDK 4.5 but StyleableTextField is not a part of the new Stage Text framework introduced in SDK 4.6.
    How do I HTML format the messages in my chat text area now?

    Thanks much for your response.
    Hmmm...  That appears to work but also causes a runtime exception where there was none before the 4.6 upgrade.  It occurs when I autoscroll on receiving a new message in the chat, something that worked fine in 4.5.
    I guess I'm kind of wondering what the best practice is here.  Maybe I'm just doing this wrong altogether.  I'm finding it very difficult to implement probably one of the most basic features one would find in any collaborative app - something that was very easy in Flex 3 - the chat pane.  I've had one functioning fine for about 3 years.  Not so much in Flex mobile.
    Chat is very simple functionality.  When you receive a new message from afar...
    1.  add it to a TextArea with some nice formatting
    2.  auto scroll far enough so the user can see the new message in its entirety. 
    Nothing difficult at all.
    Why are these two things difficult to find in the TextArea in Flex mobile?  It almost seems as though it's something we're not supposed to be doing? 
    The answer here seems to be don't use Stage Text.  Revert to an older TextArea skin.  Why?  What text area doesn't need formatting as an option?  What text area doesn't need to be auto scrolled here and there?  Or am I just going about this wrong?  Maybe using the wrong components?
    I guess for now I can revert to 4.5 skin, but now the code I used to auto scroll on receiving a new message throws a null pointer exception.  I've been using the valueCommit property to auto scroll, as follows:
    valueCommit="textArea.scroller.verticalScrollBar.value = textArea.scroller.verticalScrollBar.maximum"
    Haven't had a problem prevously.  But this now throws:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at com.components::ChatWindow/__textArea_valueCommit()
    What's the best practice to accomplish this and also to be able to take advantage of the latest and greatest?

Maybe you are looking for