event that is listened for by the view, when you want to
enable/disable menu options. The listening function would do
something like this:
private function enableMenuItems(mb:MenuBar):void
{
for (var i:int = 0; i < 2; i++)
{
mb.getMenuAt(i).enabled =
ModelLocator.getInstance().enabledMenuArray(i).enabledValue;
}
}
Not true binding, but it might work. This code has errors, but you
get the idea. Just brainstorming.
-TH
--- In [email protected], Graham Weldon <[EMAIL PROTECTED]>
wrote:
>
> Hi Tim,
>
> Curly braces dont work for data binding within ActionScript in the
> manner you suggest:
> * Expecting colon before dot.
> * Syntax Error: rightbrace is unexpected.
> * Expecting rightbrace before semicolon.
>
> Those are the compile errors encountered. Perhaps there is another
wya
> to use dataBinding from ActionScript? Or alternatively, there may
be a
> way to completely define this component in MXML, allowsin us to
use the
> curly-brace notation for databinding?
>
> Regards,
> Graham Weldon
>
>
>
>
> Tim Hoff wrote:
>
> > Did you try this: (curly braces for binding)
> >
> > <menuItem label="New" enabled="' +
> > { ModelLocator.getInstance
().ACTION_ENABLED_FILE_NEW }
> > + '"/>
> >
> > --- In [email protected], "Graham Weldon"
> > <graham.weldon@> wrote:
> > >
> > > I've asked this question previously, but in a slightly
different
> > > manner, and since its post, I ahve managed to make some
progress.
> > >
> > > I have created a new MXML component that represents a MenuBar
with
> > > some items within that will not change except for their enabled
> > value.
> > > I am building this on top of the Cairngorm framework 2.0 beta,
> > which
> > > means I'm taking advantage of the ModelLocator construct.
> > >
> > > I have a collection of ENABLED indicators stored on the
> > ModelLocator,
> > > which will be changed at varying points in the programs
execution.
> > > These states need to enable and disable the options in the
menu.
> > >
> > > Here is a snippet of what I am using, which works great for
> > indicating
> > > the initial required enabled or disabled state, but does not
> > update as
> > > the variables change...
> > >
> > > Any thoughts on how to restructure this to allow the options to
> > update
> > > in real time with data binding, rather than being set upon
> > > instantiation and initialisation of the component.
> > >
> > > Thanks in advance!
> > >
> > > Regards,
> > > Graham Weldon
> > >
> > >
> > > ==============================================
> > >
> > > import mx.collections.XMLListCollection;
> > >
> > > [Bindable]
> > > private var menuXML : XMLListCollection = new
> > > XMLListCollection(rawMenuXML);
> > > [Bindable]
> > > private var rawMenuXML : XMLList = XMLList(
> > > '<menuItem label="File" enabled="' +
> > > ModelLocator.getInstance().ACTION_ENABLED_FILEMENU
+ '">' +
> > >
> > > '<menuItem label="New" enabled="' +
> > > ModelLocator.getInstance().ACTION_ENABLED_FILE_NEW
> > + '"/>' +
> > > '<meunItem label="Open" enabled="' +
> > > ModelLocator.getInstance().ACTION_ENABLED_FILE_OPEN
> > + '"/>' +
> > >
> > > '</menuItem>'
> > > );
> > >
> > >
> > >
> > > <mx:MenuBar
> > > labelField="@label"
> > > xmlns:mx="http://www.adobe.com/2006/mxml"
> > > dataProvider="{menuXML}"/>
> > >
> > > ==============================================
> > >
> >
> >
> >
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> >
> >
> >
> > SPONSORED LINKS
> > Web site design development
> > <http://groups.yahoo.com/gads?
t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=
Computer+software+development&w3=Software+design+and+development&w4=M
acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L
-4QTvxB_quFDtMyhrQaHQ>
> > Computer software development
> > <http://groups.yahoo.com/gads?
t=ms&k=Computer+software+development&w1=Web+site+design+development&w
2=Computer+software+development&w3=Software+design+and+development&w4
=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig
=lvQjSRfQDfWudJSe1lLjHw>
> > Software design and development
> > <http://groups.yahoo.com/gads?
t=ms&k=Software+design+and+development&w1=Web+site+design+development
&w2=Computer+software+development&w3=Software+design+and+development&
w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s
ig=1pMBCdo3DsJbuU9AEmO1oQ>
> >
> > Macromedia flex
> > <http://groups.yahoo.com/gads?
t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+sof
tware+development&w3=Software+design+and+development&w4=Macromedia+fl
ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZ
I36cYzBjw>
> > Software development best practice
> > <http://groups.yahoo.com/gads?
t=ms&k=Software+development+best+practice&w1=Web+site+design+developm
ent&w2=Computer+software+development&w3=Software+design+and+developme
nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166
&.sig=f89quyyulIDsnABLD6IXIw>
> >
> >
> >
> > -----------------------------------------------------------------
-------
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "flexcoders
> > <http://groups.yahoo.com/group/flexcoders>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]
subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > -----------------------------------------------------------------
-------
> >
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

