2012-08-22 41 views
1

我已創建了一個磁貼列表,磁貼列表中的每個磁貼都是在翻轉時繪製圖形的畫布。當鼠標從特定的畫布上展開時,必須移除繪製的圖形。所以我在做graphics.clear但不能刪除圖形。清除鼠標從畫布中滾動時的圖形

代碼

protected function canvas1_updateCompleteHandler(event:FlexEvent):void 
      {   
       var allowHighLight:Boolean = QzGridImpl(this.owner).m_bEnableHighLight; 
       if(!allowHighLight) 
        return; 
       var highLighted:Boolean = TileList(this.owner).isItemHighlighted(this.data); 
       if(highLighted) 
       { 
        high = true; 
        DrawBackgroundImage(QzGridImpl(this.owner).m_strBackgroundImage as String); 


       } 
//when highlighted becomes false the below part is called 
       else 
       { 

        if(high) 
        { 



         this.graphics.endFill();//and cleanly im observing that endfill and clear is getting called and they are able to clear graphics when mouse is rolled out slowly but not able to clear when mouse is rolled out fast. 

         trace("endfill"); 
         this.graphics.clear(); 
         trace("clear"); 



        } 
       } 


private function DrawBackgroundImage(n_strBackImg:String):void 
{ 

//code for drawing the background image 
} 

,乾淨,我觀察到endfill和清晰的獲取調用,他們是能夠清除當鼠標鋪開緩慢,但不能當鼠標快速推廣到清晰的圖形。

需要做些什麼才能使其工作?

回答

0

您可以爲TileList創建自定義ItemRenderer,並在itemRenderer觸發翻轉時(通過將rollOver偵聽器添加到呈示器)應用圖像效果。這可能會奏效 - 也可能是一個更好的方法。