Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3342136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:48:12+00:00 2026-05-18T00:48:12+00:00

I have a datagrid w/ a custom item renderer, as follows: <mx:AdvancedDataGridColumn dataField=file> <mx:itemRenderer>

  • 0

I have a datagrid w/ a custom item renderer, as follows:

<mx:AdvancedDataGridColumn dataField="file">
<mx:itemRenderer>
<fx:Component>
<mx:HBox paddingLeft="2">
<fx:Script>
<![CDATA[

import mx.core.BitmapAsset;
[Embed(source="components/download.png")]
[Bindable]
public var imgCls:Class;

public function IOErrorEventExample():void {
var loader:URLLoader = new URLLoader();
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
var request:URLRequest=new URLRequest("http://www.site.com/"+data.file);
loader.load(request);
}

private function ioErrorHandler(event:IOErrorEvent):void {
if ( String(event) != null ){
// load the itemrenderer image here if the file exists on our server
var imgObj:BitmapAsset = new imgCls() as BitmapAsset;
myImage.source=imgObj;

}
else {
// don't load the itemrenderer image if the file doesn't exist yet
}}                                      
]]>
</fx:Script>
<mx:Image id="myImage" creationComplete="IOErrorEventExample();"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>

So, if I have the actual file on my server, I want to display download.png image …however, when I compile & run the code above, the .png image appears randomly..regardless of if “file” exists. What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:48:12+00:00Added an answer on May 18, 2026 at 12:48 am

    You need to close off the ioErrorHandler function by adding one last curly brace before you close the CDATA tag

    Can’t say for sure that will fix the problem tho, the logic looks correct. You could try adding an Event.COMPLETE event listener to really make sure the file does exist and is being loaded.

    EDIT:

    You can shorten down this event handler function to just this because:

    1. This function is called only when an IOErrorEvent is dispatched, so there is always going to be an event object present when it is called. (The if statement isn’t needed)

    2. Even if you left the if statement in, there isn’t a need to call the else statement since in the event that the file does exist, this function won’t be called.

    private function ioErrorHandler(event:IOErrorEvent):void 
    {
        var imgObj:BitmapAsset = new imgCls() as BitmapAsset;
        myImage.source=imgObj;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an adobe flex datagrid with a simple custom label itemrenderer in one
I have a datagrid with a custom label itemrenderer (basically it makes the label
I have a datagrid with one datagridcolumn in it. Without a custom itemrenderer I
I have a datagroup where I use a custom itemRenderer with a datagrid inside.
I have a DataGrid component that displays a few columns of data. It has
I have created a custom style for my WPF datagrid by overriding its control
I have a custom <mx:DataGrid /> that is updated with data from a ColdFusion
I have a datagrid getting bound to a dataset, and I want to display
I have a datagrid, populated as shown below. When the user clicks on a
I have a DataGrid where each column has a SortExpression. I would like the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.