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

  • SEARCH
  • Home
  • 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 4231292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:57:13+00:00 2026-05-21T01:57:13+00:00

I’m writing a s:ItemRenderer to render some simple graphical components in my app. Each

  • 0

I’m writing a s:ItemRenderer to render some simple graphical components in my app. Each element can have multiple shapes that can be selected by the user, i.e. a certain element can be a square, or a circle, or a star, or whatever else.

The simplest way I could think for doing this was to include all possible shapes in a s:Group and then manage their visible tag depending on what shape the user has selected. Is there a better way to do that?

Also, if I encapsulate the group in a separate MXML component, how do I propagate the state of the itemRenderer (say “hovered”) down to the MXML component that manages the shapes?

thank you!

f


Edited: here’s a code snippet to better explain the situation. Let’s say you want to display three types of objects alternatively – the IR below with an AS snippet that turns visible to false for 2 out of the 3 objects definitely does the trick, but seems so ugly to me. In the mean time I found setCurrentState(stateName:String, playTransition:Boolean=true) to propagate the state down, so that’s solved.

<s:ItemRenderer>
<s:states>
    <s:State name="normal" />
    <s:State name="hovered" />
</s:states>
<s:Group width="100%">
    <s:Rect width="20" height="10" radiusX="3" radiusY="3">
        <s:stroke>
            <s:SolidColorStroke color="Black" weight="1" pixelHinting="true"/>
        </s:stroke>
        <s:fill>
            <s:SolidColor color="red" />
        </s:fill>
    </s:Rect>
    <s:Rect id="square" width="10" height="10" radiusX="3" radiusY="3">
        <s:stroke>
            <s:SolidColorStroke color="Black" weight="1" pixelHinting="true"/>
        </s:stroke>
        <s:fill>
            <s:SolidColor color="green"/>
        </s:fill>
    </s:Rect>
    <s:Ellipse id="circle" visible="true" width="10" height="10">
        <s:stroke>               
            <s:SolidColorStroke color="Black" pixelHinting="true" weight="1"/>     
        </s:stroke>          
        <s:fill>
            <s:SolidColor color.normal="yellow" color.hovered="0xCEDBEF"/>
        </s:fill>
    </s:Ellipse>
</s:Group>

  • 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-21T01:57:13+00:00Added an answer on May 21, 2026 at 1:57 am

    The simplest way I could think for
    doing this was to include all possible
    shapes in a s:Group and then manage
    their visible tag depending on what
    shape the user has selected. Is there
    a better way to do that?

    Yes. Item renderers need to be made as light weight as possible. Using the includeInLayout would be a bit better since it will only add what you need to the display list.

    Also, if I encapsulate the group in a
    separate MXML component, how do I
    propagate the state of the
    itemRenderer (say “hovered”) down to
    the MXML component that manages the
    shapes?

    I’m not quite sure I understand the question. Item renderer are data driven, so their instances have no reliable state. Renderer instances may display any given data item at any given time. Any information passed to an item renderer should be passed down through it’s data item or you will run into syncing errors in your display.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build

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.