function A(varname:String, value:int):void
{
    this[varname] = value;
}

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of greenfishinwater
Sent: Tuesday, March 13, 2007 8:43 AM
To: [email protected]
Subject: [flexcoders] Re: Passing an object reference as a property



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] <mailto:flexcoders%40yahoogroups.com>
, "Roman Protsiuk"
<[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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]
<mailto:flexcoders%40yahoogroups.com>  [mailto:flexcoders <flexcoders>@
> > yahoogroups.com] *On Behalf Of *Kevin
> > *Sent:* Monday, March 12, 2007 8:22 PM
> > *To:* [email protected]
<mailto: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
> >
> >
> >
> >
>



 

Reply via email to