flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Martin <chrsm...@outlook.com>
Subject RE: Custom Item renderer to show various icons
Date Sat, 21 Mar 2015 14:55:07 GMT
You can embed your image assets through the Embed metatag [1].  Or you can get a little fancy
and use the ResourceManager to manage all of your embedded image assets [2].
 
Chris
 
[1] http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf60546-7ff2.html
[2] http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f3a.html
 
> Date: Sat, 21 Mar 2015 07:40:16 -0500
> Subject: Re: Custom Item renderer to show various icons
> From: markzolotoy@gmail.com
> To: users@flex.apache.org
> 
> How would this work if I compile all my resources into a swf file? How can
> I then get an image source at the run-time?
> 
> Thanks
> 
> On Wed, Mar 18, 2015 at 3:42 PM, Alex Harui <aharui@adobe.com> wrote:
> 
> > Did you try:
> >
> > if (data)
> > {
> >   var c:Class = data.status == 0 ? _icon1 : _icon2;
> >   image.source = new c();
> > }
> >
> >
> >
> >
> > On 3/18/15, 8:18 AM, "mark goldin" <markzolotoy@gmail.com> wrote:
> >
> > >I need to have a custom renderer in ADG to show different icons in a cell.
> > >Here is my simplified code for the renderer:
> > >
> > >private var _IconsSourceArrayCol:ArrayCollection = new ArrayCollection();
> > >
> > >[Embed(source=".icon1.png")]
> > >private var _icon1:Class;
> > >[Embed(source="icon2.png")]
> > >private var _icon2:Class;
> > >
> > >....
> > >override public function set data(value:Object):void
> > >{
> > >super.data = value;
> > >if (data)
> > >{
> > >_IconsSourceArrayCol.addItem({source:_icon1});
> > >                _IconsSourceArrayCol.addItem({source:_icon2});
> > >image.source = _IconsSourceArrayCol[data.status].source;
> > >}
> > >}
> > >
> > >Is there a better way of doing it?
> > >
> > >Thanks
> >
> >
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message