Hey Kevin,
See if this makes sense in your configuration:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()"
layout="vertical">
<mx:Script>
<![CDATA[
private var obj1:Object = new Object();
private var obj2:Object = new Object();
[Bindable] private var objRef:Object = new Object();
private function initApp():void {
obj1.text = "test1";
obj2.text = "test2";
txtObject0.text = obj1.text;
txtObject1.text = obj2.text;
objRef = obj1;
}
private function switchObjects(event:Event):void {
objRef = obj2; // testing reassigning of objects
txtObject0.text = obj1.text;
txtObject1.text = obj2.text;
}
]]>
</mx:Script>
<mx:Panel id="myPanel" width="538" height="334" layout="absolute">
<mx:VBox width="100%" height="100%" x="10" y="10">
<mx:Label text="VO Object"/>
<mx:TextArea width="498" id="txtObject" borderStyle="solid"
text="{objRef.text}"/>
<mx:Label text="someObject"/>
<mx:TextArea width="498" id="txtObject0" borderStyle="solid"/>
<mx:Label text="someNewObject"/>
<mx:TextArea width="498" id="txtObject1" borderStyle="solid"/>
<mx:Button click="switchObjects(event)" label="Switch
Objects"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
You'll see objRef taking on the new object values and leaving obj1 alone
when you switch object assignments.
Jurgen
Kevin wrote:
i couldn't get either of these solutions to work. When I reset the vo
variable to nul (or new Object), it still modifies the object on the
model. I could be doing something wrong, but for now, i decided to
instantiate an entirely new super class each time the vo changes.
I'll look into this a little more and see if I can do what I want...
thanks, Kevin
On Jun 3, 2007, at 9:33 AM, Jurgen Beck wrote:
Rather than just assigning the model.someObject directly to the vo
object, you may first need to instantiate it with:
var vo:Object = new Object();
The assign the model.someObject to it:
vo = model.someObject;
When you then assign a different object to it, it should leave
model.someObject alone and just use the newly assigned object.
Jurgen
Kevin wrote:
This may be a simple question, but it's stumping me.
I have a component that contains a property (type object) that holds
a reference to an VO on my model.
How to I "unlink" that reference?
For example, when I set the property:
var vo : Object = model.someObject;
I then do something like this:
vo = someNewObject;
This happens....
model.someObject get's set to someNewObject...
This is not what I want. Therefore, I assume I have to "unlink" the
reference of vo to model.someObject, before I give it another
reference. How do I do that?
Thanks, Kevin