Whay are too many itemrenderers being created?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Whay are too many itemrenderers being created?

Chris Velevitch
I'm using Flex 4.11 with Air 4.0 to create a mobile app.

I have a spark list with a custom mxml itemRenderer. Only 4 instances will
be visible in the list. The dataprovider is initially empty.

When I assign the array collection with an array of 147 items, I get 147
traces on dataChange event and on the render event. I traced out the value
of 'this' and I get 147 unique objects.

I was under the impression that only 4 instances of the itemRenderer will
be created and get reused as I scroll through the list.

What have I overlooked?

The list is defined as:-

<s:List id="lImages" dataProvider="{imageList}" width="100%" height="100%"
allowMultipleSelection="true"
           change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
doubleClickEnabled="true" doubleClick="showImage(event)">
<s:layout>
<s:TileLayout/>
</s:layout>
</s:List>

and the itemRenderer is defined as:-

<?xml version="1.0"?>
<s:ItemRenderer
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        dataChange="onDataChange(event)"
        render="onRender(event)"
        width="150" height="175"
        >

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script><![CDATA[
        import DateUtils;

        import mx.events.FlexEvent;

        private function onDataChange(event:FlexEvent):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange:
dataChange event, index=" + itemIndex + ", this="+this);
        }

        private function onRender(event:Event):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
render event, index=" + itemIndex + ", this="+this);
        }
        ]]></fx:Script>
    <s:BitmapImage source="{data.image}" width="150" height="150"/>
    <s:Label text="{data.timestamp}" width="150"/>

</s:ItemRenderer>

--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

Alex Harui
useVirtualLayout property?

From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Thursday, February 13, 2014 7:34 PM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: [flexcoders] Whay are too many itemrenderers being created?



I'm using Flex 4.11 with Air 4.0 to create a mobile app.

I have a spark list with a custom mxml itemRenderer. Only 4 instances will be visible in the list. The dataprovider is initially empty.

When I assign the array collection with an array of 147 items, I get 147 traces on dataChange event and on the render event. I traced out the value of 'this' and I get 147 unique objects.

I was under the impression that only 4 instances of the itemRenderer will be created and get reused as I scroll through the list.

What have I overlooked?

The list is defined as:-

<s:List id="lImages" dataProvider="{imageList}" width="100%" height="100%" allowMultipleSelection="true"
           change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
doubleClickEnabled="true" doubleClick="showImage(event)">
<s:layout>
<s:TileLayout/>
</s:layout>
</s:List>

and the itemRenderer is defined as:-

<?xml version="1.0"?>
<s:ItemRenderer
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark<http://ns.adobe.com/flex/spark>"
        dataChange="onDataChange(event)"
        render="onRender(event)"
        width="150" height="175"
        >

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script><![CDATA[
        import DateUtils;

        import mx.events.FlexEvent;

        private function onDataChange(event:FlexEvent):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange: dataChange event, index=" + itemIndex + ", this="+this);
        }

        private function onRender(event:Event):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onRender; render event, index=" + itemIndex + ", this="+this);
        }
        ]]></fx:Script>
    <s:BitmapImage source="{data.image}" width="150" height="150"/>
    <s:Label text="{data.timestamp}" width="150"/>

</s:ItemRenderer>

--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group


Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

Chris Velevitch
That makes no difference. I did notice that <VerticalLayout/> always
virtualises regardless of whether useVirtualLayout is true or false.

It looks like <TileLayout/> never virtualises, so I suspect it's a bug, but
I haven't had a chance to look into how layouts work to confirm this.


On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]> wrote:

