Solved

Renderer and TileList

Posted on 2008-11-01
2
1,025 Views
Last Modified: 2012-08-13
Hi,
I'm trying to use a custom item renderer with a TileList, but I'm getting an error while rendering the renderer ...

My data source is an ArrayCollection that comes from a remote object. Debugging, I noticed that the ArrayCollection contains 2 items. But the data doesn't change. It is always the first object in the ArrayCollection that is set as value in the set data function, and the error comes always on the third time the function is called, because the image component and label is null. So, I get a null pointer exception ...

I couldn't figure out what I'm doing wrong ...

Below is my renderer class ...

Thanks for your help ...
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="54">
	<mx:Script>
		<![CDATA[
			import remote.mirror.Sale;
			
            [Embed(source="assets/internet_plan.png")]
            [Bindable]
            public var netPlan_Icon:Class;			
			
			override public function set data(value:Object):void {
				super.data = value as Sale;
				if (data != null) {
//					imgItemType.source = "assets/internet_plan.png";
					imgItemType.source = new netPlan_Icon();
					lPrice.text = priceFormatter.format(data.amount);
					lItemType.text = data.SourceItem.Categoria;
				}
			}
		]]>
	</mx:Script>
	<mx:CurrencyFormatter id="priceFormatter" currencySymbol="R$" decimalSeparatorFrom="," decimalSeparatorTo="," thousandsSeparatorFrom="." thousandsSeparatorTo="."/>
	<mx:Image id="imgItemType" x="10" y="10" height="34" width="36"/>
	<mx:Label x="69" y="10" text="{data.description}" width="412" textAlign="center" fontFamily="Courier New" fontWeight="bold" fontSize="16" id="lDescription"/>
	<mx:Label x="69" y="29" text="" width="412" textAlign="center" id="lItemType"/>
	<mx:Label x="489" y="10" text="" width="101" height="34" fontWeight="bold" textAlign="right" fontFamily="Verdana" fontSize="16" color="#D34F41" id="lPrice"/>
	
</mx:Canvas>

Open in new window

0
Comment
Question by:marcelocbf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Expert Comment

by:Gary Benade
ID: 22884010
You'll need to show me the rest of the code.


line 15 should be
imgItemType.source = netPlan_Icon;
0
 

Accepted Solution

by:
marcelocbf earned 0 total points
ID: 23063749
Sorry for the delay ... What code else you need to see ?
I found a different way to do that but it was not 100%

Thanks
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Storing Data in multiple Countries 5 53
Any open source type dating sites? 2 156
utf-8 issues 11 138
Live mode in DW, need to creae Session 4 121
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question