0 Replies Latest reply on May 22, 2007 4:48 PM by Chase_B

    IDataRederer and AssociativeInstanceCache

    Chase_B
      So, I have been tearing apart some code that one of Adobe's employee's (kuwamoto.org) posted on his blog, and I am not sure what this part means! I know that this is what adds all the items to the display list, but I am not understanding the syntax and reasoning behind it... here is the code.


      //_renderCash is an instance of Adobe's AssociativeInstanceCache.as
      //what exactly does this do, and why do we need to open and close the associations?
      _renderCache.beginAssociation();

      //loop through the array and create a bunch of items in our container
      for(i = 0; i < _items.length; i++)
      {
      ///what is this doing?
      var renderer:IUIComponent = _renderCache.associate(_items );

      //this is the really confusing part to me, especially the syntax of IDataRederer(rederer) ...
      //after looking at the IDataRederer interface it doesnt look like this should be possible... what am I missing?
      IDataRenderer(renderer).data = _items
      ;

      //adds it to a list of renderers for later reference
      _renderers = renderer;

      //add this to the display list, any special reason for having to put it in a DisplayObject() call?
      addChild(DisplayObject(renderer));
      }
      //again, why de we need to end the association?
      _renderCache.endAssociation();


      Thanks for any help!