>
>
> useVirtualLayout property?
>
>   From: Chris Velevitch <[hidden email]>
> Reply-To: "[hidden email]" <[hidden email]>
> Date: Thursday, February 13, 2014 7:34 PM
> To: "[hidden email]" <[hidden email]>
> Subject: [flexcoders] Whay are too many itemrenderers being created?
>
>
>
> I'm using Flex 4.11 with Air 4.0 to create a mobile app.
>
>  I have a spark list with a custom mxml itemRenderer. Only 4 instances
> will be visible in the list. The dataprovider is initially empty.
>
>  When I assign the array collection with an array of 147 items, I get 147
> traces on dataChange event and on the render event. I traced out the value
> of 'this' and I get 147 unique objects.
>
>  I was under the impression that only 4 instances of the itemRenderer
> will be created and get reused as I scroll through the list.
>
>  What have I overlooked?
>
>  The list is defined as:-
>
>  <s:List id="lImages" dataProvider="{imageList}" width="100%"
> height="100%" allowMultipleSelection="true"
>            change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
> doubleClickEnabled="true" doubleClick="showImage(event)">
> <s:layout>
> <s:TileLayout/>
> </s:layout>
> </s:List>
>
>  and the itemRenderer is defined as:-
>
>  <?xml version="1.0"?>
> <s:ItemRenderer
>          xmlns:fx="http://ns.adobe.com/mxml/2009"
>         xmlns:s="library://ns.adobe.com/flex/spark"
>         dataChange="onDataChange(event)"
>         render="onRender(event)"
>         width="150" height="175"
>         >
>
>      <s:layout>
>         <s:VerticalLayout/>
>     </s:layout>
>
>      <fx:Script><![CDATA[
>         import DateUtils;
>
>          import mx.events.FlexEvent;
>
>          private function onDataChange(event:FlexEvent):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange:
> dataChange event, index=" + itemIndex + ", this="+this);
>         }
>
>          private function onRender(event:Event):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
> render event, index=" + itemIndex + ", this="+this);
>         }
>         ]]></fx:Script>
>     <s:BitmapImage source="{data.image}" width="150" height="150"/>
>     <s:Label text="{data.timestamp}" width="150"/>
>
>  </s:ItemRenderer>
>
>  --
>
>
> Chris
> --
> Chris Velevitch
> Manager - Adobe Platform Users Group, Sydney
> m: 0415 469 095
> www.apugs.org.au
>
> Adobe Platform Users Group, Sydney
> Topic: TBD
> Date: Monday, 28th February
> Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>
>
>
>
>



--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

Alex Harui
Yep, didn't notice you are using TileLayout.  I'm pretty sure it doesn't virtualize


From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Friday, February 14, 2014 2:26 AM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



That makes no difference. I did notice that <VerticalLayout/> always virtualises regardless of whether useVirtualLayout is true or false.

It looks like <TileLayout/> never virtualises, so I suspect it's a bug, but I haven't had a chance to look into how layouts work to confirm this.


On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:


useVirtualLayout property?

From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Thursday, February 13, 2014 7:34 PM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: [flexcoders] Whay are too many itemrenderers being created?



I'm using Flex 4.11 with Air 4.0 to create a mobile app.

I have a spark list with a custom mxml itemRenderer. Only 4 instances will be visible in the list. The dataprovider is initially empty.

When I assign the array collection with an array of 147 items, I get 147 traces on dataChange event and on the render event. I traced out the value of 'this' and I get 147 unique objects.

I was under the impression that only 4 instances of the itemRenderer will be created and get reused as I scroll through the list.

What have I overlooked?

The list is defined as:-

<s:List id="lImages" dataProvider="{imageList}" width="100%" height="100%" allowMultipleSelection="true"
           change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
doubleClickEnabled="true" doubleClick="showImage(event)">
<s:layout>
<s:TileLayout/>
</s:layout>
</s:List>

and the itemRenderer is defined as:-

<?xml version="1.0"?>
<s:ItemRenderer
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark<http://ns.adobe.com/flex/spark>"
        dataChange="onDataChange(event)"
        render="onRender(event)"
        width="150" height="175"
        >

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script><![CDATA[
        import DateUtils;

        import mx.events.FlexEvent;

        private function onDataChange(event:FlexEvent):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange: dataChange event, index=" + itemIndex + ", this="+this);
        }

        private function onRender(event:Event):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onRender; render event, index=" + itemIndex + ", this="+this);
        }
        ]]></fx:Script>
    <s:BitmapImage source="{data.image}" width="150" height="150"/>
    <s:Label text="{data.timestamp}" width="150"/>

</s:ItemRenderer>

--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group


Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

Chris Velevitch
Why shouldn't all lists virtualise? If the dataProvider of a list has a
large or very large number of items, doesn't it make sense to only create
enough itemRenderers for the visible area?


