One other thought.  Instead of using the curly braces in the XML, do
you think that you could use the special characters like /n7B
and /n7D?


--- In flexcoders@yahoogroups.com, "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> That's cool Graham.  I might use your solution as well, until the
> MenuBar XML items allow databinding.
>
> Later,
> Tim
>
>
> --- In flexcoders@yahoogroups.com, Graham Weldon <graham.weldon@>
> wrote:
> >
> > Hi Tim,
> >
> > I like your concept, but I don't feel that it will be practical
> for the
> > situation in which I want to use it.
> >
> > I have this data binding working on a tool bar, which I can
define
> > completely with MXML... (detailed below).
> >
> > Note that some of the names have changed since my last post, but
> you can
> > see since I have a complete MXML implementation, using no
> ActionScript.
> > This allows me to insert using the curly-brace notation for data
> binding
> > directly to the ModelLocator. This method works fine, and I have
> for the
> > moment installed a temporary button that toggles the state of
some
> of
> > these ACTION_ENABLED variables and have verified that this works
> > wonderfully.
> >
> > Perhaps there is a way to define a MenuBar completely in MXML,
to
> allow
> > this data binding option also? I'm not certain since the
> documentation
> > for MenuBars varies depending on where you are reading it.
> >
> > Regards,
> > Graham Weldon
> >
> > ================================================================
> > <mx:Canvas
> >     xmlns:mx="http://www.adobe.com/2006/mxml"
> >     styleName="myToolbar">
> >   
> >     <!-- ================================= -->
> >     <!-- ================= FILE OPERATIONS -->
> >     <mx:LinkButton
> >         styleName="myToolbarButton"
> >         id="toolbar_fileNew"
> >         toolTip="New"
> >         icon="@Embed('images/icons/ck_6.gif')"
> >         disabledIcon="@Embed('images/icons/ck_6_off.gif')"
> >         width="25"
> >         height="25"
> >         enabled="{ModelLocator.getInstance
> ().ACTION_ENABLED__FILE_NEW}"
> >         x="0"/>
> >
> >     <mx:LinkButton
> >         styleName="myToolbarButton"
> >         id="toolbar_fileOpen"
> >         toolTip="Open"
> >         icon="@Embed('images/icons/ck_1.gif')"
> >         disabledIcon="@Embed('images/icons/ck_1_off.gif')"
> >         width="25"
> >         height="25"
> >         enabled="{ModelLocator.getInstance
> ().ACTION_ENABLED__FILE_OPEN}"
> >         x="25"/>
> >     <!-- ================================= -->
> >
> > </mx:Canvas>
> >
> > ================================================================
> >
> >
> >
> >
> > Tim Hoff wrote:
> >
> > > Yeah, I was afraid of that.  You would probably have to
dispatch
> an
> > > 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 flexcoders@yahoogroups.com, Graham Weldon
<graham.weldon@>
> > > 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 flexcoders@yahoogroups.com, "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
> > > <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




Reply via email to