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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:55:03+00:00 2026-05-25T17:55:03+00:00

I’m trying to load PNG images with ActionScript with a Loader object. This works

  • 0

I’m trying to load PNG images with ActionScript with a Loader object. This works fine for some of the images (the INIT and COMPLETE events are fired as expected), for some other it doesn’t. I’ve read in this thread that a URLLoader might help, so I tried that, using the loadBytes() function afterwards. Still doesn’t work: the URLLoader fires the COMPLETE event, but the LoaderInfo object does not.

I’ve written a sample class that demonstrates the problem with two files (one working, the other one not).

public class LoaderTest extends MovieClip {
    var output:TextField;
    var loader:Loader;
    var urlLoader:URLLoader;

    function LoaderTest() {
        output = new TextField();
        output.width = 1000;
        output.height = 1000;
        output.multiline = true;
        addChild(output);

        var t1:Timer = new Timer(0, 0);
        t1.addEventListener(TimerEvent.TIMER, function() {
            t1.stop(); loadMapDirect("map_in_big.png");
        });

        var t2:Timer = new Timer(1000, 0);
        t2.addEventListener(TimerEvent.TIMER, function() {
            t2.stop(); loadMapDirect("map_us_big.png");
        });

        var t3:Timer = new Timer(2000, 0);
        t3.addEventListener(TimerEvent.TIMER, function() {
            t3.stop(); loadMapBytes("map_in_big.png");
        });

        var t4:Timer = new Timer(3000, 0);
        t4.addEventListener(TimerEvent.TIMER, function() {
            t4.stop(); loadMapBytes("map_us_big.png");
        });

        t1.start();
        t2.start();
        t3.start();
        t4.start();

    }

    function loadMapBytes(url:String):void {
        try {
            urlLoader = new URLLoader();
            urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
            urlLoader.addEventListener(ProgressEvent.PROGRESS, progressListener);
            urlLoader.addEventListener(Event.COMPLETE, completeListenerBytes);

            output.appendText("\nLoading '"+url+"' with URLLoader ");
            urlLoader.load(new URLRequest(url));
        } catch (error:Error) {
            output.appendText("Err: " + error.message + "\n");
        }

    }

    function completeListenerBytes(e:Event):void {
        output.appendText("COMPLETE Event fired for URLLoader!\n");

        try {
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListenerDirect);
            output.appendText("Loading bytes with Loader ");
            loader.loadBytes(e.target.data as ByteArray);
        } catch (error:Error) {
            output.appendText("Err: " + error.message + "\n");
        }
    }

    function loadMapDirect(url:String):void {
        try {
            loader = new Loader();
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListenerDirect);

            output.appendText("\nLoading '"+url+"' with Loader ");
            loader.load(new URLRequest(url));
        } catch (error:Error) {
            output.appendText("Err: " + error.message + "\n");
        }
    }

    function completeListenerDirect(e:Event):void {
        var bmd:BitmapData = Bitmap(e.target.loader.content).bitmapData;
        output.appendText("COMPLETE Event fired for Loader! => h: " +  bmd.height + ", w: " + bmd.width + "\n");
    }

    function progressListener (e:ProgressEvent):void{
        output.appendText(".");
        if (e.bytesLoaded == e.bytesTotal) {
            output.appendText(" progress complete, " + e.bytesTotal + " bytes loaded!\n");
        }
    }
}

All images were generated with the PHP GD library and I’m compiling with SWFTools’s as3compile.

You can see the script it in action on http://www.wichte-sind-wichtig.de/as3loader/loaderTest.swf

The two images map_in_big.png and map_us_big.png are in the same folder (not allowed to post more hyperlinks).

Any ideas?

  • 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-25T17:55:04+00:00Added an answer on May 25, 2026 at 5:55 pm

    The problem is that your application is probably compiled for Flash Player 9. In version 9 the maximum allowed image dimensions are 2880 x 2800 and map_us_big.png is 3150 x 1570. I ran the application successfully when I compiled it for Flash Player 10.

    Here’s a reference http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#BitmapData%28%29

    In AIR 1.5 and Flash Player 10, the maximum size for a BitmapData
    object is 8,191 pixels in width or height, and the total number of
    pixels cannot exceed 16,777,215 pixels. (So, if a BitmapData object is
    8,191 pixels wide, it can only be 2,048 pixels high.) In Flash Player
    9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels
    in height and 2,880 pixels in width. If you specify a width or height
    value that is greater than 2880, a new instance is not created.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.