Style Font in Spark TextInput Control

Hello!
How can I do as the title indicates please?
Can I do it without using a custom skin because I want to be able to change fontColor and fontStyle programatically.
Thanks!

You can acheive it very easily with spark textinput too. Pls check below and let me know if you have any issue.
<?xml version="1.0" encoding="utf-8"?>
<s: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" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            private var acFontSizes : ArrayCollection = new ArrayCollection([
                {fontSize : '12'},
                {fontSize : '16'},
                {fontSize : '20'},
                {fontSize : '24'},
                {fontSize : '28'},
                {fontSize : '32'},
                {fontSize : '36'},
                {fontSize : '40'},
                {fontSize : '44'}
        ]]>
    </fx:Script>
    <mx:VBox>
            <s:TextInput id="txtInput" width="150" height="50" text="Your Text" fontSize="{comboFontSize.selectedItem.fontSize}" color="{colorCombo.selectedColor}"/>
            <mx:HBox>
                <s:Label text="Choose Color"/>
                <mx:ColorPicker id="colorCombo"/>
            </mx:HBox>
            <mx:HBox>
                <s:Label text="Choose Font Size"/>
                <s:ComboBox id="comboFontSize" dataProvider="{acFontSizes}" labelField="fontSize" selectedIndex="0"/>
            </mx:HBox>
    </mx:VBox>
</s:Application>
with Regards,
Shardul singh Bartwal

