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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:58:01+00:00 2026-05-24T18:58:01+00:00

I have small problem. I’m dynamically loading JPG file using Loader class. Everything works

  • 0

I have small problem. I’m dynamically loading JPG file using Loader class. Everything works except if I want to tile the image few more times using addChild(loader.content) it just doesn’t work. It always removes previous instance and leaves only the last one. I’ve tried everything but with no luck. Here’s my code:

var loaderContext:LoaderContext = new LoaderContext(true);
var imageLoader:Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaderDone);
var fileRequest:URLRequest = new URLRequest('http://127.0.0.1/blah/blah.jpg');
imageLoader.load(fileRequest, loaderContext);

var imageLoaderDone:Function = function(e){
    var k:int = landHolder.numChildren;
    while(k--) {
        landHolder.removeChildAt(k);
    }
    var howManyTimes:int = Math.ceil(1000 / e.content.width);

    var i:int = 0;
    while(i < howManyTimes) {
        var zombie:Sprite = new Sprite();
        zombie.addChild(e.content);
        zombie.x = i*zombie.width;
        landHolder.addChild(zombie); //here's the problem, it does not duplicate
        //landHolder is empty MovieClip placed on the stage
        i++;
    }

    landHolder.alpha = 1

}

Thanks.

  • 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-24T18:58:03+00:00Added an answer on May 24, 2026 at 6:58 pm

    In case of a loaded image, you could simply clone its bitmap data.

    var loadedBitmap : Bitmap = e.content as Bitmap;
    var clonedBitmap : Bitmap;
    for(var i:Number = 0; i<100; i++) {
        clonedBitmap = new Bitmap(loadedBitmap.bitmapData.clone());
        clonedBitmap.x = i*clonedBitmap.width;
        landHolder.addChild(clonedBitmap);
    }
    

    The other suggested solutions are good alternatives when you need to clone more than a simple image.

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

Sidebar

Related Questions

I have a small problem, I want to load data from a PHP file
I have a small problem with rollover effects. First time after loading everything's fine.
I have small problem with my .net 2.0 winforms application. I want to embed
I have a small problem with a script. I want to have a default
I have a small problem with how should i think a... problem. I want
I have a small problem where I want to find the next active item
I have a small problem, but I'm a bit stumped. I am using the
I have a small problem in my code. I'm using fetch_assoc to get data
i have small problem understanding why my smart pointer class is leaking on self
I have small problem. What I want to achieve is adding sum of values

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.