Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 04:49
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  V2 Components (Flash MX 2004 - Flash 8) (Moderators: vesa kortelainen, Ronald Wernecke, Jorge Solis, ..:: Mazhar Hasan ::.., papachan)
| | |-+  ImageCellRendere
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: ImageCellRendere  (Read 4723 times)
Pluda
Senior Programmer
****
Posts: 270


View Profile
« on: 03/23/07, 07:57 »

Hello,

Need some help here,

I've one imageCellRenderer to use with a datagrid like this

ImageCellRenderer.as

import mx.core.UIComponent;
class imageCellRender extends UIComponent {
   //
   var img:MovieClip;
   var url:String = "pics/icones_peq/";
   var listOwner:MovieClip;
   var getCellIndex:Function;
   var getDataLabel:Function;
   //      
   function setValue(str:String, item:Object, sel:Boolean):Void {
      img.loadMovie(url+""+item[getDataLabel()]+"?"+getTimer());
   }
}

then im my movie I use

column = _root.mc_grid.grid.getColumnAt(0);
column.width = 70;
column.cellRenderer = "imageCellRender";


It works almost fine, the icons apear in my datagrid, but somehow, they are loaded plenty of times and not just once.

Where can the problem be?

Thanks,

Pluda
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 03/23/07, 12:40 »

The setValue fires constantly, in the rollOver/rollOut, scroll, etc (just add some trace to check) Probably you want to check if it's there prior to load, i.e:

if(img._width<1)  img.loadMovie(url+""+item[getDataLabel()]+"?"+getTimer());

Jorge
Logged

Pluda
Senior Programmer
****
Posts: 270


View Profile
« Reply #2 on: 03/23/07, 13:40 »

Hello Jorge, thanks for reply,

no, that didn't work, I'm out of ideas in this subject :-(

Thanks
Logged
Pluda
Senior Programmer
****
Posts: 270


View Profile
« Reply #3 on: 03/23/07, 14:51 »

Sorry for lepping posting, but I'm finding my errors and I don't see how to solve them.

Using the ImageCellRendere, I can use images in my datagrid, but when removing rows, all the data in the choosen row disapears, but the images don't.

So the question is:

When using imageCellRenderer, is there any way of return a reference of the instance name of the movieclip the datagrid used to load the image, so we can use removeMovieClip to remove her if needed?

This may be complicated, I'm soory for my english, I can't describe it better.

I'm posting an example code

to add some content to the grid

var refer:Object = {Product:""+pic+"", Qt:""+_quant_.text+"", Ref:""+ref+"", Preço:""+preco+""};
_root.mc_grid.grid.addItem(refer);


to remove a selected row

que_produto.click = function() {
   //
   var numero:Number = _root.mc_grid.grid.selectedIndex;
   var foto:String = _root.mc_grid.grid.getItemAt(numero).Product.img;
   trace(foto);
   _root.mc_grid.grid.unloadMovieNum(foto);
   _root.mc_grid.grid.removeItemAt(_root.mc_grid.grid.selectedIndex);
   //
};

this does remove the select row, but doesn't unload the image.


Did I make myself untherstand?


Thanks a lot for help :-)
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #4 on: 03/23/07, 17:18 »

Try the HTMLCellrenderer, it can load images plus other things: http://philflash.inway.fr/dghtmlrd/dghtmlrd.html

Jorge
Logged

Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything