Solved

Renderer and TileList

Posted on 2008-11-01
2
1,022 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now