2 Replies Latest reply on Feb 13, 2007 4:06 AM by kruse

    Assignment do not work

    kruse Level 1

      Im using the cairngorm framework.
      In my command.as I have got the following assignment

      private var model : ModelLocator = ModelLocator.getInstance();

      When I try to use the variable model like this:

      model.getmeal.isPending = true;

      I get the error: 1202: access of undefined property getmeal in package model.

      But if I do it like this:
      ModelLocator.getInstance().getmeal.isPending = true;

      It works.

      How do I get the model.getmeal.isPending = true; to work?
        • 1. Re: Assignment do not work
          FlightGuy Level 1
          Could you post the source of ModelLocator? Try breaking the chain down and see exactly where the error is happening. eg.

          var model:ModelLocator = ModelLocator.getInstance();
          var meal:Meal = model.getmeal;
          meal.isPending = true;

          Then run that with the debugger and see what's going wrong. Check your imports - do you have a package called model? try using a different name.

          • 2. Re: Assignment do not work
            kruse Level 1
            Some how I got this to work.

            But now I have a problem retriving data from the database and then assign the data to the vo.
            I get the error: cannot convert Object@38bda61 to com.adobe.cairngorm.samples.addcontact.vo.MealVO

            var products : ICollectionView = ICollectionView(new ArrayCollection(event.result) );
            var test : MealVO = products[ 0 ];

            the last line fails with the mentioned message.

            the MealVO is implemented like this

            package com.adobe.cairngorm.samples.addcontact.vo
            import com.adobe.cairngorm.vo.IValueObject;

            public class MealVO implements IValueObject
            public var mealplanid : int;
            public var foodsid : int;
            public var amount : Number;
            public var id : int;
            public var name : String;
            public var mesure : int;
            public var protein : Number;
            public var carbonhydrate : Number;
            public var fat : Number;


            Anyone that can tell me how I do get the retrieved data into my MealVO object?