Ok, than it's a challenge for me as well :) (take that into account when
measuring the value of my answer :) ).
The biggest problem i see from the get-go, is this one.
override public function set data(value:Object):void
{
...
schede.removeAllElements();
for(var i:int=0; i<value.schede.length; i++)
{
var button:Button=new Button();
button.label=String(i+1);
button.id=value.schede[i];
button.height=40;
button.width=40;
button.addEventListener(MouseEvent.CLICK, handleMouseClick);
schede.addElement(button);
}
}
This means that everytime you (re)set the data, all buttons need to be created
again. I think your best bet is to move that to commitProperties and instead of
creating and removing, set them hidden/not included in layout.
My 0,02
Ben
On 3 sep. 2013, at 15:29, "Federico De Maddalena" <[email protected]>
wrote:
> Hi Ben
> I'm developing a mobile project, not desktop!
> Images in use are very small.
> Usevirtuallayout is set on true.
> The code is here:
>
> <fx:Script>
> <![CDATA[
> import spark.components.Button;
> import spark.core.ContentCache;
>
> import events.SchedaEvent;
>
> static public const s_imageCache:ContentCache=new
> ContentCache();
>
> override public function set data(value:Object):void
> {
> super.data=value;
> lezione.text=value.titolo;
> img.source="img/lez/"+value.lezione+"g.png";
>
> schede.removeAllElements();
> for(var i:int=0; i<value.schede.length; i++)
> {
> var button:Button=new Button();
> button.label=String(i+1);
> button.id=value.schede[i];
> button.height=40;
> button.width=40;
>
> button.addEventListener(MouseEvent.CLICK, handleMouseClick);
> schede.addElement(button);
> }
> }
>
> private function handleMouseClick(event:MouseEvent):void
> {
> sendEvent(parseInt(event.currentTarget.id));
> }
>
> private function sendEvent(id:int):void
> {
> var e:SchedaEvent=new
> SchedaEvent(SchedaEvent.LOAD_SCHEDA);
> e.Id=id;
>
> this.owner.dispatchEvent(e);
> }
> ]]>
> </fx:Script>
>
> <s:HGroup width="100%" height="100%" paddingTop="3">
> <s:VGroup height="100%" width="20%" verticalAlign="top"
> horizontalAlign="center">
> <s:Image width="80%" height="80%" id="img"
> contentLoader="{s_imageCache}"/>
> </s:VGroup>
> <s:VGroup height="100%" width="70%">
> <s:Label width="100%" height="20%" id="lezione"/>
> <s:TileGroup width="100%" height="80%" id="schede"/>
> </s:VGroup>
>
> </s:HGroup>
>
> -----Messaggio originale-----
> Da: Ben Smeets [mailto:[email protected]]
> Inviato: martedì 3 settembre 2013 15.22
> A: [email protected]
> Oggetto: Re: Improve spark List performance
>
> How many rows in the list? (i.c.w. useVirtualLayout)
>
> The setup you mention shouldn't be a problem I think (unless the image you
> talk about is 200MB a pop), but depends on the implementation (details).
> E.g., if the buttons are created every scroll, instead of reused, that might
> be a cause.
>
> Any code you can share, can help (me at least) to track down the culprit.
>
> Not a guru here though, so maybe others will know off the top of their heads
> :)
>
> Ben
>
> P.S. We are talking desktop app here right? Mobile is a different beast all
> together (for me).
>
>
>
> On 3 sep. 2013, at 15:16, Federico De Maddalena <[email protected]>
> wrote:
>
>> Hi! I'm working on a mobile project.
>> I created a spark List, which item renderer is an extension of
>> ItemRenderer. Each of my item renderer contains one spark Image, one
>> Label and a number of small buttons which varies from 3 to 20.
>> Now, scrolling the list is terribly slow. There are ways to improve
>> scroll speed? I spent a lot of time but without success.
>> Regards
>> federico
>>
>
>