Data Model Flex


    
        
            import spark.events.RendererExistenceEvent;
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            
            private function itemAdded( evt:RendererExistenceEvent ):void
            {
                Alert.show(evt.index + " : " + evt.data + " : " + evt.renderer );
            }
            private function itemRemoved( evt:RendererExistenceEvent ):void
            {
                Alert.show(evt.index + " : " + evt.data + " : " + evt.renderer );
            }
            
            private function addItem():void
            {
                if( collection.length > 0 )
                    myContent.dataProvider.addItem( collection.removeItemAt(0) );
            }
            private function removeItem():void
            {
                if( myContent.dataProvider.length > 0 )
                {
                    var item:Object = myContent.dataProvider.removeItemAt( myContent.dataProvider.length - 1 );
                    collection.addItem( item );
                }
            }
      
    

    this is a test
    
         
         
         
         
        
                     rendererAdd="itemAdded(event);" 
                 rendererRemove="itemRemoved(event);"
                 itemRenderer="spark.skins.spark.DefaultComplexItemRenderer">