On Sat, Feb 15, 2014 at 9:30 AM, Alex Harui <[hidden email]> wrote:

>
>
> Yep, didn't notice you are using TileLayout.  I'm pretty sure it doesn't
> virtualize
>
>
>   From: Chris Velevitch <[hidden email]>
> Reply-To: "[hidden email]" <[hidden email]>
> Date: Friday, February 14, 2014 2:26 AM
> To: "[hidden email]" <[hidden email]>
> Subject: Re: [flexcoders] Whay are too many itemrenderers being created?
>
>
>
> That makes no difference. I did notice that <VerticalLayout/> always
> virtualises regardless of whether useVirtualLayout is true or false.
>
>  It looks like <TileLayout/> never virtualises, so I suspect it's a bug,
> but I haven't had a chance to look into how layouts work to confirm this.
>
>
> On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]> wrote:
>
>>
>>
>> useVirtualLayout property?
>>
>>   From: Chris Velevitch <[hidden email]>
>> Reply-To: "[hidden email]" <[hidden email]>
>> Date: Thursday, February 13, 2014 7:34 PM
>> To: "[hidden email]" <[hidden email]>
>> Subject: [flexcoders] Whay are too many itemrenderers being created?
>>
>>
>>
>> I'm using Flex 4.11 with Air 4.0 to create a mobile app.
>>
>>  I have a spark list with a custom mxml itemRenderer. Only 4 instances
>> will be visible in the list. The dataprovider is initially empty.
>>
>>  When I assign the array collection with an array of 147 items, I get
>> 147 traces on dataChange event and on the render event. I traced out the
>> value of 'this' and I get 147 unique objects.
>>
>>  I was under the impression that only 4 instances of the itemRenderer
>> will be created and get reused as I scroll through the list.
>>
>>  What have I overlooked?
>>
>>  The list is defined as:-
>>
>>  <s:List id="lImages" dataProvider="{imageList}" width="100%"
>> height="100%" allowMultipleSelection="true"
>>            change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
>> doubleClickEnabled="true" doubleClick="showImage(event)">
>> <s:layout>
>> <s:TileLayout/>
>> </s:layout>
>> </s:List>
>>
>>  and the itemRenderer is defined as:-
>>
>>  <?xml version="1.0"?>
>> <s:ItemRenderer
>>          xmlns:fx="http://ns.adobe.com/mxml/2009"
>>         xmlns:s="library://ns.adobe.com/flex/spark"
>>         dataChange="onDataChange(event)"
>>         render="onRender(event)"
>>         width="150" height="175"
>>         >
>>
>>      <s:layout>
>>         <s:VerticalLayout/>
>>     </s:layout>
>>
>>      <fx:Script><![CDATA[
>>         import DateUtils;
>>
>>          import mx.events.FlexEvent;
>>
>>          private function onDataChange(event:FlexEvent):void {
>>             trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange:
>> dataChange event, index=" + itemIndex + ", this="+this);
>>         }
>>
>>          private function onRender(event:Event):void {
>>             trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
>> render event, index=" + itemIndex + ", this="+this);
>>         }
>>         ]]></fx:Script>
>>     <s:BitmapImage source="{data.image}" width="150" height="150"/>
>>     <s:Label text="{data.timestamp}" width="150"/>
>>
>>  </s:ItemRenderer>
>>
>>  --
>>
>>
>> Chris
>> --
>> Chris Velevitch
>> Manager - Adobe Platform Users Group, Sydney
>> m: 0415 469 095
>> www.apugs.org.au
>>
>> Adobe Platform Users Group, Sydney
>> Topic: TBD
>> Date: Monday, 28th February
>> Details and RSVP on
>> http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>>
>>
>>
>>
>
>
>  --
>
>
> Chris
> --
> Chris Velevitch
> Manager - Adobe Platform Users Group, Sydney
> m: 0415 469 095
> www.apugs.org.au
>
> Adobe Platform Users Group, Sydney
> Topic: TBD
> Date: Monday, 28th February
> Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>
>
>
>
>



--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
Reply | Threaded
Open this post in threaded view
|

RE: Whay are too many itemrenderers being created?

Alex Harui
​They should all virtualize, but it takes a bit of effort to make a virtual TileLayout and we don't hear enough requests for it to get around to doing it.


