Custom cell in list in Flash AS3

Posted by Stian Flatby on Stack Overflow See other posts from Stack Overflow or by Stian Flatby
Published on 2012-07-03T02:42:09Z Indexed on 2012/07/03 3:15 UTC
Read the original article Hit count: 176

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flash