Doesn't myModelInstance.vAxis1 work? Every MXML file defines a class, and every 
tag with an id defines a property in that class, where the name of the property 
is specified by the id. So when you have an instance of that class, you should 
just be able to use the dot operator to access that property, in the same way 
that you would access a public var or public getter in the class.

- Gordon

-----Original Message-----
From: Deepak MS [mailto:[email protected]] 
Sent: Friday, August 16, 2013 5:17 AM
To: [email protected]
Subject: Re: How to get a class instance using string name?

To be precise, I was using linear axis in a model class, and i used 
myModelInstance["vAxis1"] and that worked. : ) That was simple concept but I 
kept banging my head with all types of combinations using  
getDefinitionByName....getQualifiedClassName.....

Thanks for the help everyone...

Cheers!


On Fri, Aug 16, 2013 at 5:23 PM, Jitendra Jain < [email protected]> 
wrote:

> you can use myComponentName["myView"] where myComponentName is the 
> parent one and myView is the child
>
>
> On Fri, Aug 16, 2013 at 5:09 PM, Deepak MS <[email protected]>
> wrote:
>
> > Hi there,
> >
> > Is there a way we can get a running instance in our application, by 
> > using it's id as a String?
> >
> >
> >
> > For ex:
> >
> > I have a mxml line which is
> >
> > <mx:LinearAxis id="vAxis1"  title="Growth%"
> > labelFunction="percentageformatAxis"  />
> >
> >
> >
> >
> >
> > There is a data xml in which these instance names (vAxis1, vAxis2 ...)
> shall
> > be declared:
> >
> >
> >
> > <doc>
> >
> >
> > <row metricId="1" metricName="AUD" attribute="@AUD" checked="1"
> > chartType="1" verticalAxis="vAxis1">
> >
> >
> > <row metricId="2" metricName="AUD Growth %" attribute="@AUDGrowth"
> > checked="1" chartType="2" verticalAxis="vAxis2"/>
> >
> >
> > </row>
> >
> >
> > <row metricId="3" metricName="AUD MS" attribute="@AUDMSPerc" checked="0"
> > chartType="2" verticalAxis="vAxis3">
> >
> >
> >                 <row metricId="4" metricName="AUD MS Growth %"
> > attribute="@AUDMSGrowth" checked="0" chartType="1"
> verticalAxis="vAxis4"/>
> >
> >
> > </row>
> >
> >                                                                 
> > </doc>
> >
> >
> >
> > This data would be dynamic and I am trying to assign verticalAxis
> attribute
> > value to verticalAxis property of a column series at runtime:
> >
> >
> >
> > colSeries = *new* ColumnSeries();
> >
> >                                                 colSeries.yField = 
> > String(metric.@attribute);
> >
> >                                                 
> > colSeries.displayName = String(metric.@metricName);
> >
> >
> >
> >
> >
> >                                                 
> > colSeries.verticalAxis = metric.@verticalAxis; //metric.@verticalAxis here 
> > would be a string.
> But I
> > have to reference the LinearAxis that I have declared on top, which 
> > is vAxis1.
> >
> >
> >             seriesArray.push(colSeries);
> >
> >
> >
> > Is there any way we can achieve that?
> >
> >
> >
> > getDefinitionByName() would just give be the class, but I need the
> declared
> > instance.
> >
> >
> >
> >
> >
> > Warm regards,
> >
> > Deepak
> >
>
>
>
> --
> Thanks and Regards,
> JJain,
>
>    If you have knowledge, let others light their candles in it 
> --Margaret
> Fuller:
>

Reply via email to