-Alex

________________________________
From: [hidden email] <[hidden email]> on behalf of Chris Velevitch <[hidden email]>
Sent: Friday, February 14, 2014 5:35 PM
To: [hidden email]
Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



Why shouldn't all lists virtualise? If the dataProvider of a list has a large or very large number of items, doesn't it make sense to only create enough itemRenderers for the visible area?


On Sat, Feb 15, 2014 at 9:30 AM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:


Yep, didn't notice you are using TileLayout.  I'm pretty sure it doesn't virtualize


From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Friday, February 14, 2014 2:26 AM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



That makes no difference. I did notice that <VerticalLayout/> always virtualises regardless of whether useVirtualLayout is true or false.

It looks like <TileLayout/> never virtualises, so I suspect it's a bug, but I haven't had a chance to look into how layouts work to confirm this.


On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:


useVirtualLayout property?

From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Thursday, February 13, 2014 7:34 PM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: [flexcoders] Whay are too many itemrenderers being created?



I'm using Flex 4.11 with Air 4.0 to create a mobile app.

I have a spark list with a custom mxml itemRenderer. Only 4 instances will be visible in the list. The dataprovider is initially empty.

When I assign the array collection with an array of 147 items, I get 147 traces on dataChange event and on the render event. I traced out the value of 'this' and I get 147 unique objects.

I was under the impression that only 4 instances of the itemRenderer will be created and get reused as I scroll through the list.

What have I overlooked?

The list is defined as:-

<s:List id="lImages" dataProvider="{imageList}" width="100%" height="100%" allowMultipleSelection="true"
           change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
doubleClickEnabled="true" doubleClick="showImage(event)">
<s:layout>
<s:TileLayout/>
</s:layout>
</s:List>

and the itemRenderer is defined as:-

<?xml version="1.0"?>
<s:ItemRenderer
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark<http://ns.adobe.com/flex/spark>"
        dataChange="onDataChange(event)"
        render="onRender(event)"
        width="150" height="175"
        >

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script><![CDATA[
        import DateUtils;

        import mx.events.FlexEvent;

        private function onDataChange(event:FlexEvent):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange: dataChange event, index=" + itemIndex + ", this="+this);
        }

        private function onRender(event:Event):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onRender; render event, index=" + itemIndex + ", this="+this);
        }
        ]]></fx:Script>
    <s:BitmapImage source="{data.image}" width="150" height="150"/>
    <s:Label text="{data.timestamp}" width="150"/>

</s:ItemRenderer>

--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group


Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

Chris Velevitch
What is the Issue number so I can vote for it?


On Tue, Feb 18, 2014 at 6:39 PM, Alex Harui <[hidden email]> wrote:

