2 Replies Latest reply on Aug 23, 2007 11:18 AM by levancho

    dynamic ActionScript syntax in mxml not curly Braces

    levancho Level 3
      from Developers Guide : -----
      Adobe Flex 2 provides three ways to specify data binding: the curly braces ({}) syntax and the <mx:Binding> tag in MXML and the BindingUtils methods in ActionScript.

      [so what I am trying to ask is that ,as I starting to see, there is not really any defined correct way of putting a/s code inside mxml Tags , unless I use curly braces(data binding operators), to better illustrate lets say I have :

      <mx:Image id="Demo_image_2" visible="false" scaleContent="true" source="{demoImage2}" alpha=".5"/>

      and if I want to add attribute width and put some dynamical calculated value in it :

      width="10+20" this will not work.
      width="{10+20}" this will work (even though I dont understand what type of data binding will happen )
      . as developers guide states: curly braces are meant for data binding not for dynamic data entry inside mxml file,
      I dont really want to bind attribute "width" to anything I just want to be able to put some short dinamic A/S snipet , should not there be way to do it (without using data binding syntax? or in other words curly braces? )
        • 1. Re: dynamic ActionScript syntax in mxml not curly Braces
          ntsiii Level 3
          In that usage, the braces don't set up a binding, they just execute the as code within them. This is common and accepted usage. I think it says this somewhere in the docs, but i don't recall where.
          • 2. dynamic ActionScript syntax in mxml not curly Braces
            levancho Level 3
            but problem is when I try to set some variable as valie of attribute and I dont want to make it bindable: I get warnings unable to bind,etc etc ....
            so I am pretty sure it tries bind anything that is variable type. for example I have static variable :
            static public var MY_DATE_RANGE: Object = {rangeStart : new Date(1970,0,1), rangeEnd : new Date()}; and if I set that as value of attribute selectableRange of DateField component :

            I start getting warnings : unable to bind etc etc ... so that means it is trying to bind.
            but how else I can set that value besides {}?
            if I do
            selectableRange="NpdNaDateField.UNLIMITED_DATE_RANGE" does not work.