1 Reply Latest reply on Jun 15, 2006 3:29 PM by Newsgroup_User

    How does on Sharing data between main.mxml and a renderer.mxml

    Level 7
      I have a value set in my main [mobilecalendar] mxml file.

      [Bindable]
      public var calDate:Date = new Date();

      How can I use this value in my renderer [dayFormat] mxml file?

      if (data.date.month == calDate.month)

      TIA

      Ian Skinner
        • 1. Re: How does on Sharing data between main.mxml and a renderer.mxml
          Level 7
          Hi Ian,
          > I have a value set in my main [mobilecalendar] mxml file.
          >
          > [Bindable]
          > public var calDate:Date = new Date();
          >
          > How can I use this value in my renderer [dayFormat] mxml file?
          >
          > if (data.date.month == calDate.month)

          The simplest (though not particularly clean) way to do it would be to
          reference Application.application.calDate from your renderer.

          Depending on what you're trying to do, there may be a better way to do
          it. For example, if what you want to do is to have the renderer appear
          different depending on whether it's the current month, you could put the
          logic for determining which item corresponds to the current month in the
          containing application or component, and set a flag in that item's data,
          then look at that flag in the renderer. This avoids having an "upward"
          dependency in your component hierarchy, making it easier to reuse your
          renderer in other situations.

          --
          nj
          Flex Builder team