Coder Social home page Coder Social logo

greenishflow / recycle_scroll_as3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vipul11088/recycle_scroll_as3

0.0 2.0 0.0 108 KB

The list uses an object pool to recycle the list item renderers. This gives the list the ability to scroll very large sets of items without taking a memory hit. The down side is that the list no longer accommodates item renderers of variable height.

ActionScript 100.00%

recycle_scroll_as3's Introduction

Recycle_scroll_AS3

Some days ago I was working on a project, in which I have to make a scroll component for device because I have to show a very long list on device. First I used simple touch list, which I had used in my earlier projects for desktop and for devices for short list comparatively. When I checked that component on iPhone 4, it completely stuck for only 500 list renderers. It was like a shocker for me because I have to load around 2500 list, and it was sticking in 500. Then I use flex’s recycle list component, which is perfect for my need, but the another problem for me is that I couldn’t use flex component as my project was a pure ActionScript project. Then I decided to reform that touch list component with pooling concept, so that I can recycle the renderers and can load it for large list. I used the flex recycle concept and apply it in my touch list component. I used object pooling for recycling, which works on following concept: The List creates an instance of a class called ObjectPool, which manages used and unused renderers. Whenever the List needs a new renderer, it asks the pool for a new one and when it does not need a renderer, it returns it to the pool. The pool tries to find unused renderers to satisfy the request for a new renderer and if it cannot, will create a new object and return that. The core part of the logic resides in the onVerticalScroll function. The list always maintains a map of all visible renderers and as the scrollbar scrolls, the map is recalculated and renderers managed if the map is changed.

The list uses an object pool to recycle the list item renderers. This gives the list the ability to scroll very large sets of items without taking a memory hit. The down side is that the list no longer accommodates item renderers of variable height.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.