0 Replies Latest reply on Nov 28, 2007 11:50 AM by kruse

    Flex Cairngorm

    kruse Level 1
      Can I get Cairngorm questions answered here?

      I try...

      When My application start up I need to instanciate a VO.
      This I do in the entry constructor of the ModelLocator

      public function KostModelLocator() {
      if ( modelLocator != null )
      {
      throw new Error( "Only one KostModelLocator instance should be instantiated" );
      }

      var currentDate : Date = new Date();
      selectedDay = new Day(currentDate);
      }

      The Day(Date) is defined in the Model\Day.as
      I call the Day constructor with the current date.

      public class Day
      {
      // Constructor
      public function Day ( date : Date ) {
      setDate(date);
      }

      //Public functions
      public function setDate ( date : Date ) : void {
      day.date = date;
      day.dayString = extractDayString(date);
      day.dayId = 37;
      }

      But now the problem is when I will update the day.dayId. This should not be a static value (37). But instead I should get some day id from the database.

      How is this done?

      I was thinking about initiating a event calling the command that gets the date id from the database and automatically updates the id.
      But then I don’t think that a model should initiate an event..

      How do I do this?