Data Paging With Pure AS3 - actionscript-3

I have a Flash Datagrid component being populated by data from Robotlegs services. However as the datagrid needs to show more and more rows of info I need to implement a way of loading the data as it is needed. Ideally this will be as the user scrolls down the list, I have seen this in Flex examples but I could do with a pure AS3 solution. Does anyone have any guidance or ideas how to approach this?
Here is the Flex example: http://www.jamesward.com/2010/10/11/data-paging-in-flex-4/
Any guidance would be appreciated.

I think you'll need to extend the Flash DG to use something like an AsyncListView and look at the AsyncListView to see how it does it, then write it to generate the correct events when an item isn't found, but remove any dependencies to Flex. You'll also need to do something that acts like the Responder class to support having different overlapping calls to the same service.

Related

Datagrids and AS3

I am currently using the fl.controls.DataGrid in my as3 application. In addition to very frustrating bugs, it seems to have very bad performances especially when your data size increases.
Is there a simple way to make an efficient datagrid with as3?
The best success I have had is with setting as few of the properties as possible, tying the data to a simple AS object class that contains only the data properties and writing it directly to an ArrayCollection. If your class includes a 'label' property you can pretty much get away without setting anything but the dataprovider (which I emphasize should always be an arraycollection; I forego the creating an array then 'wrapping' it in an arrayCollection) but having a tightly bound model for the data seems to improve the useability. I have heard that using xml data offers a slight improvement, but I prefer pure AS classes, which outperform mxml by a mile.
It always has been that all my AS3 woes stem from the display end of things. Pure AS3 would be a God-send if they could come up with a replacement for mxml.
P.S. avoid item editors! they work great if you only have 50 records, but the grids are designed to DISPLAY data ((a pure text grid of 250k records should scroll fine....) Always edit the data, not the grid. Pull the data into a form to edit. The data binding will take care of updating the grid.

Custom cell in list in Flash AS3

I am no expert in Flash, and I need some quick help here, without needing to learn everything from scratch.
Short story, I have to make a list where each cell contains an image, two labels, and a button.
List/Cell example:
img - label - label - button
img - label - label - button
As a Java-programmer, I have tried to quicly learn the syntax and visualness of Flash and AS3, but with no luck so far.
I have fairly understood the basics of movie clips etc.
I saw a tutorial on how to add a list, and add some text to it. So I dragged in a list, and in the code went list.addItem({label:"hello"}); , and that worked ofc. So i thought if I double-clicked the MC of the list, i would get to tweak some things. In there I have been wandering around different halls of cell-renderers etc.
I have now come to the point that I entered the CellRenderer_skinUp or something, and customized it to my liking. When this was done, I expected i could use list.addItem(); and get an empty "version" of my cell, with the img, labels and the button. But AS3 expects an input in addItem. From my object-oriented view, I am thinking that i have to create an object of the cell i have made, but i have no luck reaching it.. I tried to go
var test:CellRenderer = list.listItem;
list.addItem(test);
..But with no luck.
This is just for funsies, but I really want to make this work, however not so much that I am willing to read up on ALOT of Flash and AS3. I felt that I was closing in on the prize, but the compiler expected a semicolon after the variable (list.addItem({test:something});).
Note: If possible, I do NOT want this:
list.addItem({image:"src",label:"text",label"text",button:"text"});
Well.. It actually is what I want, but I would really like to custom-draw everything.
Does anyone get what I am trying to do, and has any answers for me? Am I approaching this the wrong way? I have searched the interwebs for custom list-cells, but with no luck.
Please, any guiding here is appreciated!
Sti
You could use a Datagrid as well, with each column pointing to the appropriate part of the data source (possibly even the same field, depending on what you're doing). You can then just use the ImageCell as the renderer for the second and third colums.
I think you're just not understanding that Adobe, in the own woolly-headed little way, is separating the Model from the View on your behalf. You hand the Model to the View and then get out of the way. The extent of what you can/should change is just telling it what renderer to pop your data into.
In fact, the fl.controls don't give you much control at all about how they work--I wouldn't go down the road of trying to create a custom itemRenderer with any signifcant functionality for them if you don't fully understand how the Display List works and if you're not comfortable digging around in the debugger and ferreting out all kinds of undocumented information.
For more details (to the extent anyone knows anything about how these work), see
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt1.html
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt2.htmlhttp://www.adobe.com/devnet/flash/quickstart/datagrid_pt3.html
http://www.adobe.com/devnet/flash/quickstart/tilelist_component_as3.html
Do you have the option to use the Flex Framework instead of pure Flash? It makes this kind of extension much more satisfying. It's aimed more at application developers, whereas Adobe sees Flash users more as designers.

When to use ContainerMovieClip and when to use UIMovieClip?

I am using Flex with Flash Builder 4 and it provides two classes to work with Custom Flash Professional components, the ContainerMovieClip and UIMovieClip.
I am confused on when to use a ContainerMovieClip and when to use a UIMovieClip.
Since ContainerMovieClip can hold only one component, I don't see how is it better than just placing the component directly on the design area.
I would have thought of using it as a inner frame to arrange multiple components that can be moved together by modifying the X,Y coordinates of the container, but I understand this isn't how it works, right?
I'd appriciate if you could answer this or direct me to an article on
1) When to use UIMovieClip and when to use a ContainerMovieClip?
2) Why ContainerMovieClip can hold only a single component?
Thanks.
RaamEE
Adobe's help docs are very useful and 90% of the time they will answer your questions.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/UIMovieClip.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/ContainerMovieClip.html

JQuery or canvas layout tool (snap to grid)

I'm trying to implement some kind of drag and drop snap to grid similar to something like this
http://wordsquared.com/. Was contemplating trying to use JQuery UI and somehow save the position of the items. Seems like snapping to a grid, and saving would be a fairly common scenario. I was contemplating trying to implement this all in Drupal, any suggestions, examples, things I ay not be aware of would be very helpfull.
It sounds like the Homebox module may be close to what you're looking for.

AS3 Touch Class Examples?

Anybody know any good resources for touch interface in AS3? Maybe with example downloads of simple user interface examples such as swiping lists etc. I could write code that reacts to the mouse events but I was wondering if their is a more a intuitive way of doing it using the native touch events class? Thanks. I also believe better 3rd party classes are available but I would rather stick with the adobe classes right now unless you guys think otherwise?
Check out Multi Touch Gesture Applications and Responding to Raw Touch Data for a start.