That's what I've been deadling with for the past 2 days! I won't suggest best practices, I'll just suggest what works as of 1:00pm this afternoon.
My model is much like yours, on ModelLocator, but it's not actually written to unless the user hits save or apply. As such, I create a copy of the preferences object by passing the true one into a fucntion, which makes a copy, and uses that as something to bind to. That way, all my bindings work, but they only affect the real data if the user hits save. Psuedo code: prefsWindow = PopUpManager.createPopUp(this, PrefsWindow, true); prefsWindow.setFormData(ModelLocator.prefsObject); // psudeo code in PrefsWindow public var formData:Object; public function setFormData(o:Object):Void { // could be a specific ValueObject type as well // just DON'T set it to null, or delete it; this'll screw up the bindings formData = new Object(); for(var p in o) { formData[p] = o[p]; } } public function getFormData():Object { return formData; } Then, in your main class, just replace your VO on the ModelLocator with the formData. For avoiding references, see the earlier threads today about Object.copy. ----- Original Message ----- From: "charged2885" <[EMAIL PROTECTED]> To: <flexcoders@yahoogroups.com> Sent: Thursday, December 01, 2005 4:45 PM Subject: [flexcoders] PreferencesWindow design pattern Note, this example is mitigated. there are dozens of preferences i want my users to be able to set. Anyways.... I have a simple preference i want my users to be able to set: showConsoleWindow. I have created a simple PreferencesWindow with a CheckBox on it. This checkbox's selected property is bound to ModelLocator.currentUser.preferences.showConsoleWindow. currentUser is a UserVO object as described below: class UserVO { preferences:PreferencesVO; username:String; } class PreferencesVO { showConsoleWindow:Boolean; } I'd like to offer a cancel button to my PreferencesWindow. however, since showConsoleWindow is bound, this approach won't work. It seems I should first, create a temporary preferences object to bind to. This is where my question comes in. How do I create a copy of my ModelLocator.currentUser.preferences object? Or would you implement this functionality differently? Please, I'm new to flex and I want to do this "the right way". Thanks for your time. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/