Sunday, March 28, 2010

how to fix the memory usage of Ely`s...

Hi,
     I am using flexbook for newspaper project. We have lots of huge size images in our app,all more than 1 MB. I use SuperImage as flexbook content,I also noticed that the application was using huge amounts of memory and crashed IE6, IE7,IE8 and Firefox. I found that flexbook updateDisplayList method call many times and each time flexbookpage call copyInto method when turg page,this cause memory growing. And memory not released when call commitProperties method.

I would really appriciate any help because I have no clue how to fix it.(我的英语不好,但是我真的很着急。)

See my partial code below how I am using the flexbook.

     //从后台Java代码得到报纸页面集合
     var list_pages: ArrayCollection = event.result as ArrayCollection;
     pageList = list_pages.toArray();
     //显示右侧报纸版面列表
     getPageListDisp();
     //画布擦除所有子元素
     can.removeAllChildren();
     //创建FlexBook
     var book:FlexBook =new FlexBook();
     book.height=0.9*h;
     book.width=0.8*w;
    //FlexBook需要配置的属性
     book.itemSize=''halfPage'';
     book.animateCurrentPageIndex=false;
     book.animatePagesOnTurn=false;
     book.setStyle(''edgeAndCornerSize'',120);//翻动的页脚大小
     book.setStyle(''activeGrabArea'',1);//把翻动的范围设置为页边
         
     book.scaleX=sldrb.value;//设置book的放大比例
     book.scaleY=sldrb.value;
    
    var con:Array = book.content;//为book添加报纸版面
    con.push(new Image());
     for(var i:int=0;i%26lt;pageList.length;i++){
     var img:Image=new Image();
     img.source=pageList[i].pageBigImgUrl;
     img.maintainAspectRatio=true;
     con.push(img);
    }
    book.content = con;
     can.addChild(book);

%26lt;mx:Panel id=''test1'' width=''80%'' height=''100%'' horizontalScrollPolicy=''off'' verticalScrollPolicy=''off'' paddingTop=''15'' paddingBottom=''15''%26gt;
    %26lt;mx:Canvas id=''can'' scaleX=''{sldrb.value}'' scaleY=''{sldrb.value}'' click=''MouseEventFunc(event)'' borderColor=''#8EC7EF'' backgroundColor=''#FFFFFF'' horizontalScrollPolicy=''off'' verticalScrollPolicy=''off'' alpha=''1.0'' buttonMode=''true'' mouseDown=''MouseEventFunc(event)'' mouseUp=''MouseEventFunc(event)''%26gt;

      %26lt;/mx:Canvas%26gt;
   %26lt;/mx:Panel%26gt;

No comments:

Post a Comment