Spark textarea in ItemRenderer

I have a problem with the text or text box in an ItemRenderer.

I created a simple ItemRenderer with two textarea.

In the complete creation of the ItemRenderer, I put the text in the box to a variabele of the oject of data of the item converter.

As follows:

chatText.text = this.data.message; (I know with certainty that the message string contains text at this stage).

When I use this ItemRenderer in a list it will show lines in the list, but the text box don't contain any text.

But when I click on the text box in a line, the text becomes vissible somehow.

It only occurs when use the textarea sparkles, the mx textarea shows the text immediately.

Am I missing a setting or what's new in flex 4?

Well, look at me as if it was a timing issue, need you adjust the data when the data arrives.

Try;



    
        
    
    
        
        
        
    


Mike

PS If you get a response from pointer zero return, you may need to invalidation. I don't remember if the new converters have their created children before or after the data set.

Tags: Flex

Similar Questions

  • How to hide or disable copy/paste option in the contextual menu on spark TextArea in Adobe AIR?

    I need to hide or disable copy/paste option in the contextual menu on spark TextArea in Adobe AIR.please help me. Thank you

    Try with this

    protected function editor_rightMouseDownHandler(event:MouseEvent):void

    {

    If ((editor.textDisplay as RichEditableText)! = null & .contextMenu (editor.textDisplay as RichEditableText)! = null)

    {

    ((Editor.textDisplay As RichEditableText).) ContextMenu as ContextMenu) .hideBuiltInItems ();

    ((Editor.textDisplay As RichEditableText).) ContextMenu as ContextMenu) .clipboardMenu = false;

    }

    }

    protected function editor_copyHandler(event:Event):void

    {

    Event.preventDefault ();

    System.setClipboard("");

    Clipboard.generalClipboard.clear ();

    }

  • Spark textArea - how to capture an event a link html click event

    The MX TextArea component has had in the past a TextEvent.LINK event that triggered when the user has clicked on a link inside the html text.  This has been removed from the component of the spark. I'm looking to intercept the event which opens the browser when a user clicks on a link inside the html text using the spark textArea component.

    See you soon

    StyleableTextField should be easier to handle.   If you change the URL in the href attribute of the tags to use the event: instead of http: and then the link even fires and you can then decide if you want to call NavigateToURL or not.

  • Spark TextArea remove border (borderVisible) in Flex 4.5 Hero

    When dealing with the text box for the development Mobile Flex Hero 4.5 I can't find a way to remove the border.

    < s:TextArea id = "lblPOC" left = "10" right = "10" top = low "10" = "10".

    borderColor = "#FFFFFF" borderVisible = "false" color = "#000000".

    contentBackgroundColor = "#FFFFFF" editable = "false" skinClass = "{null}"/ >

    setStyle does not work on the spark components, that I just discovered.
    Even htmlTexh, I had to:
    MobileTextField (lblPOC.textDisplay) .htmlText =

    Can someone help me remove the resident a spark TextArea in Flex 4.5?

    Thank you

    Eric

    Looks like you were using the preview version of Flex 4.5.  Setting to false BorderVisible works for me in the build of the 4.5 version:

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark" >

  • Flex 4 Spark Textarea without border

    Hello

    I have a s:TextArea in Flex 4.1 where I try to hide the border. Without success.

    I thought it would:

    < s:TextArea
    borderVisible = "false" >

    but the border is still there, also I can't change the color of the font.

    How would I do that?

    Thank you.

    Paul

    It works for me in Flex 4.1 and the latest internal builds:

    
    http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
        
            
        
        
            
            
            
        
    
        
    
    
    
    Peter
  • Spark TextArea, performance setFormatOfRange problem

    Hi you

    I'm building the syntax highlight editor using spark.components.textarea

    my application calls setFormatOfRange to put the color on the syntax. but I find that this API is very very slow.

    I need wait more than 10 seconds before the UI response me


    And if I comment on the setFormatOfRange, it works fine without delay

    Seems that the TLF is very slow at this point, is it not?

    Should I change back to use mx.controls.TextArea?  is it faster?

    Thank you

    Richard is the quickest way you can get to form a large number of words in a TextArea. Unfortunately, this solution may not be appropriate in some cases. Say you're listening to TextOperationEvent.CHANGE on a text box for changes to the wording and based on them to highlight certain words (similar to a code editor). If you apply the format using interactionManager, you get another TextOperationEvent.CHANGE and this can lead to an infinite loop.

    What I did to find out how setFormatOfRange works and imitate the code inside this method, using the ApplyFormatOperation and the CompositeOperation. Of course, normally you'll cope with such operations because that is the purpose of EditManager, but sometimes you need just a quick and the working solution.

    You can check this post for more details on how to use operations to format text inside a RichEditableText.

  • HTML "BOLD" text and regular on the Spark components with embeded fonts

    Hello!

    I took a quick glance to the textflow Flex 4 new (at least new to me).

    I use a spark textarea that is assigned to a style that uses a font embed, the problem is that when the textarea component renders the text marked in bold (using < span fontWeight = "bold" >) you lose the embeded font style.

    How to display bold text and text in the same text box using embeded fonts?

    Thanks in advance

    That's exactly what I was looking for:

    {@font-face}

    SRC:URL("..) ("/ assets/MyriadWebPro.ttf");

    fontFamily: myFont;

    embedAsCFF: true;

    }

    {@font-face}

    SRC:URL("..) /Assets/MyriadWebPro-bold.ttf");

    fontFamily: myFont;

    fontWeight: bold;

    embedAsCFF: true;

    }

    {@font-face}

    SRC:URL("..) /Assets/MyriadWebPro-italic.ttf");

    fontFamily: myFont;

    fontStyle: italic;

    embedAsCFF: true;

    }

    {.myPlainStyle}

    fontSize: 20;

    fontFamily: myFont;

    }

    {.myBoldStyle}

    fontSize: 20;

    fontFamily: myFont;

    fontWeight: bold;

    }

    {.myItalicStyle}

    fontSize: 20;

    fontFamily: myFont;

    fontStyle: italic;

    }

    so now I can put fonts on "myFont" style, and the Flash will be made to the police as a result.

    http://help.Adobe.com/en_US/Flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5f.html

    Nice!

  • TextArea "heightInLines" stopped working started SDK 4.1

    Interested in your opinion on SDK-26781 "Spark TextArea heightInLines has stopped working since SDK 4.0 to version 4.1 stable" which is currently closed.

    In 4.5.18623 Flex TextArea behavior had changed to the following:

    TextArea gets size in height correctly at the beginning and then the height of the text box changes abruptly applied with default skin ~1.5 lines during the editing session.

    Example code to illustrate this problem:

    <?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">
        <fx:Declarations>
            <fx:XML id="data">
                <flow:TextFlow xmlns:flow="http://ns.adobe.com/textLayout/2008">
                <flow:p>
                    <flow:span>There are many such lime-kilns in that tract of country, for the purpose of burning the white marble which composes a large part of the substance of the hills. Some of them, built years ago, and long deserted, with weeds growing in the vacant round of the interior, which is open to the sky, and grass and wild-flowers rooting themselves into the chinks of the stones, look already like relics of antiquity, and may yet be overspread with the lichens of centuries to come. Others, where the lime-burner still feeds his daily and nightlong fire, afford points of interest to the wanderer among the hills, who seats himself on a log of wood or a fragment of marble, to hold a chat with the solitary man. It is a lonesome, and, when the character is inclined to thought, may be an intensely thoughtful occupation; as it proved in the case of Ethan Brand, who had mused to such strange purpose, in days gone by, while the fire in this very kiln was burning.
                    </flow:span></flow:p>
                </flow:TextFlow>
            </fx:XML>
        </fx:Declarations>    
        <s:RichEditableText        
            id="ret"        
            width="200"        
            heightInLines="NaN"
            textFlow="{TextConverter.importToFlow(data,TextConverter.TEXT_LAYOUT_FORMAT)}">        
        </s:RichEditableText>
        <s:TextArea id="ta"
                    horizontalCenter="0" 
                    verticalCenter="0"
                    heightInLines="NaN"
                    textFlow="{TextConverter.importToFlow(data,TextConverter.TEXT_LAYOUT_FORMAT)}"/> 
    </s:Application>
    
     
    


    I spent this long to the Flex team. They say it's a matter of Flex, they have reopened the bug and study.

    Thank you for bringing this place.

    -robin

  • Size 'height' of TextArea by number of lines?

    I want my text boxes to be just large enough to hold the text.  Is it possible to scale the height for the number of lines in the text?

    Thank you.

    In spark TextArea, there is a heightInLines property

  • How can I make the border thicker TextArea?

    I want to make the border on certain areas of thicker/more bold text.  CAN/how this is done?

    Thank you.

    @learner,

    I didn't test this very well, but it seems that you will need create a custom look for spark TextArea and change the weight of the race:

    weight = "5"/ >

    And then it looks like you need tweaking the updateDisplayList to manage non - 1px width border.

    override the updateDisplayList(unscaledWidth:Number,_unscaledHeight:Number):void function

    {

    If (("borderVisible") value is true)

    {

    Border.Visible = true;

    Shadow.Visible = true;

    Background.Left = background.top = background.right = background.bottom = borderStroke.weight;

    textDisplay.left = textDisplay.top = textDisplay.right = textDisplay.bottom = borderStroke.weight;

    scroller. Left = scroller.right = scroller.top = scroller.bottom = borderStroke.weight;

    If {(promptDisplay)

    promptDisplay.setLayoutBoundsSize (unscaledWidth - 5, unscaledHeight - 5);

    promptDisplay.setLayoutBoundsPosition (5, 5);

    }

    }

    on the other

    {

    Border.Visible = false;

    Shadow.Visible = false;

    Background.Left = background.top = background.right = background.bottom = 0;

    If (promptDisplay)

    {

    promptDisplay.setLayoutBoundsSize (unscaledWidth - 1, unscaledHeight - 1);

    promptDisplay.setLayoutBoundsPosition (1, 1);

    }

    }

    borderStroke.color = value ("borderColor");

    borderStroke.alpha = value ("borderAlpha");

    super.updateDisplayList (unscaledWidth, unscaledHeight);

    }

    Full skin attached (it was a bit too long to paste here).

    A better solution out there, but it was probably the first thing that comes to mind.

    Peter

  • Style a TextArea

    So I'll try a relatively simple application of style where I show a list of dynamically generated text entries. The entire application, less code CPP, consists of a VBox with linebreaks added dynamically to the Interior. I'm under problems styling the TextArea. Above all I want to do has a background color and background alpha, but I am happy to be able to throw a picture out there at this point. The CSS-esque style is not doing something when I put a background color. I believe that in the projects previous, I could just set 'backgroundColor' and 'backgroundAlpha' and be on my way, but it does not work for some reason any. I use Flex 4 with default Spark theme.

    My guess is that you'll want to create a skinClass to do this with Flex 4. Sounds like a pain but it's actually pretty easy. While you can do many things with the new architecture of the skin, to begin with, drop a textArea on the stage component. In the properties of right panel where he says skin, click on the drop-down list box and choose Create. It's a copy of the skin of default text box.

    If this does not work for you (and it is not for me but used to) go on the Package Explorer, create a new folder in your src called skins or something. Then right-click on the folder and choose new skin MXML and based on the Spark.TextArea (click on the Browse button to the host component). Type a name like MyTextAreaSkin for the skin, and you're ready.

    Now you have a skin that you can visually model quite easily. When you dynamically create your textAreas in your code, create the skinclass - something like myTextArea.setStyle ("skinClass", skins. MyTextArea);

    Hope that works for you. Once you get used to the use of the new approach to skin, I think you'll like what you have much more control with just a few steps.

  • Scroller in s:TextArea can appear on the left?

    Hello

    I need to enter (spark) TextArea scrolling to appear depending on the writing language.

    IE: scrolling to the RIGHT in LTR languages and scrolling to the LEFT in RTL languages.

    For now, it looks like the scrolling is hard coded to be right.

    I did some research and found the suggestion of how to get a similar thing in Sparks lists (the s:Scroller in the skin class to s:VScrollBar), but in this way, that scrolling is permanent, and I need the smooth scrolling in the behavior of textArea - this wheel is added only when the text overflows the size.

    No idea how to do it?

    Dafna @Mrs,

    Flex 4.1 adds better support for RTL languages. Then, you should be able to set the direction and the layoutDirection style, as seen in the following example:

    
    http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
    
        
    
    
    
    Hope that helps,
    Peter
  • Flex TextArea attack does not

    Hello

    When I put leading to 0 with Verdana (and others) to a Flex TextArea I get strange results:

    FontSize-> space between base lines
    8 > 10 (125%)
    10 > 12 (120%)
    12 > 14 (117%)
    14 > 17 (121%)
    16 > 18 (113%)
    18 > 22 (122%)

    20 > 25 (125%)
    25 > 31 (124%)

    If all these should not be the same (should be only 100%)? Or less follow a pattern, because I can't get everything.
    When I set to 0, the space between my base lines should be the same as the size of police/height. This isn't the case here.

    How to find out how to get the space between the base line equal up to the police?

    If you use the MX TextArea component, you get the 'interesting' of Flash Player's TextField class linespacing behavior. The Spark TextArea component is

    based on the new Text Layout Framework, which offers all types of control over linespacing you're looking for.

    Smitn Gordon

    Adobe Flex SDK team

  • Confusion DefaultItemRender help me.

    When you do something like this:

    < s:DataGroup id = "dataGroup" itemRenderer = "nikos.itemRenderers.LightBlueDefaultItemRenderer" >

    rather than use the DefaultItemRenderer

    You automactically have all the code for the DefaultItemRenderer

    That is, my LightBlueDefaultItemRenderer is the following:

    <? XML version = "1.0" encoding = "utf-8"? >
    < s:ItemRenderer focusEnabled = "false".
                    xmlns:fx=" http://ns.Adobe.com/MXML/2009 "xmlns:s ="library://ns.adobe.com/flex/spark" "
    autoDrawBackground = "true" >

    < s: states >
    < name s: State = "normal" / >
    < name s: State = "flat" / >
    < name s: State = "selected" / >
    < name s: State = "normalAndShowsCaret" / >
    < name s: State = "hoveredAndShowsCaret" / >
    < name s: State = "selectedAndShowsCaret" / >
    < / s: states >

    < s:Label id = "labelDisplay".
    Red = "0" left = "3" right = '3' high low = '6' = '4 '.
    "" fontFamily.normal = "Verdana" / color.selected = "red color.normal =" #46F9FB "color.hovered =" green"" fontWeight.normal = "bold" >

    < / s:ItemRenderer >

    but the DefaultItemRenderer code is much more complex as follows:

    ////////////////////////////////////////////////////////////////////////////////
    //
    ADOBE SYSTEMS INCORPORATED
    Copyright 2004 - 2007 Adobe Systems Incorporated
    All rights reserved.
    //
    NOTE: Adobe permits you to use, modify, and distribute this file
    under the terms of the license agreement that accompanies it.
    //
    ////////////////////////////////////////////////////////////////////////////////

    package spark.skins.spark
    {

    import flash.display.DisplayObject;
    import flash.events.MouseEvent;
    to import flash.geom.Point;

    Mx.controls.listClasses import. *;
    Import mx.core.IDataRenderer;
    Import mx.core.UIComponent;
    Import mx.core.mx_internal;
    Import mx.events.FlexEvent;

    Import spark.components.IItemRenderer;
    Import spark.components.Label;
    Import spark.components.supportClasses.TextBase;

    Use namespace mx_internal;

    //--------------------------------------
    Events
    //--------------------------------------

    /**
    * Dispatched when the data < code > < code > changes to the property.
    *
    * < p > when you use a component as a driving force of rendering,
    * the data < code > < code > property contains the data to display.
    * You can listen for this event and update the component
    * When the data < code > < code > property change. < /p >
    *
    * @eventType mx.events.FlexEvent.DATA_CHANGE
    *
    * @langversion 3.0
    * flash 9 @playerversion
    * @playerversion AIR 1.1
    * @productversion flex 3
    */
    [Event (name = "dataChange", type = "mx.events.FlexEvent")]

    //--------------------------------------
    Styles
    //--------------------------------------

    include "... /.. '. "/ styles/metadata/BasicInheritingTextStyles.as".
    include "... /.. '. "/ styles/metadata/AdvancedInheritingTextStyles.as".
    include "... /.. '. "/ styles/metadata/SelectionFormatTextStyles.as".

    /**
    Color to use for the backgrounds of the items in the list.
    * The value is an array of two or more colors.
    * The backgrounds of the items on the list among the colors of the table.
    *
    * undefined @default
    *
    * @langversion 3.0
    * @playerversion flash 10
    * @playerversion AIR 1.5
    * @productversion flex 4
    */
    [Style (name = "alternatingItemColors", type = "Array", arrayType = "uint", format ="color", inherit = "yes", topic = "spark")]

    /**
    * Color of the focus ring when the component is in short
    *
    * @default 0x70B2EE
    *
    * @langversion 3.0
    * @playerversion flash 10
    * @playerversion AIR 1.5
    * @productversion flex 4
    */
    [Style (name = "focusColor", type = "uint", format ="color", inherit = "yes", topic = "spark")]

    /**
    * The color of the highlights when the mouse is over the component
    *
    * @default 0xCEDBEF
    *
    * @langversion 3.0
    * @playerversion flash 10
    * @playerversion AIR 1.5
    * @productversion flex 4
    */
    [Style (name = "rollOverColor", type = "uint", format ="color", inherit = "yes", topic = "spark")]

    /**
    The color of any symbol of a component. Examples of the box of a CheckBox control or
    * the arrow of a scroll button
    *
    * @default 0x000000
    *
    * @langversion 3.0
    * @playerversion flash 10
    * @playerversion AIR 1.5
    * @productversion flex 4
    */
    [Style (name = "symbolColor", type = "uint", format ="color", inherit = "yes", topic = "spark")]

    //--------------------------------------
    Excluded API
    //--------------------------------------

    [Exclude (name = "focusBlendMode", type = "style")]
    [Exclude (name = "focusThickness", type = "style")]

    /**
    * The DefaultItemRenderer class defines the default item converter
    for a list control.
    * The default item converter draws just the associated text
    * with each item in the list.
    *
    * < p > you can override the default value for the motor point of rendering
    * by creating a custom item renderer. < /p >
    *
    * @see spark.components.List
    * @see mx.core.IDataRenderer
    * @see spark.components.IItemRenderer
    * @see spark.components.supportClasses.ItemRenderer
    *
    * @langversion 3.0
    * flash 9 @playerversion
    * @playerversion AIR 1.1
    * @productversion flex 3
    */
    SerializableAttribute public class extends UIComponent DefaultItemRenderer
    implements IDataRenderer, IItemRenderer
    {

    //--------------------------------------------------------------------------
    //
    Constructor
    //
    //--------------------------------------------------------------------------

    /**
    * Constructor.
    *
    * @langversion 3.0
    * flash 9 @playerversion
    * @playerversion AIR 1.1
    * @productversion flex 3
    */
    public void DefaultItemRenderer()
    {
    Super();

    addHandlers();
    }

    //--------------------------------------------------------------------------
    //
    Variables
    //
    //--------------------------------------------------------------------------

    //--------------------------------------------------------------------------
    //
    Private properties
    //
    //--------------------------------------------------------------------------

    /**
    * @private
    * Indicator that is set when the mouse is passed the item converter.
    */
    private var hovered: Boolean = false;

    //--------------------------------------------------------------------------
    //
    Substitution of properties: UIComponent
    //
    //--------------------------------------------------------------------------

    //----------------------------------
    baselinePosition
    //----------------------------------

    /**
    * @private
    */
    override public function get baselinePosition (): number
    {
    If (! labelDisplay |! validateBaselinePosition())
    Return super.baselinePosition;

    Return labelDisplay.y + labelDisplay.baselinePosition;
    }

    //--------------------------------------------------------------------------
    //
    Public properties
    //
    //--------------------------------------------------------------------------

    //----------------------------------
    data
    //----------------------------------

    /**
    * @private
    * Storage of property data.
    */
    private var _data:Object;

    [Bindable ("dataChange")]

    /**
    * The implementation data < code > < code > property
    as defined by the IDataRenderer interface.
    * When set, it stores the value and invalidate the component
    * to trigger a new provision of the component.
    *
    * @see mx.core.IDataRenderer
    *
    * @langversion 3.0
    * flash 9 @playerversion
    * @playerversion AIR 1.1
    * @productversion flex 3
    */
    public function get data (): object
    {
    return _data;
    }

    /**
    * @private
    */
    public function set data(value:Object):void
    {
    _data = value;

    dispatchEvent (new FlexEvent (FlexEvent.DATA_CHANGE));
    }

    //----------------------------------
    itemIndex
    //----------------------------------

    /**
    * @private
    * storage of the itemIndex property
    */
    private var _itemIndex:int;

    /**
    * @inheritDoc
    *
    * @default 0
    */
    public function get itemIndex (): int
    {
    Return _itemIndex;
    }

    /**
    * @private
    */
    public function set itemIndex(value:int):void
    {
    If (value == _itemIndex)
    return;

    _itemIndex = value;
    invalidateDisplayList();
    }

    //----------------------------------
    label
    //----------------------------------

    /**
    * @private
    * Storage var for label
    */
    private var _label:String = "";

    /**
    * @inheritDoc
    *
    * @default «»
    */
    public function get label (): String
    {
    Return _label;
    }

    /**
    * @private
    */
    public function set label(value:String):void
    {
    If (value is _label)
    return;

    _label = value;

    Lower the label in the labelDisplay
    If there is
    If (labelDisplay)
    Displaylabel.text = _label;
    }

    //----------------------------------
    labelDisplay
    //----------------------------------

    /**
    The component of label made available as an option.
    * This component is used to determine the value of the
    * < code > < code > baselinePosition property in the host component of
    * the item converter.
    *
    * @langversion 3.0
    * @playerversion flash 10
    * @playerversion AIR 1.5
    * @productversion flex 4
    */
    public var labelDisplay:TextBase;

    //----------------------------------
    showsCaret
    //----------------------------------

    /**
    * @private
    * Storage of the property of showsCaret
    */
    private var _showsCaret:Boolean = false;

    /**
    * @inheritDoc
    *
    * fake @default
    */
    public function get showsCaret (): Boolean
    {
    Return _showsCaret;
    }

    /**
    * @private
    */
    public function set showsCaret(value:Boolean):void
    {
    If (value == _showsCaret)
    return;

    _showsCaret = value;
    invalidateDisplayList();
    }

    //----------------------------------
    selected
    //----------------------------------
    /**
    * @private
    * storage for the selected property
    */
    private var _selected:Boolean = false;

    /**
    * @inheritDoc
    *
    * fake @default
    */
    public function get selected (): Boolean
    {
    return _selected;
    }

    /**
    * @private
    */
    public function set selected(value:Boolean):void
    {
    If (value! = _selected)
    {
    _selected = value;
    invalidateDisplayList();
    }
    }

    //----------------------------------
    by dragging
    //----------------------------------

    /**
    * @private
    * Ownership of pieces hanging storage.
    */
    private var _dragging:Boolean = false;

    /**
    * @inheritDoc
    */
    public function get dragging (): Boolean
    {
    Return _dragging;
    }

    /**
    * @private
    */
    public function set dragging(value:Boolean):void
    {
    If (value == _dragging)
    return;

    _dragging = value;
    }

    //--------------------------------------------------------------------------
    //
    Alternative methods: UIComponent
    //
    //--------------------------------------------------------------------------

    /**
    * @private
    */
    override protected function createChildren() (): void
    {
    super.createChildren ();

    If (! labelDisplay)
    {
    labelDisplay = new Sun;
    addChild (DisplayObject (labelDisplay));
    If (_label! = "")
    Displaylabel.text = _label;
    }
    }

    /**
    * @private
    */
    override protected function measure (): void
    {
    Super.Measure ();

    label has a padding of 3 left and right and 5 at the top and bottom padding.
    measuredWidth = labelDisplay.getPreferredBoundsWidth () + 6;
    measuredHeight = labelDisplay.getPreferredBoundsHeight () + 10;

    measuredMinWidth = labelDisplay.getMinBoundsWidth () + 6;
    MaxHeight = labelDisplay.getMinBoundsHeight () + 10;
    }

    /**
    * @private
    */
    override protected function updateDisplayList (unscaledWidth:Number,
    unscaledHeight:Number): void
    {
    super.updateDisplayList (unscaledWidth, unscaledHeight);

    Graphics.Clear;

    var backgroundColor:uint;
    var drawBackground:Boolean = true;
    If (selected)
    backgroundColor = value ("selectionColor");
    ElseIf (stationary)
    backgroundColor = value ("rollOverColor");
    on the other
    {
    var alternatingColors:Array = value ("alternatingItemColors");

    If (alternatingColors & & alternatingColors.length > 0)
    {
    These colors translates uints
    styleManager.getColorNames (alternatingColors);

    backgroundColor = alternatingColors [% alternatingColors.length itemIndex];
    }
    on the other
    {
    If it's the contentBackgroundColor don't draw background. The
    skin list manages the background drawing for us.
    drawBackground = false;
    }
    }

    graphics.beginFill (backgroundColor, drawBackground? 1: 0);

    If (showsCaret)
    {
    graphics.lineStyle (1, value ("selectionColor"));
    graphics.drawRect (0.5, 0.5, 1-unscaledWidth, unscaledHeight-1);
    }
    on the other
    {
    graphics.lineStyle ();
    graphics.drawRect (0, 0, unscaledWidth, unscaledHeight);
    }

    graphics.endFill ();

    Make sure our width/height is in min/max for the label
    var childWidth:Number = unscaledWidth - 6;
    childWidth = Math.max (labelDisplay.getMinBoundsWidth (), Math.min (labelDisplay.getMaxBoundsWidth (), childWidth));

    var childHeight:Number = unscaledHeight - 10;
    childHeight = Math.max (labelDisplay.getMinBoundsHeight (), Math.min (labelDisplay.getMaxBoundsHeight (), childHeight));

    define the position and size of the label
    labelDisplay.setLayoutBoundsSize (childWidth, childHeight);
    labelDisplay.setLayoutBoundsPosition (3, 5);
    }

    //--------------------------------------------------------------------------
    //
    Event management
    //
    //--------------------------------------------------------------------------

    /**
    * @private
    To reach the mouse events.
    */
    private void addHandlers (): void
    {
    addEventListener (MouseEvent.ROLL_OVER, itemRenderer_rollOverHandler);
    addEventListener (MouseEvent.ROLL_OUT, itemRenderer_rollOutHandler);
    }

    /**
    * @private
    */
    private void anyButtonDown(event:MouseEvent):Boolean
    {
    var type: String = event.type;
    return event.buttonDown | (type == "middleMouseDown"). (type is "rightMouseDown");
    }

    /**
    * @private
    * Event handler in rolling mouse.
    */
    protected function itemRenderer_rollOverHandler(event:MouseEvent):void
    {
    If (! anyButtonDown (event))
    {
    Hung = true;
    invalidateDisplayList();
    }
    }

    /**
    * @private
    * Deployment handler mouse.
    */
    protected function itemRenderer_rollOutHandler(event:MouseEvent):void
    {
    Hung = false;
    invalidateDisplayList();
    }

    }

    }

    Hello

    The DefaultItemRenderer is a lightweight UIComponent that renders a background and a label. He has designed to be rendered quick and is not a subclass of DataRenderer as ItemRenderer is.

    You subclassed ItemRenderer, so you get much more then the DefaultItemRenderer gives you (layout, States, etc.).

    You must use ItemRenderer in mxml because you need the layout (of the Group).

    Mike

  • Flex 4: what is an alternative for mx:html?

    There was formerly a < mx:HTML / > tag in Flex 3 to html to display, that has happened to him in Flex 4? What are the alternatives, if any?

    The htmlText property, which is simply based on the htmlText of the player's TextField property, supports a limited subset of HTML.

    If you use (which is based on the new framework of layout of text rather than TextField), you can use the TextConverter of TLF class to convert one same small subset of HTML in a TextFlow to be returned by the Spark TextArea.

    If you need a full HTML support outside AIR, you must create a browser or an iframe and float it on top of your Flex application so that it looks like it's part of the application.

    Players of the web do not include a HTML rendering engine as AIR because it would be the size of these too big players. For example, I believe that WebKit in AIR is greater than 10 MB of code.

    Gordon Smith

    Adobe Flex SDK team

Maybe you are looking for