Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-03-2006, 03:25 AM   #1
danimal
Registered User
 
Join Date: Jan 2006
Posts: 45
Default CellRenderer example please?

Can someone point out or post a good example of using a CellRenderer in a List please? Every example I've found, including Macromedia's, just does not explain it very well. I've been using cell renderers for a long time in Java Swing, so I'm familiar with how it works in theory, but for some reason ActionScripts's version of it is just not clicking with me.

My current use of it requires displaying an icon, and a bit of text, for an array of objects that holds several fields. But I just cannot see how to make it actually display anything, all I get is a blank field (which is still selectable).

Thanks.
danimal is offline   Reply With Quote
Old 03-03-2006, 12:10 PM   #2
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

http://livedocs.macromedia.com/flash.../00003131.html
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-07-2006, 02:35 PM   #3
danimal
Registered User
 
Join Date: Jan 2006
Posts: 45
Default


Yeah, I've read this and looked over the example code several times, but it just doesn't make any sense. First, there isn't a simple demonstration of a single column list to look at, only datagrids, and I don't see where the value to display gets from the array into the cell object to render. Does the renderer's setValue() just intuit the proper field to display? What about in the more complex example with the combobox and checkbox? I'm just not finding detailed enough documentation from Macromedia or anywhere else on how this works.

Thanks,
Dan
danimal is offline   Reply With Quote
Old 03-07-2006, 02:58 PM   #4
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

Quote:
Does the renderer's setValue() just intuit the proper field to display?
yes ( sortof )

each field has a function "setValue" wich is called then


Quote:
and I don't see where the value to display gets from the array into the cell object to render
here :

setValue(suggestedValue:String, item:Object, selected:Boolean)

item is the object whit the values

eg.

item.MyValue
item.MycheckboxValue
....
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-07-2006, 03:24 PM   #5
danimal
Registered User
 
Join Date: Jan 2006
Posts: 45
Default

Quote:
Originally Posted by Xeef
yes ( sortof )

each field has a function "setValue" wich is called then




here :

setValue(suggestedValue:String, item:Object, selected:Boolean)

item is the object whit the values

eg.

item.MyValue
item.MycheckboxValue
....
Ok, so when I want to add my object into the Array, I would use
addItem({field1:value, field2:value})

Then in setValue() I can retrieve those fields using
item.field1
item.field2
?

I've found that I'm not able to trace() from my cellrenderer class, is that normal or is there some other way to check values while in there?

Thanks for all the help,
Dan
danimal is offline   Reply With Quote
Old 03-07-2006, 03:29 PM   #6
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

you shoud by abel to trace from the class if not there is something wrong !
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-07-2006, 06:31 PM   #7
danimal
Registered User
 
Join Date: Jan 2006
Posts: 45
Default

Quote:
Originally Posted by Xeef
you shoud by abel to trace from the class if not there is something wrong !
So I see-- I put traces in the Macromedia cellrendering example (combobox & checkbox cells in a datagrid) and they output fine. I get nothing in my own single column List cellrenderer though. I don't know what it could be though, I started off with the MultiLineCell example and began customizing from there. I set it with list.cellRenderer = myCellRenderer. Is it done some different way?

Thanks,
Dan
danimal is offline   Reply With Quote
Old 03-07-2006, 07:08 PM   #8
Scottae
Supa Flasha
 
Scottae's Avatar
 
Join Date: May 2004
Location: Atlanta, GA
Posts: 504
Lightbulb

Here's a good example:

http://www.flash-db.com/Tutorials/ce...erer/index.php

Remember, the DataGrid class extends the List class. So it's essentially going to be done the same way for both. The difference being that List components only have one column where DataGrid components can have more than one. You may also want to take a look at this thread as well.

Last edited by Scottae; 03-07-2006 at 07:13 PM.
Scottae is offline   Reply With Quote
Old 03-07-2006, 07:41 PM   #9
Xeef
Off-Line
 
Xeef's Avatar
 
Join Date: Aug 2004
Location: Ibiza/Spain language :Hungarian/German/ abit English
Posts: 6,539
Default

list.cellRenderer = myCellRenderer

myCellRenderer needs to by a STRING whit the library identifier of the clip linked to the cellrendererClass
__________________

test your self -->http://www.actionscript.org/forums/s...86&postcount=8
Xeef is offline   Reply With Quote
Old 03-07-2006, 09:43 PM   #10
danimal
Registered User
 
Join Date: Jan 2006
Posts: 45
Default

Quote:
Originally Posted by Xeef
list.cellRenderer = myCellRenderer

myCellRenderer needs to by a STRING whit the library identifier of the clip linked to the cellrendererClass
Oops, I did mean the string. I'm starting to think somehow my custom cell renderer simply is not being used, and my list.cellRenderer = "myCellRenderer" is just setting an undefined renderer. I put it in an external .as file, found in the same folder as the fla, and it contains all of the MultiLineCell.as example code. Isn't that enough, or is there something else I must do?

Ah, is it necessary to setup the class for exporting using the Linkage Properties dialog as well?

Last edited by danimal; 03-07-2006 at 09:46 PM.
danimal is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing default MX.Button in CellRenderer ButtonRenderer class? adam.s ActionScript 2.0 0 02-22-2006 01:25 PM
tree comp + cellRenderer Frog Components 7 01-18-2006 07:07 PM
DataSet Filters and the cellRenderer Issue LostInRecursion Components 0 11-01-2005 02:35 PM
DataSet DataGrid CellRenderer bug? hugobossv8 Components 1 07-28-2005 08:32 AM
interacting with cellrenderer from outside grid mistermikeb Components 4 01-25-2005 07:43 PM


All times are GMT. The time now is 02:38 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.