Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:18:17+00:00 2026-05-24T22:18:17+00:00

I’ve been working with the flex charting component and I want to embed a

  • 0

I’ve been working with the flex charting component and I want to embed a custom icon for the marker in the legend. I’ve run into some strange behaviour where if set directly the icon is mirrored and the text is misaligned but if created using the a class factory and the legendMarkerRenderer property the component renders fine. I’ve included a snippet to illustrate the problem below.

Working around this problem may be possible but I’m curious if anyone has an explanation as to what could be going on here.

Additional info: Flex SDK 4.5.0.20967, FlashBuilder 4.5

This is the output of the below snippet:

Application Snippet

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
    <fx:Script>
    <![CDATA[
        import mx.charts.LegendItem;

        [Embed(source="/resources/GraphResetIcon.png")]
        public static var icon:Class;
    ]]>
    </fx:Script>
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <!-- This works fine -->
    <mx:LegendItem legendMarkerRenderer="{new ClassFactory(icon)}" markerAspectRatio="1" 
        labelPlacement="right" label="Texty texty" markerHeight="11" markerWidth="11" />

    <!-- This does not work -->
    <mx:LegendItem marker="{new icon()}" markerAspectRatio="1" labelPlacement="right"     
        label="Texty texty" markerHeight="11" markerWidth="11" />

</s:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:18:20+00:00Added an answer on May 24, 2026 at 10:18 pm

    Try

    <mx:LegendItem marker="{icon}" markerAspectRatio="1" labelPlacement="right"              label="Texty texty" markerHeight="11" markerWidth="11" /> 
    

    Edit:

    I dug out my backup hard drive, and here is what works for me

    //button icons          
    [Embed(source='com/magnoliamultimedia/assets/guess.png')]
    private var guessIcon:Class;
    [Embed(source='com/magnoliamultimedia/assets/half_guess.png')]
    private var halfGuessIcon:Class;
    [Embed(source='com/magnoliamultimedia/assets/not_guess.png')]
    //bitmapasset for markers
    [Bindable]
    private var _guessBA:BitmapAsset;
    [Bindable]
    private var _halfGuessBA:BitmapAsset;
    [Bindable]
    private var _notGuessBA:BitmapAsset;
    
    ///...
    private function init():void{
        _guessBA = BitmapAsset(new guessIcon());
        _halfGuessBA = BitmapAsset(new halfGuessIcon());
        _notGuessBA= BitmapAsset(new notGuessIcon());
        _markerHeight = _guessBA.height*.75;
        _markerWidth = _guessBA.width*.75;
        legend.visible = true;
    }
    //...
    <mx:Canvas id="legend" width="{Application.application.width}" height="75" 
        backgroundColor="#FFFFFF" visible="false">
        <mx:constraintColumns>
            <mx:ConstraintColumn id="rowName" width="20%" />
            <mx:ConstraintColumn id="legend1" width="25%" />
            <mx:ConstraintColumn id="legend2" width="25%" />
            <mx:ConstraintColumn id="legend3" width="25%" />
        </mx:constraintColumns>
        <mx:constraintRows>
            <mx:ConstraintRow id="colors" />
            <mx:ConstraintRow id="icons" />
        </mx:constraintRows>
        <!--color legends-->
        <mx:LegendItem label="Colors:" id="colorCol1" visible="false"
                top="colors:10" left="rowName:10" right="legend1:10" fill="{noFill}"
                markerHeight="0" markerWidth="0" />
        <mx:LegendItem label="Correct" id="colorCol2" visible="false"
                top="colors:10" left="legend1:10" right="legend2:10" 
                fill="{greenFill}" stroke="{outline}" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
        <mx:LegendItem label="Wrong" id="colorCol3" visible="false"
                top="colors:10" left="legend2:10" right="legend3:10" 
                fill="{redFill}" stroke="{outline}" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
        <mx:LegendItem label="Not Attempted" id="colorCol4" visible="false"
                top="colors:10" left="legend3:10" 
                fill="{defaultFill}" stroke="{outline}" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
        <mx:HRule id="separator" top="icons:5" left="10" right="10" visible="false" />
            <!--icon legends-->
            <mx:LegendItem label="Icons:" 
                top="icons:10" left="rowName:10" right="legend1" fill="{noFill}" 
                markerHeight="0" markerWidth="0" />
            <mx:LegendItem label="Guess" 
                top="icons:10" left="legend1:10" right="legend2:10" 
                marker="{_guessBA}" markerAspectRatio="1" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
            <mx:LegendItem label="Half Guess" 
                top="icons:10" left="legend2:10" right="legend3:10" 
                marker="{_halfGuessBA}" markerAspectRatio="1" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
            <mx:LegendItem label="Not A Guess" 
                top="icons:10" left="legend3:10" 
                marker="{_notGuessBA}" markerAspectRatio="1" 
                markerHeight="{_markerHeight}" markerWidth="{_markerWidth}" />
    </mx:Canvas>
    <!--legend colors-->
    <mx:SolidColor id="redFill" color="0x990000" />
    <mx:SolidColor id="greenFill" color="0x003300" />
    <mx:SolidColor id="defaultFill" color="0xE6EEEE" />
    <mx:SolidColor id="noFill" color="0xE6EEEE" alpha="0" />
    <mx:Stroke id="outline" color="0" weight="1" />
    

    In principle, this is almost the same as what you started out with, but I explicitly cast the newly created Class instance to BitmapAsset.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.