You are asking for trouble doing this...  Just do as I suggested
earlier.  When you set the source set it to the object and have a
string that is the name of the property that is the real target.

var source:Object;
var property:String;

then when you access that porperty you do it like this...
source[property];

simple.



--- In [email protected], "Ralf Bokelberg"
<[EMAIL PROTECTED]> wrote:
>
> In the older flash days we had eval to achieve this. Now you need to
> implement it on your own.
> Split the string at the dots, start from a top object and
dereference one
> property after the other until you get to the last part of the string.
> 
> Cheers
> Ralf.
> 
> On 3/13/07, greenfishinwater <[EMAIL PROTECTED]> wrote:
> >
> >   In simple terms I think what kevin wants to do is:
> >
> > var x;
> > var myvar;
> > var value;
> >
> > function A(varname, value) {
> > varname = value)
> > }
> >
> > myvar = "x";
> > value = 42;
> > A(myvar, value);
> >
> > The required result is that the variable x should contain the
value 42.
> >
> > I don't know how to to this.
> >
> > Andrew
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>,
"Roman
> > Protsiuk"
> > <roman.protsiuk@> wrote:
> > >
> > > Hard to understand what exactly do you need and how... :)
> > > What is parent? Is it the object whose property you are trying to
> > access? Or
> > > is it the object which has 'model' as a property? In both cases you
> > can get
> > > property value by parsing the string your method gets.
> > >
> > > R.
> > >
> > > On 13 Mar 2007 07:17:12 -0700, Kevin <lists@> wrote:
> > > >
> > > > I think I need to be a little clearer about what I need.
> > > >
> > > > let's say i have an instance of an object property somewhere:
> > > >
> > > > model.someObject.currentObject.name
> > > >
> > > > I want to pass that reference location (not the value) through a
> > component
> > > > like this:
> > > >
> > > > source="model.someObject.currentObject.name"
> > > >
> > > > so that inside the component I can update the object using the
> > reference:
> > > >
> > > > (this is what I don't know how to do)
> > > > parent[source] = someValue;
> > > >
> > > > If I use the curly braces it just binds the object value (not a
> > location
> > > > reference) to the property source. It seems the <mx:Binding > tag
> > is doing
> > > > a similar thing, but unfortunately it's one of those classes that
> > I can't
> > > > look inside to see how they do it!
> > > >
> > > > Does this make more sense about what I am trying to do?
> > > >
> > > > Thanks, Kevin
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Mar 12, 2007, at 11:42 PM, Gordon Smith wrote:
> > > >
> > > >
> > > > I suspect you meant to say that trace(source) is tracing out the
> > string "
> > > > model.someObject.currentObject".
> > > >
> > > > I think you want
> > > >
> > > > <comp:SomeCustomComponent
> > source="{model.someObject.currentObject}"/>
> > > >
> > > > - Gordon
> > > >
> > > > ------------------------------
> > > > *From:* [email protected]
<flexcoders%40yahoogroups.com>[mailto:
> > flexcoders <flexcoders>@
> > > > yahoogroups.com] *On Behalf Of *Kevin
> > > > *Sent:* Monday, March 12, 2007 8:22 PM
> > > > *To:* [email protected] <flexcoders%40yahoogroups.com>
> > > > *Subject:* [flexcoders] Passing an object reference as a property
> > > >
> > > > I would like to pass an object path through a property of another
> > > > class, but can't figure out how to do it.
> > > >
> > > > model.someObject.currentObject (the ML variable)
> > > >
> > > > <comp: SomeCustomComponent
source="model.someObject.currentObject" />
> > > >
> > > > class SomeCustomComponent{
> > > >
> > > > public var source:Object;
> > > >
> > > > function test(){
> > > >
> > > > trace(model.someObject.currentObjec);
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > This outputs the string "model.someObject.currentObject"
rather than
> > > > the variable value at - model.someObject.currentObject
> > > >
> > > > thanks for the insight.
> > > >
> > > > - kevin
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> Ralf Bokelberg <[EMAIL PROTECTED]>
> Flex & Flash Consultant based in Cologne/Germany
> Phone +49 (0) 221 530 15 35
>


Reply via email to