With the component I'm creating, I have a simple component with an itemRenderer factory class that loops through the dataProvider to add it's children. The itemRenderer has a TextArea component that the dataProvider fills with htmlText. If I just add each child but don't set the text of each item I get a much faster initiation of the app. I would be happy with setting the text of each item as it's being scrolled into view, but I don't know the best way to do this. Can anyone suggest anything? Basically, I want to draw all the items in my scrolling VBox, but then set the htmlText of each item when, and only when, it is about to come into view. Does that make sense?
Here's the Application:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:components="com.mydomain.view.components.*"
creationComplete="init()">
<mx:Script>
<![CDATA[
[Bindable]
public var items:ICollectionView;
private function init():void{
var str:String = "<textformat leftmargin='20' rightmargin='20'>Some <b>HTML</b> text</textformat>";
items= new ArrayCollection([str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str,
str,str,str,str,str,str,str,str,str,str]);
}
]]>
</mx:Script>
<mx:Canvas width="700" height="100%">
<components:ScrollingViewer dataProvider="{items}" itemRenderer="SimpleItem"/>
</mx:Canvas>
</mx:Application>
Here is my ScrollingViewer component that creates the children:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
private var _dataProvider:Object = null;
public function set dataProvider(value:Object):void {
_dataProvider = value;
for each (var obj:Object in _dataProvider) {
var child:* = itemRenderer.newInstance();
//this is so expensive!!!!
//child.data = ""> addChild(child);
}
}
[Bindable]
public var itemRenderer:IFactory = null;
]]>
</mx:Script>
</mx:VBox>
And the data fills a TextArea component in this SimpleItem itemRenderer:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="100"
horizontalAlign="left" verticalGap="0"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
backgroundColor="0xFFFFFF" borderStyle="none">
<mx:Spacer height="20"/>
<mx:TextArea id="textarea" paddingLeft="0" htmlText="{data}"
focusThickness="0" editable="true" borderStyle="none"
width="300" height="60"
verticalScrollPolicy="off" horizontalScrollPolicy="off"/>
<mx:Spacer height="20"/>
</mx:VBox>
Thanks for any help!
-Dustin
--- In [email protected], "Renaun Erickson" <[EMAIL PROTECTED]> wrote:
>
> I think you know this information I will just try and confirm it so
> you don't go crazy.
>
> The List control does not create all the items up front, which is nice
> for first time loading performance, but once you start scrolling it
> starts to create the items and thats where the scroll issue happens.
>
> And as you mentioned using a Repeater with large datasets has its
> issues too. So basically you have encounted a performance issue with
> Flex/Flash and there is no happy answer.
>
> For more information check out this presentation on Performance & Tips
> http://adobedev.adobe.acrobat.com/p71169528/
>
> Renaun
>
> --- In [email protected], "dirtmediaworld" dustin@
> wrote:
> >
> > Does anyone have any suggestions on how to make a List component
> > scroll smoothly when scrolling vertically. I dug into the framework
> > and got incredibly overwhelmed by the code (specifically,
> > scrollHandler() and scrollVertically()). Basically I don't want the
> > scrolling content to jump to the next row when scrolling, it should be
> > smooth. I will be scrolling through large data sets, so a Repeater
> > inside a scrolling VBox is not going to work. I need it to only draw
> > the bare minimum at a time, so I figured a List would be the best. Any
> > other ideas or suggestions? Thanks for any help!
> > -Dustin
> >
>
__._,_.___
SPONSORED LINKS
| Software development tool | Application development software | Development software |
| Development outsourcing software | Embedded software development |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