>
>
>  They should all virtualize, but it takes a bit of effort to make a
> virtual TileLayout and we don't hear enough requests for it to get around
> to doing it.
>
>
>  -Alex
>  ------------------------------
> *From:* [hidden email] <[hidden email]> on behalf
> of Chris Velevitch <[hidden email]>
> *Sent:* Friday, February 14, 2014 5:35 PM
> *To:* [hidden email]
>
> *Subject:* Re: [flexcoders] Whay are too many itemrenderers being created?
>
>
>
> Why shouldn't all lists virtualise? If the dataProvider of a list has a
> large or very large number of items, doesn't it make sense to only create
> enough itemRenderers for the visible area?
>
>
> On Sat, Feb 15, 2014 at 9:30 AM, Alex Harui <[hidden email]> wrote:
>
>>
>>
>> Yep, didn't notice you are using TileLayout.  I'm pretty sure it doesn't
>> virtualize
>>
>>
>>   From: Chris Velevitch <[hidden email]>
>> Reply-To: "[hidden email]" <[hidden email]>
>>  Date: Friday, February 14, 2014 2:26 AM
>> To: "[hidden email]" <[hidden email]>
>> Subject: Re: [flexcoders] Whay are too many itemrenderers being created?
>>
>>
>>
>> That makes no difference. I did notice that <VerticalLayout/> always
>> virtualises regardless of whether useVirtualLayout is true or false.
>>
>>  It looks like <TileLayout/> never virtualises, so I suspect it's a bug,
>> but I haven't had a chance to look into how layouts work to confirm this.
>>
>>
>> On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]> wrote:
>>
>>>
>>>
>>> useVirtualLayout property?
>>>
>>>   From: Chris Velevitch <[hidden email]>
>>> Reply-To: "[hidden email]" <[hidden email]>
>>> Date: Thursday, February 13, 2014 7:34 PM
>>> To: "[hidden email]" <[hidden email]>
>>> Subject: [flexcoders] Whay are too many itemrenderers being created?
>>>
>>>
>>>
>>> I'm using Flex 4.11 with Air 4.0 to create a mobile app.
>>>
>>>  I have a spark list with a custom mxml itemRenderer. Only 4 instances
>>> will be visible in the list. The dataprovider is initially empty.
>>>
>>>  When I assign the array collection with an array of 147 items, I get
>>> 147 traces on dataChange event and on the render event. I traced out the
>>> value of 'this' and I get 147 unique objects.
>>>
>>>  I was under the impression that only 4 instances of the itemRenderer
>>> will be created and get reused as I scroll through the list.
>>>
>>>  What have I overlooked?
>>>
>>>  The list is defined as:-
>>>
>>>  <s:List id="lImages" dataProvider="{imageList}" width="100%"
>>> height="100%" allowMultipleSelection="true"
>>>            change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
>>> doubleClickEnabled="true" doubleClick="showImage(event)">
>>> <s:layout>
>>> <s:TileLayout/>
>>> </s:layout>
>>> </s:List>
>>>
>>>  and the itemRenderer is defined as:-
>>>
>>>  <?xml version="1.0"?>
>>> <s:ItemRenderer
>>>          xmlns:fx="http://ns.adobe.com/mxml/2009"
>>>         xmlns:s="library://ns.adobe.com/flex/spark"
>>>         dataChange="onDataChange(event)"
>>>         render="onRender(event)"
>>>         width="150" height="175"
>>>         >
>>>
>>>      <s:layout>
>>>         <s:VerticalLayout/>
>>>     </s:layout>
>>>
>>>      <fx:Script><![CDATA[
>>>         import DateUtils;
>>>
>>>          import mx.events.FlexEvent;
>>>
>>>          private function onDataChange(event:FlexEvent):void {
>>>             trace(DateUtils.currentTime() +
>>> "PhotoThumbNail.onDataChange: dataChange event, index=" + itemIndex + ",
>>> this="+this);
>>>         }
>>>
>>>          private function onRender(event:Event):void {
>>>             trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
>>> render event, index=" + itemIndex + ", this="+this);
>>>         }
>>>         ]]></fx:Script>
>>>     <s:BitmapImage source="{data.image}" width="150" height="150"/>
>>>     <s:Label text="{data.timestamp}" width="150"/>
>>>
>>>  </s:ItemRenderer>
>>>
>>>  --
>>>
>>>
>>> Chris
>>> --
>>> Chris Velevitch
>>> Manager - Adobe Platform Users Group, Sydney
>>> m: 0415 469 095
>>> www.apugs.org.au
>>>
>>> Adobe Platform Users Group, Sydney
>>> Topic: TBD
>>> Date: Monday, 28th February
>>> Details and RSVP on
>>> http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>>>
>>>
>>>
>>>
>>
>>
>>  --
>>
>>
>> Chris
>> --
>> Chris Velevitch
>> Manager - Adobe Platform Users Group, Sydney
>> m: 0415 469 095
>> www.apugs.org.au
>>
>> Adobe Platform Users Group, Sydney
>> Topic: TBD
>> Date: Monday, 28th February
>> Details and RSVP on
>> http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>>
>>
>>
>>
>
>
>  --
>
>
> Chris
> --
> Chris Velevitch
> Manager - Adobe Platform Users Group, Sydney
> m: 0415 469 095
> www.apugs.org.au
>
> Adobe Platform Users Group, Sydney
> Topic: TBD
> Date: Monday, 28th February
> Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>
>
>
>
>



--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
Reply | Threaded
Open this post in threaded view
|

RE: Whay are too many itemrenderers being created?

Alex Harui
​I'm not even sure there is a JIRA issue.  I think this is only the second or third time it has come up on a forum/mailing list.


-Alex

________________________________
From: [hidden email] <[hidden email]> on behalf of Chris Velevitch <[hidden email]>
Sent: Tuesday, February 18, 2014 3:22 AM
To: [hidden email]
Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



What is the Issue number so I can vote for it?


On Tue, Feb 18, 2014 at 6:39 PM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:



They should all virtualize, but it takes a bit of effort to make a virtual TileLayout and we don't hear enough requests for it to get around to doing it.


-Alex

________________________________
From: [hidden email]<mailto:[hidden email]> <[hidden email]<mailto:[hidden email]>> on behalf of Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Sent: Friday, February 14, 2014 5:35 PM
To: [hidden email]<mailto:[hidden email]>

Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



Why shouldn't all lists virtualise? If the dataProvider of a list has a large or very large number of items, doesn't it make sense to only create enough itemRenderers for the visible area?


On Sat, Feb 15, 2014 at 9:30 AM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:


Yep, didn't notice you are using TileLayout.  I'm pretty sure it doesn't virtualize


From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Friday, February 14, 2014 2:26 AM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: Re: [flexcoders] Whay are too many itemrenderers being created?



That makes no difference. I did notice that <VerticalLayout/> always virtualises regardless of whether useVirtualLayout is true or false.

It looks like <TileLayout/> never virtualises, so I suspect it's a bug, but I haven't had a chance to look into how layouts work to confirm this.


On Fri, Feb 14, 2014 at 5:37 PM, Alex Harui <[hidden email]<mailto:[hidden email]>> wrote:


useVirtualLayout property?

From: Chris Velevitch <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Thursday, February 13, 2014 7:34 PM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: [flexcoders] Whay are too many itemrenderers being created?



I'm using Flex 4.11 with Air 4.0 to create a mobile app.

I have a spark list with a custom mxml itemRenderer. Only 4 instances will be visible in the list. The dataprovider is initially empty.

When I assign the array collection with an array of 147 items, I get 147 traces on dataChange event and on the render event. I traced out the value of 'this' and I get 147 unique objects.

I was under the impression that only 4 instances of the itemRenderer will be created and get reused as I scroll through the list.

What have I overlooked?

The list is defined as:-

<s:List id="lImages" dataProvider="{imageList}" width="100%" height="100%" allowMultipleSelection="true"
           change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
doubleClickEnabled="true" doubleClick="showImage(event)">
<s:layout>
<s:TileLayout/>
</s:layout>
</s:List>

and the itemRenderer is defined as:-

<?xml version="1.0"?>
<s:ItemRenderer
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark<http://ns.adobe.com/flex/spark>"
        dataChange="onDataChange(event)"
        render="onRender(event)"
        width="150" height="175"
        >

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <fx:Script><![CDATA[
        import DateUtils;

        import mx.events.FlexEvent;

        private function onDataChange(event:FlexEvent):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange: dataChange event, index=" + itemIndex + ", this="+this);
        }

        private function onRender(event:Event):void {
            trace(DateUtils.currentTime() + "PhotoThumbNail.onRender; render event, index=" + itemIndex + ", this="+this);
        }
        ]]></fx:Script>
    <s:BitmapImage source="{data.image}" width="150" height="150"/>
    <s:Label text="{data.timestamp}" width="150"/>