Similar Messages

  • Problems with embedded font on spark RichText control

    « Hide
    I have an embedded font that appears correctly when used with Halo components, but when associated with the spark RichText component, it is not recognized.
    The embedded font is defined in css file, my css file
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/halo";
    @font-face {
    src:url("assets/fonts.swf");
    fontFamily: "Helvetica Neue";
    @font-face {
    src:url("assets/fonts.swf");
    fontFamily:"Helvetica Neue";
    fontWeight: bold;
    global{
    color:#333333;
    fontFamily: "Helvetica Neue";
    fontSize:12px;
    The embedded font it used in the following manner:
    <mx:Label styleName="panelTitle" text="Hello There"  width="263" x="21" y="11"/>
    <s:Group width="410" x="38" y="52" height="50">
    <s:RichText styleName="panelTitle" text="Hello There" fontFamily="Helvetica Neue"  width="263" x="21" y="11"/>
    </s:Group>
    The Label shows the embedded font correctly while the RichText control does not. It does not matter if the fontFamily is specified explicitly on the control or not.
    I created a bug SDK-22137, but since I'd need to get this working soon any help would be appreciated.

    Just a friendly reminder. Many of the examples on that site are fairly old and havent been updated to use the latest APIs. For example, "cff" has recently been renamed to "embedAsCFF". In fact, here's a better example:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            /* DefineFont3 (embedAsCFF == false) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgia;
                fontWeight: normal;
                embedAsCFF: false;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgia;
                fontWeight: bold;
                embedAsCFF: false;
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgia;
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        </fx:Style>
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />
    </s:Application>
    Also, depending on what you're trying to do, this may help you: http://blog.flexexamples.com/2009/06/14/using-a-cff-embedded-font-with-a-halo-label-contro l-in-flex-4/. Basically, you can set the textFieldClass style on certain Halo controls and have them use the mx.core.UITLFTextFieldClass (instead of the default mx.core.UITextFieldClass) so they can take advantage of the new CFF fonts.
    In fact, here's the same example as above, but with the single embedded font:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo">
        <s:layout>
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgiaCFF;
                textFieldClass: ClassReference("mx.core.UITLFTextField");
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        </fx:Style>
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />
    </s:Application>
    Peter

  • Embedding .ttf font in Spark TextInput "prompt"?

    This is what i have:
    Main.mxml:
    <fx:Style source="Main.css"/>
        <s:TextInput x="72" y="95" focusColor="#CECB02" prompt="E-mail: "
                 skinClass="components.TextInputSkin"/>
    TextInputSkin.mxml:
    <s:RichText id="promptDisplay" includeIn="disabledWithPrompt,normalWithPrompt" x="10" y="7"
            color="#666666" fontFamily="Acens" fontSize="15" trackingRight="1"
            color.normalWithPrompt="#333333"/>
        <s:RichEditableText id="textDisplay" d:userLabel="Text Display" x="10" y="7" width="230"
            fontFamily="Acens" fontSize="15" heightInLines="1"
            width.normal="282" color.normal="#999999"
            tabStops.normal="S0 S50 S100 S150 S200" trackingRight.normal="1"/>
    Main.css
    @font-face
        fontFamily: Acens;
        src: url("C:\WINDOWS\Fonts\Acens.ttf");
        embedAsCFF: true;
    So, the "promptDisplay" in a computer(online) that does not have "Acens.ttf" installed shows the predefined one, but the inputed text is showed correctly with the embeded font!! Any explanation/solution for that!?
    Thanks ;-)

    Thanks for the reply
    It's predefined in "italic" and this font doesn't have it.
    But if it's like you are saying, why do i see it in my computer (even if the file it's in a server) with the font i choose and in "italic"!?
    Thanks again ;-)
    EDIT:
    Ok.. so i change the prompt fontStyle to "normal" and it works in every computer. ;-)
    But it's strange that in the local computer it does the transformation to italic when i want!! :S
    Thanks again ;-) problem "solved"

  • Spark TextInput -  prevent text highlight when tabbing in

    How can I stop automatic text selection when I am tabbing into a Spark TextInput control?
    Thanks

    Well, I still want to be able to highlight it with a mouse down. I want to turn automatic selection off when a user is tabbing into the control or it gets its focus programmatically.

  • Embedded font not working in Spark Label control?

    Hi,
    I'm trying to use embedded fonts with the Spark Label (formerly SimpleText) control. I'm using SDK 4 build 10485 now, but I could not manage it in Beta 1 neither.
    I'v been playing with cff: true/false, embedAsCFF:true/false but no results.
    I've added my test application where it does work with the Halo <mx:Label> control, but not with the Spark <s:Label> control.
    So, no compiler errors, but the Spark label control shows a serif (Helvetia?) font where it should be sans as does the Halo control.
    Can anybody help me out here?
    Thanks
    Jan
    As I get the message 'the content type of this attachment is not allowed' on uploading the MXML file, here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        minWidth="1014" minHeight="768"
        backgroundColor="#7B7374">
        <s:layout>
            <s:VerticalLayout paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: HaloSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: SparkSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
                embedAsCFF: true;
            .mySparkSans {
                fontFamily: SparkSans;
                fontSize: 24;
            .myHaloSans {
                fontFamily: HaloSans;
                fontSize: 24;
        </fx:Style>
        <s:SkinnableContainer>
            <s:Label styleName="mySparkSans" text="This should be TheSans but it is not...., notice the characters 'ag'"/>
            <mx:Label styleName="myHaloSans" text="This is TheSans, notice the characters 'ag'" top="100"/>
        </s:SkinnableContainer>
    </s:Application>

    Hi,
    I'm trying to use embedded fonts with the Spark Label (formerly SimpleText) control. I'm using SDK 4 build 10485 now, but I could not manage it in Beta 1 neither.
    I'v been playing with cff: true/false, embedAsCFF:true/false but no results.
    I've added my test application where it does work with the Halo <mx:Label> control, but not with the Spark <s:Label> control.
    So, no compiler errors, but the Spark label control shows a serif (Helvetia?) font where it should be sans as does the Halo control.
    Can anybody help me out here?
    Thanks
    Jan
    As I get the message 'the content type of this attachment is not allowed' on uploading the MXML file, here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        minWidth="1014" minHeight="768"
        backgroundColor="#7B7374">
        <s:layout>
            <s:VerticalLayout paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" />
        </s:layout>
        <fx:Style>
            @namespace mx "library://ns.adobe.com/flex/halo";
            @namespace s "library://ns.adobe.com/flex/spark";
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: HaloSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
            @font-face {
                src: url("project/assets/thesans/THSP____.TTF");
                fontFamily: SparkSans;
                fontWeight: normal;
                advancedAntiAliasing: true;
                unicode-range: U+0021-U+007B;
                embedAsCFF: true;
            .mySparkSans {
                fontFamily: SparkSans;
                fontSize: 24;
            .myHaloSans {
                fontFamily: HaloSans;
                fontSize: 24;
        </fx:Style>
        <s:SkinnableContainer>
            <s:Label styleName="mySparkSans" text="This should be TheSans but it is not...., notice the characters 'ag'"/>
            <mx:Label styleName="myHaloSans" text="This is TheSans, notice the characters 'ag'" top="100"/>
        </s:SkinnableContainer>
    </s:Application>

  • TextInput control misbehaves when using the East-Asian fonts

    I am a little curious about this issue and I would like to get some help from our community. The issue is about fonts when using East Asian languages.I have all East-Asian language installed on my computer (WIN SERV 2003)and I let my flex application to use the local system font(font is not embedded) to get the Japanese character. When I start typing the characters into the Flex textinput control everything works properly as expected until I reach the boundary of the textinput control, the characters gets displayed outside the textinput and I would need to press the enter key to get the fonts inside the textinput . Have anyone experienced such problems when using fonts for Japanese, Chinese etc? Refer the image for more clarity.Please help

    This is the expected behavior for Japanese in my experience. The reason, I think, is that for Japanese characters the text input process has two steps. First the basic phonetic characters are entered and then these are selectively changed into kanji characters which can shorten the final input text. So it makes sense to calculate the textbox height after the text has been finally input, not while it is still being input. The enter key is the event that signals the text should be submitted. I don't know about Chinese, but for Japanese, this is the standard way of handling text input in my experience.
    Chris

  • Control cursor in spark TextInput

    Hi,
    I am using flex 4.
    I am using spark.components.TextInput control.
    The valus of the text can be change dynamically according to user selection.
    The problem is that after the user make action outside the textInput and change the value of the text the cursor position return to the begining of the textInput so if the user wants to continue enter .text in textInput he first need to move the cursor to the end.
    How can I control the cursor position ?
    Thanks

    Save selectionActivePosition and selectionAnchorPosition, then call
    selectRange

  • How to set selected text color in Spark TextInput

    I'm trying to make Spark TextInputs and MXFTETextInputs look like Halo/MX TextInputs as much as possible, since I have a mix of both Spark and MX TextInputs in my application. I know I can set the
    selection background color to black using focusedTextSelectionColor. How can I set the selected text color to white so it matches the MX white-on-black look?

    This works, if you set the enabled property directly on the s:TextInput:
    <?xml version="1.0" encoding="utf-8"?>
    <s: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">
        <s:layout>
            <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
        </s:layout>
        <s:controlBarContent>
            <s:CheckBox id="ch" label="enabled" selected="true" />
        </s:controlBarContent>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            s|TextInput:disabled {
                color: red;
        </fx:Style>
        <s:Group>
            <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{ch.selected}" />
        </s:Group>
    </s:Application>
    It can get a bit trickier when you're setting the enabled property on a parent container, since (I believe) that the child control's enabled properties are still set to true and just the container is disabled. One possible workaround would be to bind the child TextInput control's enabled property to the container's enabled property. That way the s:TextInput should still go to it's disabled state and you can customize the disabled state's styles to have darker text, or whatever else you want.
    <s:Group id="gr" enabled="{ch.selected}">
        <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{gr.enabled}" />
    </s:Group>
    Peter

  • Is it possible to get the style, font and related info of a paragraph of a in design file and write it on the same in design file  on the  left side

    Is it possible to get the style, font and related info of a paragraph text  of a in design file and write  all the stuff on the same in design file  on the  left side with small fonts 
    as
    Lets  this is a text in in design file    :
    style : abc                      we are going to check the  condition  Agence Wallonne pour la Promotion d'une Agricultur we are going to check the  condition  Agence Wallonne pour la    font 12                                  d'une Agricultu we are going to check the  condition  Agence Wallonne pour la Promotion d'une Agricultu
    style : xyz                      we are going to check the  condition  Agence Wallonne pour la Promotion d'une Agricultur we are going to check the  condition  Agence Wallonne pour la    font 10                                  d'une Agricultu we are going to check the  condition  Agence Wallonne pour la Promotion d'une Agricultu

    Hi Poojith
    Not sure if this would solve your requirment but just in case might be helpful:
    1. We can mix up the HTML and HTMLB components in the JSP Page. However, can access only the HTMLB components in the controller. The following link refers to what customizations are offered by the HTMLB framework:
    [http://www.sapdesignguild.org/resources/htmlb_guidance/]
    2. Another option would be to use AbstractPortalComponents or a simple web app if that's feasible. (where custom UI themes, css and layout are more in control of the developers.)
    Thanks
    Deepak

  • Spark textinput does not display unicode properly

    I need to type in some special charactors using unicode input method.
    (install microsoft pinyin, and use secondary inputs-> unicode input, and type "E826" into the textinput box)
    in spark textinput, the charactor is showing as a sqare; while mx textinput displays the charactor correctly.
    does anybody know solution for this issue? or is it a known bug in flex?  thanks!

    I did not set font for neither s:textinput nor mx:textinput.  "Arial" should be used by default.
    I am wondering how mx:textinput can work. is there any alternative font set for it by default?
    I am not sure which font contains these special charactors.
    thanks!

  • Change text highlight colour in Spark TextInput

    Hi,
    As the title says, anyone know how to change the highlight colour in a Spark TextInput component? By the "highlight colour" I mean that if some of the text is selected this would be the background colour of the selected text.
    Thanks.

    SetStyle("focusedTextSelectionColor", ...)
    There are also unfocusedTextSelectionColor and inactiveTextSelectionColor
    styles.

  • How can I add more than one same spry menu (eg. collapsible menu)  with in different styles (font size, color, background, etc) on current page?

    How can I add more than one same spry menu (eg. collapsible menu)  with in different styles (font size, color, background, etc) on current page?

    Hi Nancy,
    This screenshot was only for imagination. A part of the code (not all) is below.  In the code there are some background images but they are not seem in live mode.
    <!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></title>
    <link href="css/my_site.css" rel="stylesheet" type="text/css" />
    <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css"/>
    <link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
    <style>
    #CollapsiblePanel1 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-color: #003366;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel1 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        line-height: 52px;
    #CollapsiblePanel1 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/international.jpg);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel2 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel2 .CollapsiblePanelContent {
        background-color: blue;
    #CollapsiblePanel3 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel3 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel3 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel4 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel4 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel4 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel5 .CollapsiblePanelOpen .CollapsiblePanelTab {
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        font-size: 18px;
        line-height: 52px;
        color: #FFF;
    #CollapsiblePanel5 .CollapsiblePanelTabHover .CollapsiblePanelTab {
        background-color: #003366;
        color: #FFF;
        text-shadow: 1px 1px #000;
        font-weight: bold;
        background-image: url(images/TR_Col-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    #CollapsiblePanel5 .CollapsiblePanelClosed .CollapsiblePanelTab  {
        background-color: #C3CFDF;
        border-radius: 5px 5px 0px 0px;
        color: #999
        text-shadow: 1px 1px #000;
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        font-size: 18px;
        font-weight: bold;
        background-image: url(images/TR_Gray2-WEB.png);
        background-repeat: no-repeat;
        line-height: 52px;
    </style>

  • How Do You Populate A Spark List Control With An Array?

    Hello, all,
    Sorry to come accross so frustrated, but how in the name of God do you populate a Spark list control with the data in an array?  You used to be able to do this with the mx:List control, but the guys developing Flex just had to make things more difficult than they need to be!  I am more of a code purist and prefer doing things the way they have been done for decades, but apparently nothing can ever stay simple!
    I simply want to populate a list control with an array and this shouldn't be rocket science!  I found out that I must use a "collection" element, so I decided that an arrayCollection would be best.  However, after searching Adobe's documentation about arrayCollections, I am lost in a black hole of data binding, extra lines of code just to add a new element, the need to sort it, etc...!
    Here is my code:
    var pendingArray:ArrayCollection = new ArrayCollection();
    for ( var i:int = 0 ; i < queue.length ; i++ )
         var item:UserQueueItem = queue[i] as UserQueueItem ;
         if ( item.status == UserQueueItem.STATUS_PENDING )
         pendingArray.addItem({label:item.descriptor.displayName,descriptor:item.descriptor});
    Here is the relevant MXML:
    <s:VGroup>
         <s:List id="knockingList" width="110" height="100"/>              
    </s:VGroup>
    I'm not getting any errors, but the list is not populating.
    I have seen several examples where the arrayCollection is declared and populated in MXML:
            <mx:ArrayCollection id="myAC">
                <!-- Use an fx:Array tag to associate an id with the array. -->
                <fx:Array id="myArray">
                    <fx:Object label="MI" data="Lansing"/>
                    <fx:Object label="MO" data="Jefferson City"/>
                    <fx:Object label="MA" data="Boston"/>
                    etc...
               </fx:Array>
            </mx:ArrayCollection>
    That may be fine for an example, but I think this is a rare situation.  Most of the time I would image that the arrayCollection would be created and populated on the fly in ActionScript!  How can I do this?
    Thanks in advance for any help or advice anyone can give!
    Matt

    In your post it seemed like you were trying to take care of many considerations at once: optimization, design, architecture.  I would suggest you get something up and running and then worry about everything else.
    If I use data binding, then I will probably have to declare the  arrayCollection as a global variable and then I'll have to write 100 or  so extra lines of code to addItem(), removeItem(), sort(), etc...  It  just seems like too much overhead.
    I believe you may have some misconceptions about databinding in general.  You won't have to make it a global variable and you certainly won't need an extra 100 lines of code.  If you did this forum would be a very , very quiet place.
    I don't want to use data binding because the original array is refreshed  often and there is one function called by an event that re-declares the  arrayCollection each time, populates it with the array, and then sets  it as the list's dataprovider.
    That is the beauty of the ArrayCollection, it can handle the updates to its source Array. I don't know if you need to redeclare the ArrayCollection, resetting the source to the new Array allows everyone involved to keep their references so you don't have to worry about any "spooky" stuff going on.

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • Adding an effect to a TextInput Control

    Is there any way to show the text in a TextInput control as though it was being typed in by a user? I have a TextInput defined as follows:
    <mx:TextInput id="message2Input"
            width="100%" height="40"
            text="Type Message Here..."
            fontSize="18"
            maxChars="10"
             />
    I can change the string value for message2Input.text elsewhere in my mxml application. When I do, that text will be displayed in the control. But it gets displayed in its entirety, instantly. I need to have it displayed as if it was typed for reasons related to a customer demo. So if the string is "Dexter, a very interesting guy", I want it to appear incrementally as
    D
    D-e
    D-e-x
    etc etc.
    I don't seem to find any control effects for TextInput that allow this when I search the discussion forums. Does anyone have an example where they have done this programmatically? I tried changing message2Input.text within a for loop, "growing" the display text with each loop until the entire string has been "typed in". But I still only see the final complete text string. I suspect this is because the TextInput control only handles one event, and won't loop through a series of re-posts in an event handler. But I'm new to this, and only guessing here.
    This is the private function in my Flex mxml app that I use to post the message to the TextInput display:
    protected function _insert_chat_item_0(): void
                // this sets the delay to display of the next IM item in the sequence...      
                aoTimers.push(setTimeout(_insert_chat_item_1, 2000));
                // this sets the text that appears in the "I'm typing text" window...
                // TODO: can we make this appear like it is being typed? Have tried everything, with no luck
                message2Input.text = "Dexter, a very interesting guy";
            } // _insert_chat_item_0 for demo: Tom types in his initial message to John
    Thanks very much.
    -Jim

    Try using Jumpeye components. They provide swcs for flex use. Lot of  effects and animations are present.

Maybe you are looking for

  • Single adf task flow portlet with multiple pages and paramter from url

    Hi , I have made a adf task flow portlet with a parameter. I have made a portal applcation and added multiple pages . in each of the page I am consuming that portlet through wsrp2. I have mapped the task flow parameter in page bindings of the pages w

  • When starting the JSPM i get an error saying software component SAP_BUILDT

    software component SAP_BUILDT is missing from the system and will be generated using data from active usage AS. The next messege in the log tells me its been created successfully and I can see it the list of deployed components with an SP level of 0.

  • OC"ED from 3.2 to 3.711 Can't go Further

    With my sig. do you thing that i can go further if i picked up an 875 mobo and changed the ram to 4000 hyper x instead of the 3200 value. and if so should i stay with msi or get the p4800 e deluxe. Unless there is a better one. I am completly h2o coo

  • How to add Bookmarks ?

    What do I do to make my PDF file that we want to use as an e-book on our website have Bookmarks? I have never done this before.  I know we can add the e-book to oursite and then charge a fee to open it, but how do we bookmark the pages or selections 

  • Can I remove iphoto to reinstall without affecting my photos?

    My laptop crashed so Mac tech fixed it but updated iphoto with his Apple ID and now I can't do updates as it asks his password. He suggested removing iphoto and then reinstalling it. Will this affect my photos in iphoto?