Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-07-2010, 11:02 AM   #1
Join Date: Apr 2007
Location: belgium
Posts: 68
Default Itemrenderer for Images

I have created an Itemrenderer component in MXML in order to insert an image into a Datagrid. (e.g :in case the value.category == 2, then load "assets/2.jpg" )

However the image does not appear.
Here is the code for the ItemRenderer ;

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">         <mx:Script>         <![CDATA[             import mx.controls.DataGrid;             import mx.collections.ArrayCollection;             import flash.net.*;             import flash.display.*;         private var dataGridPredictionImg:ArrayCollection = new ArrayCollection (                 [{Ref:"assets/0.jpg"},         {Ref:"assets/1.jpg"},         {Ref:"assets/2.jpg"},         {Ref:"assets/3.jpg"},         {Ref:"assets/4.jpg"},         {Ref:"assets/5.jpg"}         ]);                                 // create an array, with each array element refering to img         // e.g. array[1] refers to "1.jpg", array[5] refers to "5.jpg"                   override public function set data(value:Object):void {                 super.data = value;         var link:URLRequest = new URLRequest(dataGridPredictionImg[value.category].Ref)         var loader:URLLoader = new URLLoader();         loader.load(link);                 return;                 } // end overide                                         ]]>     </mx:Script> </mx:Canvas>
guide0 is offline   Reply With Quote
Old 05-07-2010, 08:40 PM   #2
Registered User
Join Date: Mar 2008
Posts: 21

Hi guide0,

Same time ago, I have wrote a post about showing images using itemrenderer in an tile list, may be is useful for you!

here is de link: http://www.adilbenmoussa.com/blog/20...s-in-tilelist/

Kind Regards,
ABM is offline   Reply With Quote

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 On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:32 AM.

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.