</s:ItemRenderer>

--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group





--


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au<http://www.apugs.org.au/>

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 28th February
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group


Reply | Threaded
Open this post in threaded view
|

Re: Whay are too many itemrenderers being created?

edmoreyra
In reply to this post by Chris Velevitch
El 14/02/2014 03:34, "Chris Velevitch" <[hidden email]>
escribió:y
>ojuouoyoyoyo
>  jiihk
>yoyoyomkkyoyoyoyoyopipup
> I'm using Flex yooyo witkh gAir 4.0 to create a mobile appbupui.iyo.yoyoyo
>
> I have a spark list with a custom mxml itemRenderer. Only 4 instances
will be visible in the list. The dataprovider is initially hluu
>
> When I assign the arrayp collection with an array of 14b7 items, I get
147 traces on dataChange event and on the render event. I traced out the
value of 'this' and I get 147 unique objects.
>
> I was under the impression that only 4 instances of the itemRenderer will
be created and get reused as I scroll through the list.
>
> What have I overlooked?
>
> The list is defined as:-
>
> <s:List id="lImageshup dataProvider="{imageList}" width="100%b
height="100%"uhup allowMultipleSelection="true"

>            change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
> doubleClickEnabled="true" doubleClick="showImage(event)">
> <s:layout>
> <s:TileLayout/>
> </s:layout>
> </s:List>
>
> and the itemRenderer is defined as:-
>
> <?xml version="1.0"?>
> <s:ItemRendererup
>         xmlns:fx="http://ns.adobe.com/mxml/2009"
>         xmlns:s="library://ns.adobe.com/flex/spark"
>         dataChange="onDataChange(event)"uouojiyo
>         render="onRender(event)"
>         width="150"hlyo height="175"up
>         hlup
>
>     <s:layout>
>         <s:VerticalLayout/>
>     </s:layout>
>
>     <fx:Script><![CDATA[
>         import DateUtils;
>
>         import mx.events.FlexEvent;
>
>         private function onDataChange(event:FlexEvent):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange:
dataChange event, index=" + itemIndex + ", this="+this);
>         }
>
>         private function onRender(event:Event):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
render event, index=" + itemIndex + ", this="+this);

>         }
>         ]]></fx:Script>
>     <s:BitmapImage source="{data.image}" width="150" height="150"/>
>     <s:Label text="{data.timestamp}" width="150"/>
>
> </s:ItemRenderer>
>
> --
>
>
> Chris
> --
> Chris Velevitch
> Manager - Adobe Platform Users Group, Sydney
> m: 0415 469 095
> www.apugs.org.au
>
> Adobe Platform Users Group, Sydney
> Topic: TBD
> Date: Monday, 28th February
> Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>
>
El 14/02/2014 03:34, "Chris Velevitch" <[hidden email]> escribió:
>
>
>
> I'm using Flex 4.11 with Air 4.0 to create a mobile app.
>
> I have a spark list with a custom mxml itemRenderer. Only 4 instances
will be visible in the list. The dataprovider is initially empty.
>
> When I assign the array collection with an array of 147 items, I get 147
traces on dataChange event and on the render event. I traced out the value
of 'this' and I get 147 unique objects.
>
> I was under the impression that only 4 instances of the itemRenderer will
be created and get reused as I scroll through the list.
>
> What have I overlooked?
>
> The list is defined as:-
>
> <s:List id="lImages" dataProvider="{imageList}" width="100%"
height="100%" allowMultipleSelection="true"

