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 848217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:54:30+00:00 2026-05-15T06:54:30+00:00

The following is a MXML Module I am producing in Flex 4: <?xml version=1.0

  • 0

The following is a MXML Module I am producing in Flex 4:

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx"
           creationComplete="init()"
           layout="absolute" width="100%" height="100%">

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Style source="BMChartModule.css" />

    <s:Panel id="panel" title="Benchmark Results" height="100%" width="100%" dropShadowVisible="false">
        <mx:TabNavigator id="tn" height="100%" width="100%" />
    </s:Panel>

    <fx:Script>
        <![CDATA[
            import flash.events.Event;

            import mx.charts.ColumnChart;
            import mx.charts.effects.SeriesInterpolate;
            import mx.controls.Alert;

            import spark.components.BorderContainer;
            import spark.components.Button;
            import spark.components.Label;
            import spark.components.NavigatorContent;
            import spark.components.RadioButton;
            import spark.components.TextInput;
            import spark.layouts.*;

            private var xml:XML;

            private function init():void
            {               
                var seriesInterpolate:SeriesInterpolate = new SeriesInterpolate();
                seriesInterpolate.duration = 1000;

                xml = parentApplication.model.xml;
                var sectorList:XMLList = xml.SECTOR;

                for each(var i:XML in sectorList)
                {               
                    var ncLayout:HorizontalLayout = new HorizontalLayout();

                    var nc:NavigatorContent = new NavigatorContent();
                    nc.label = i.@NAME;
                    nc.name = "NC_" + nc.label;
                    nc.layout = ncLayout;
                    tn.addElement(nc);

                    var cC:ColumnChart = new ColumnChart();
                    cC.percentWidth = 70;
                    cC.name = "CC";
                    nc.addElement(cC);

                    var bClayout:VerticalLayout = new VerticalLayout();

                    var bC:BorderContainer = new BorderContainer();
                    bC.percentWidth = 30;
                    bC.layout = bClayout;
                    nc.addElement(bC);

                    var bClabel:Label = new Label();
                    bClabel.percentWidth = 100;
                    bClabel.text = "Select a graph to view it in the column chart:";

                    var dpList:XMLList = sectorList.(@NAME == i.@NAME).DATAPOINT;
                    for each(var j:XML in dpList)
                    {       
                        var rB:RadioButton = new RadioButton();
                        rB.groupName = "dp";
                        rB.label = j.@NAME;
                        rB.addEventListener(MouseEvent.CLICK, rBclick);
                        bC.addElement(rB);
                    }

                }           
            }

            private function rBclick(e:MouseEvent):void
            {
                var selectedTab:NavigatorContent = this.tn.selectedChild as NavigatorContent;
                var colChart:ColumnChart = selectedTab.getChildByName("CC") as ColumnChart;
                trace(selectedTab.getChildAt(0));
            }
        ]]>
    </fx:Script>

</mx:Module>

I’m writing this function rBclick to redraw the column chart when a radio button is clicked. In order to do this I need to find the column chart on the stage using actionscript. I’ve currently got 3 lines of code in here to do this:

            var selectedTab:NavigatorContent = this.tn.selectedChild as NavigatorContent;
            var colChart:ColumnChart = selectedTab.getChildByName("CC") as ColumnChart;
            trace(selectedTab.getChildAt(0));

Getting to the active tab in the tabnavigator is easy enough, but then selectedTab.getChildAt(0) – which I was expecting to be the chart – is a “spark.skin.spark.SkinnableContainerSkin”…anyway, I can continue to traverse the tree using this somewhat annoying code, but I’m hoping there is an easier way.

So in short, at run time I want to, with as little code as possible, identify the column chart in the active tab so I can redraw it. Any advice would be greatly appreciated.

  • 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-15T06:54:31+00:00Added an answer on May 15, 2026 at 6:54 am

    It seems you can use some abstraction.

    • Create a new mxml component that extends HorizontalLayout and contains the column chart, vertical layout, border container, label etc.
    • Inside that, declare a public variable chart for the ColumnChart instance
    • Declare a public init() method that an item of SECTOR element and initializes the component.
    • Add instances of this new mxml component as children to the TabNavigator

    Now you can easily access the column chart as NewComp(tn.selectedTab).chart

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

Sidebar

Related Questions

Consider the following radio button example. <?xml version=1.0 encoding=utf-8?> <mx:Application xmlns:mx=http://www.adobe.com/2006/mxml> <mx:Script> <![CDATA[ private
Flex4 provides the following namespaces: xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/halo What's the difference? Which namespace provide
Following StockWatcher tutorial, http://code.google.com/webtoolkit/doc/latest/tutorial/debug.html When I run the app in debug mode, my Safari
Following my question regarding a .NET YAML Library ... as there doesn't seem to
Following this question: Good crash reporting library in c# Is there any library like
Following Izb's question about Best binary XML format for JavaME , I'm looking for
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
So I have a module in flex in which I add a custom component.
I have the following MXML: <mx:Script> var someBoolean:Boolean = determineSomeCondition(); </mx:Script> .... <foo:MyComponent somePropertyExpectingIDataRenderer={
I have the following MXML: <mx:State name=myState> <mx:AddChild relativeTo={myhbox} position=after> <mx:Box verticalAlign=middle horizontalAlign=center width=100%

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.