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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:52:13+00:00 2026-05-12T21:52:13+00:00

In my flex app there’s an item renderer for a TileList that I am

  • 0

In my flex app there’s an item renderer for a TileList that I am using.
I load the image into the Item Renderer at runtime. I am using the following code to resize the image width and height. But it doesn’t seem to be working.
I debugged the flex app and find that the actual width and height values are getting assigned. But the image never looks the right size.
Here’s my code:

    private function Init() :void
{
    tileImg = new Image();
    tileImg.source = data.ICON;
    tileImg.toolTip = data.TITLE;
    tileImg.buttonMode = true;
    tileImg.addEventListener(Event.COMPLETE, AdjustImageDimensions); 
    this.addChild(tileImg);
} 

private function AdjustImageDimensions(e:Event):void
{ 
    tileImg.width = (e.currentTarget as Image).contentWidth; 
    tileImg.height = (e.currentTarget as Image).contentHeight;
}
  • 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-12T21:52:13+00:00Added an answer on May 12, 2026 at 9:52 pm

    Ok, I had a problem just like this the other day and I fixed it by using the Loader class. You can grab the information after the file has been loaded. You need an event listener attached to the loader as well. Where are you getting the image from anyways? A URL or a FileSystem?

    Here is a quick example:

    package 
    

    {
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.FileReference;

    import mx.controls.Image;
    
    public class MyItemRenderer
    {
        private var fileRef:FileReference = new FileReference();
        private var myLoader:Loader = new Loader();
        public var myDynamicImage:Image;
    
        public function MyItemRenderer()
        {
            fileRef.addEventListener(Event.SELECT, loadImageToCache);
            fileRef.addEventListener(Event.COMPLETE, sendToLoader);
    
            fileRef.browse( /* put file types in this array */ );
        }
    
        private function loadImageToCache(e:Event):void
        {
            fileRef.load();
        }
    
        private function sendToLoader(e:Event):void
        {
            myLoader.loadBytes(fileRef.data);
            myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, createImage);
        }
    
        private function createImage(e:Event):void
        {
            var file:Loader = Loader(e.target);
    
            myDynamicImage = new Image();
            myDynamicImage.source = file;
            myDynamicImage.width = file.width;
            myDynamicImage.height = file.height;
        }
        //now that would be great if you can control the width and height 
        //of these images at runtime, BUT, 
        //chances are if their dynamically loaded, you can't so here...
    
        private function getImgAR(file:Loader):Number
        {
            return file.width/file.height;
        }
    
        //then use this createImage function instead...
    
        /*
    
        private function createImage(e:Event):void
        {
            var file:Loader = Loader(e.target);
            myDynamicImage = new Image();
            myDynamicImage.source = file;
            myDynamicImage.width = 120*getImgAR(file); //you can substitue 120 for your required size
            myDynamicImage.height = 120;//same here
        }
    
        */
    }
    

    }

    hope that helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an App using Adobe Flex/Air. I was wondering if there is any
Is there a way to ensure that when a user views my Flex app,
I use URLLoader to load data into my Flex app (mostly XML) and my
I have a flex app that takes data from a back end database then
I have a flex app that is hosted on my server. It runs off
We have that Flex app talking to the server. We need some kind of
I have a flex app I am scaling using systemManager.stage.scaleMode=StageScaleMode.NO_BORDER; for the most part
I pass text strings from a configuration file into my Flex app, one of
We have a Flex app that is currently loading an XML file that contains
I have a flex app under construction that makes use of a lot of

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.