Yes, well, I'll answer my own question for the benefit of all. :)
 It's working like a champ. Here's my takeaway from this:

If you've got to populate a control with a string value from your data
model, and you need to perform operations on that value (validation,
whatever) then this is how you can do it:

1) on the change event of any control whose data you need, call a
function that you create, such as updateValues()
2) create a class which will hold the values you need. Use setters to
populate that class
3) have a method in that class which creates the concatenated string.
This is where your concatenation logic goes.
4) At the end of the method, set the model.summary (in my case) equal
to whatever string was generated.
5) Instantiate that class in the code of the view component where
you're going to need it displayed
6) In the same component where you need to display the text, just set
a Textarea's or Text's text property to "{model.summary}" Because you
are calling a function on the change event of your 'input' controls,
the summary is being dynamically and accurately generated each time
you click your stepper. It will automatically update. And, of course,
make sure that in your model you've made the summary variable Bindable
(either that or the entire class is Bindable).

Thanks for the help!

--- In flexcoders@yahoogroups.com, "stldvd" <stl...@...> wrote:
>
> Thanks, Ryan.
> 
>  If I understand you correctly you're suggesting I create a Summary
class with those 
> setters and that function. 
> If the generateSummary() function returns a string, it would return
the generated 
> summary. At the end of this function I set the bindable summary
property equal to the 
> generated smry. So it would be model.summary = smry;
> 
> The only thing I'n not clear on is what is being called from the
change event of each of the 
> steppers. I guess I create a function called updateValues which
instantiates the Summary 
> class, passes in those values, and gets returned the summary string.
The same function 
> should be called from the change event of all controls that provide
values to the summary.
> 
> Is that it?
> 
> Thanks,
> 
> David 
> I
>  
> --- In flexcoders@yahoogroups.com, "Ryan Graham" <Ryan.Graham@> wrote:
> >
> > 
> > You could take control of the situation by updating the summary
property
> > inside the setter of each property that makes up the summary itself.
> > Forgive the quick code, but something along the lines of:
> > 
> >  
> > 
> > public function set repeat(value:int):void
> > 
> > {
> > 
> >                 _repeat = value;
> > 
> >                 generateSummary();
> > 
> > }
> > 
> >  
> > 
> > public function set repeat(value:int):void
> > 
> > {
> > 
> >                 _duration = value;
> > 
> >                 generateSummary();
> > 
> > }
> > 
> >  
> > 
> >  
> > 
> > private function generateSummary():void
> > 
> > {
> > 
> >                 var smry:String = "";
> > 
> >                 if (repeat)
> > 
> > smry += "Repeat: " + _repeat.toString() + "\n";
> > 
> >                 if (duration)
> > 
> >                                 smry += "Duration" +
> > _duration.toString() + "\n";
> > 
> >                 //etc for all properties to generate summary
> > 
> >                 
> > 
> >                 //set the summary property to fire change event for
> > components that are bound to it
> > 
> > summary = smry;
> > 
> > }
> > 
> >  
> > 
> > HTH,
> > 
> > Ryan
> > 
> >  
> > 
> > From: flexcoders@yahoogroups.com
[mailto:flexcod...@yahoogroups.com] On
> > Behalf Of stldvd
> > Sent: Tuesday, January 13, 2009 1:02 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Binding and the Model
> > 
> >  
> > 
> > I don't think there's an <mx:string tag. But even if I do this:
> > 
> > <mx:Text id="summary" text="Start Time: {model.start}\nRepeat: 
> > {model.repeat}" /> etc. I don't think it will work. If there is no
value
> > for model.repeat then 
> > I want to leave it out of the summary description. This means I need a
> > function which 
> > says, if (model.repeat) !=''
> > {
> > summary += "Repeat: " + model.repeat;
> > }
> > 
> > If I create such a function, how would it automatically update?
Even if
> > the bindings work, 
> > such that the values in the function are automatically updating
> > (model.whatever), how 
> > would I assure that the function itself is called each time there's a
> > change, so that the 
> > correct summary is returned to the Text control?
> > 
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
> > , "Wesley Acheson" <wesley.acheson@> wrote:
> > >
> > > I think you can add something like.
> > > 
> > > <mx:string id="summary">{model.duration + model.start}</mx:string>
> > > 
> > > Regards,
> > > 
> > > Wesley
> > > 
> > > On Tue, Jan 13, 2009 at 8:37 PM, stldvd <stldvd@> wrote:
> > > 
> > > > Hi guys,
> > > >
> > > > I'm trying to concatenate a series of string literals and bound
> > variables
> > > > into a model
> > > > variable called 'summary', which will be displayed in a 'summary'
> > textarea
> > > > or text control.
> > > >
> > > > The variables come from various control settings -- numeric
steppers
> > etc.
> > > > I can bind the variables to UI controls, for example
> > > > <mx:NumericStepper id="durStep" value="{model.duration}"
> > > > change="model.duration =
> > > > durStep.value"/>
> > > > <mx:NumericStepper id="startStep" value="{model.start}"
> > > > change="model.start = startStep.value"/>
> > > >
> > > > But I'm not sure how or where to create this concatenated summary
> > variable.
> > > > I declare it in
> > > > the model, but then where do I do the concatenating such that
> > binding will
> > > > actually work?
> > > > Each time the steppers and combo boxes values change, I need
to have
> > the
> > > > entire
> > > > summary update.
> > > >
> > > > Ideally I just have a bindable variable in the model and then my
> > textarea
> > > > looks like this: <mx:Text id="ruleSummary" text=" {model.summary}"
> > />
> > > >
> > > > Can someone help?
> > > >
> > > > Thanks,
> > > >
> > > > David
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > --
> > > > Flexcoders Mailing List
> > > > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > > Alternative FAQ location:
> > > >
> >
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-
> > 1e62079f6847
> > > > Search Archives:
> > > > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
> > Groups
> > > > Links
> > > >
> > > >
> > > >
> > > >
> > >
> > 
> >  
> > 
> > 
> > 
> > This message is private and confidential. If you have received it
in error, please notify 
> the sender and remove it from your system.
> >
>


Reply via email to