flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Wilkinson <wilkinsonmar...@gmail.com>
Subject Re: How to get a class instance using string name?
Date Fri, 16 Aug 2013 11:53:23 GMT
There's no getElementByName, so maybe on the parent you could do
(immediately contradicting my previous comment :)
var myElement:* = parent["childId"]


On 16 August 2013 12:50, Marcus Wilkinson <wilkinsonmarcus@gmail.com> wrote:

> I guess there's no reliable way to get the instance at runtime by id?
> Perhaps getChildByName could help?
>
> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContainer.html#getChildByName()
>
>
> On 16 August 2013 12:39, Deepak MS <megharajdeepak@gmail.com> 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
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message