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 8358111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:41:46+00:00 2026-06-09T10:41:46+00:00

Here’s my problem. I have an mx:Image within an mx:DataGrid column. If I do

  • 0

Here’s my problem. I have an mx:Image within an mx:DataGrid column. If I do not specifically set the width and height of the image, when the image loads into the grid, only a portion of the image is being displayed.

Recreation Steps:

  1. Create new Flex Project (Desktop)
  2. Configure project to use Halo Theme.
  3. Add the following code in their respective locations
    *Note: Make sure the creationComplete event for the windowedApplication is assigned. Also may need some tweaking for any import statements, etc. Sorry.*

  4. This is a quick example of the issue I’m having. When you launch the program, you will see a portion of the image. When you click Rebind, the full image will occur.

I’m trying to get the full image to be displayed on the first bind, not the second without setting the dimensions in the MXML. I have not been successful in having the full image display via ActionScript without some sort of user interaction to occur.

<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;

        protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
        {
            BindData();
        }

        private function BindData():void
        {
            var objOrderItem:Object = new Object();
            var items:ArrayCollection = new ArrayCollection(new Array(objOrderItem));
            dgMain.dataProvider = new ArrayCollection(items.source);
        }   
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<mx:VBox width="100%">
    <mx:Button label="Rebind" click="BindData()" />

    <mx:DataGrid id="dgMain" resizableColumns="false" draggableColumns="false"
                 sortableColumns="false" rowCount="1">
        <mx:columns>
            <mx:DataGridColumn headerText="Thumb" sortable="false" width="60">
                <mx:itemRenderer>
                    <fx:Component>
                        <mx:HBox horizontalGap="0" verticalScrollPolicy="off" horizontalScrollPolicy="off" width="100%">
                            <mx:Image source="https://encrypted-tbn1.google.com/images?q=tbn:ANd9GcTTuc9n_oweh-dv4LUljzh0Lxzn1AvZchODUoSAeGePaDwPqUuw"
                                      width="60" maintainAspectRatio="true" />  
                        </mx:HBox>
                    </fx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>                
        </mx:columns>
    </mx:DataGrid>
    <mx:Label text="Text After Grid" />
</mx:VBox>

Thanks in advance!

  • 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-06-09T10:41:47+00:00Added an answer on June 9, 2026 at 10:41 am

    Problem Solved

    Hello everyone, I was able to solve my problem by adjusting the row height of the DataGrid where my data is being bound to by checking the row height to see if it’s less than the image’s height. Here’s how I did it:

    I attached a listener for the image’s complete event. The listener then fires a function that checks the DataGrid’s rowHeight to see if it’s less than the image’s content’s height. If it is, it updates the rowHeight to the image’s content’s height.

    I just was not successful using any of the methods suggested here, as well as any other methods I attempted to use.

    Full code example below:

    Please keep in mind, this is a quick, and simple implementation of the fix. And more elaborate implementation, IE the one I used in my project, works just as well.

    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           creationComplete="windowedapplication1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import controls.Photo.PhotoComponentForDataGrid;
    
                import flash.utils.setTimeout;
    
                import mx.collections.ArrayCollection;
                import mx.controls.Image;
                import mx.events.FlexEvent;
    
                protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
                {
                    BindData();
                }
    
                public function doImageDownloaded(imgLoaded:Image):void
                {   
                    if (dgMain.rowHeight < imgLoaded.content.height)
                    {
                        dgMain.rowHeight = imgLoaded.content.height;
                    }
                }
    
                private function BindData():void
                {
                    var objOrderItem:Object = new Object();
                    objOrderItem.photoUrl = "http://c10008669.r69.cf2.rackcdn.com/9770258a-6ac1-4db5-956a-ada08beb7ae5/SK-000713/001/thumb_350/gallery.jpg";
    
                    var items:ArrayCollection = new ArrayCollection(new Array(objOrderItem));
                    dgMain.dataProvider = new ArrayCollection(items.source);
                }   
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    
        <mx:VBox width="100%">
            <mx:HBox>
                <mx:Button label="Rebind" click="BindData()" />
            </mx:HBox>
    
            <!-- Items for Distribution Order -->
            <mx:DataGrid id="dgMain" resizableColumns="false" draggableColumns="false"
                         sortableColumns="false" rowCount="1" variableRowHeight="true">
                <mx:columns>
                    <mx:DataGridColumn headerText="Thumb" sortable="false" width="60">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:HBox horizontalGap="0" verticalScrollPolicy="off" horizontalScrollPolicy="off" width="100%">
    
                                    <fx:Script>
                                        <![CDATA[
                                            protected function image1_completeHandler(event:Event):void
                                            {
                                                outerDocument.doImageDownloaded(imgThumb);
                                            }
                                        ]]>
                                    </fx:Script>
    
                                    <mx:Image id="imgThumb" source="https://encrypted-tbn1.google.com/images?q=tbn:ANd9GcTTuc9n_oweh-dv4LUljzh0Lxzn1AvZchODUoSAeGePaDwPqUuw"
                                              complete="image1_completeHandler(event)"/>    
                                </mx:HBox>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>
            </mx:DataGrid>
            <mx:Label text="Text After Grid" />
        </mx:VBox>
    </s:WindowedApplication>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a problem I ran into recently. I have attributes strings of the form
Here is my problem : I have a post controller with the action create.
Here is the problem that I am trying to solve. I have two folders
Here Scenario is HttpContext.Current.Session[value].ToString() gives null value, even have already set session value when
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here's the basic setup: I have a thin bar at the top of a
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),

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.