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

  • Home
  • SEARCH
  • 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 6383493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:39:22+00:00 2026-05-25T02:39:22+00:00

My problem occurs when I try to load multiple images in one class in

  • 0

My problem occurs when I try to load multiple images in one class in AS3.

My code looks something like this:

// Load image 1
var ldr1:Loader = new Loader();
ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE, complete1);
ldr1.load(new URLRequest("img1.jpg"));

// Load image 2
var ldr2:Loader = new Loader();
ldr2.contentLoaderInfo.addEventListener(Event.COMPLETE, complete2);
ldr2.load(new URLRequest("img2.jpg"));

// Load image 3
var ldr3:Loader = new Loader();
ldr3.contentLoaderInfo.addEventListener(Event.COMPLETE, complete3);
ldr3.load(new URLRequest("img3.jpg"))

My problem with this is, that every complete-method receives the same image. Sometimes they all get img1.jpg, sometimes they all get img3.jpg….

I don’t have any clue why this is happening.

I’m thankful for any help you can give me.

This is the exact code that I used:

Class CuboidBookView

public function addBackMaterial(url:String):void {
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBMComplete);
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {});

    loader.load(new URLRequest(url));
}
private function onBMComplete(e:Event):void {
    var bmp:Bitmap = Bitmap(LoaderInfo(e.target).content);
    backMaterial = new BitmapMaterial(bmp.bitmapData);
    hidden = false;
}

public function addFrontCoverMaterial(url:String):void {
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFCMComplete);
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {});

    loader.load(new URLRequest(url));
}
private function onFCMComplete(e:Event):void {
    var bmp:Bitmap = Bitmap(LoaderInfo(e.target).content);
    frontCoverMaterial = new BitmapMaterial(bmp.bitmapData);
}

public function addRearCoverMaterial(url:String):void {
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onRCMComplete);
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {});

    loader.load(new URLRequest(url));
}
private function onRCMComplete(e:Event):void {
    var bmp:Bitmap = Bitmap(LoaderInfo(e.target).content);
    rearCoverMaterial = new BitmapMaterial(bmp.bitmapData);
}

These methods are called in another class:

CuboidBookView(book.view).addBackMaterial("../res/books/" + b.file + "_back.jpg");
CuboidBookView(book.view).addFrontCoverMaterial("../res/books/" + b.file + "_front.jpg");
CuboidBookView(book.view).addRearCoverMaterial("../res/books/" + b.file + "_rear.jpg");

Edit: I thought, this would help, but it had the same result:

public function addMaterials(name:String):void {
    // Load background image
    var ldr1:Loader = new Loader();
    ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event):void {               
        var bm:Bitmap = e.currentTarget.content as Bitmap;
        backMaterial = new BitmapMaterial(bm.bitmapData);
        hidden = false;
    });
    ldr1.load(new URLRequest("../res/books/" + name + "_back.jpg"));

    // Load front cover
    var ldr2:Loader = new Loader();
    ldr2.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event):void {
        var fcm:Bitmap = e.currentTarget.content as Bitmap;
        frontCoverMaterial = new BitmapMaterial(fcm.bitmapData);
    });
    ldr2.load(new URLRequest("../res/books/" + name + "_front.jpg"));

    // Load rear cover
    var ldr3:Loader = new Loader();
    ldr3.contentLoaderInfo.addEventListener(Event.COMPLETE, function (e:Event):void {
        var rcm:Bitmap = e.currentTarget.content as Bitmap;
        rearCoverMaterial = new BitmapMaterial(rcm.bitmapData);
    });
    ldr3.load(new URLRequest("../res/books/" + name + "_rear.jpg"))
}

Now the different Bitmaps and Loaders have distinct names and are called within the same method call. The event handlers now are inline.

I cannot figure out where the mistake is.

  • 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-25T02:39:23+00:00Added an answer on May 25, 2026 at 2:39 am

    There really was a problem with the implementation of the Cube in Away3d. Some callbacks were not save.

    I found a solution in reimplementing the whole class.

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

Sidebar

Related Questions

This problem occurs when I try to hide a file in my directory with
Seems like cuke doesn't show the full error message (at least when problem occurs
This one may seem like a simple question, but it's really got me scratching
Why I try to load a fancybox, the content isn't loaded. The problem only
When i put an NSOpenglView in NSSplitView, a problem occurs while dragging splitter. The
We are using Hibernate 3.1 with Spring MVC 2.0. Our problem occurs when data
I have encountered a most annoying problem that occurs on the PWD variable when
Problem: I have two spreadsheets that each serve different purposes but contain one particular
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
This is a AS3 project created in FlashDevelop. It targets flash player 10. I

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.