0 Replies Latest reply on Aug 6, 2011 4:12 PM by Francisc

    Overriding set data for mobile item renderer

    Francisc Level 3

      Hello,

       

      Given the following case override: (the practicallity of setting those properties is irelevant, it's as theoretical question)

       

      override public function set data(value:Object):void
      {
          super.data = value;
         
          //If `a`, then create property `b`
          if(data.a){data.b='x';}
          else{data.b='z';}
         
          //Create property name_and_title
          data.name_and_title=data.title+'. '+data.firstName+' '+data.lastName
         
          //ETC
      }

       

      Would it not be better to use "value" instead of "data" (i.e. "value.firstName, value.lastName etc) and set super.data=value at the end?

       

      I am thinking that each time I set a property of data, the super set data method is called which in turn can call all sorts of other methods, like invalidateProperties() and so on.

       

      Is that correct?