>            change="lImagesChange(event)" itemRenderer="PhotoThumbNail"
> doubleClickEnabled="true" doubleClick="showImage(event)">
> <s:layout>
> <s:TileLayout/>
> </s:layout>
> </s:List>
>
> and the itemRenderer is defined as:-
>
> <?xml version="1.0"?>
> <s:ItemRenderer
>         xmlns:fx="http://ns.adobe.com/mxml/2009"
>         xmlns:s="library://ns.adobe.com/flex/spark"
>         dataChange="onDataChange(event)"
>         render="onRender(event)"
>         width="150" height="175"
>         >
>
>     <s:layout>
>         <s:VerticalLayout/>
>     </s:layout>
>
>     <fx:Script><![CDATA[
>         import DateUtils;
>
>         import mx.events.FlexEvent;
>
>         private function onDataChange(event:FlexEvent):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onDataChange:
dataChange event, index=" + itemIndex + ", this="+this);
>         }
>
>         private function onRender(event:Event):void {
>             trace(DateUtils.currentTime() + "PhotoThumbNail.onRender;
render event, index=" + itemIndex + ", this="+this);

>         }
>         ]]></fx:Script>
>     <s:BitmapImage source="{data.image}" width="150" height="150"/>
>     <s:Label text="{data.timestamp}" width="150"/>
>
> </s:ItemRenderer>
>
> --
>
>
> Chris
> --
> Chris Velevitch
> Manager - Adobe Platform Users Group, Sydney
> m: 0415 469 095
> www.apugs.org.au
>
> Adobe Platform Users Group, Sydney
> Topic: TBD
> Date: Monday, 28th February
> Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group
>
>