problem getting .load() to work in a dynamically attatched movie clip

Posted on 2007-09-28
Last Modified: 2010-04-06
I am trying to figure out why I am not able to get a .jpg to load into a loader within a movie clip when I dynamically attatch the movie clip with the loader in it.
I have a movie clip called "thumbnail_mc" with a loader component inside of it called "testload"

If I manually put the movie clip on the stage (with the intance name"thumbnail") and run this code, the image loads fine:

however, I need to add the movie clip to the stage dynamically.  When I use the following code, the movie clip is added, but I cannot get the image to load:
_root.attachMovie("thumbnail_mc", "thumbnail", this.getNextHighestDepth());

any idea why the image will not load?

thanks for your help
Question by:paries
    LVL 18

    Accepted Solution

    It's kinda weird but you're right, it won't load normally... playing around with it I came to the conclusion that it may try to load the data before the MovieClip exists, so with this it got settled out:

    Timer = setInterval(setImage,2000);

    function setImage() {
          Temp.onLoad=function(success) {
                if(success) {
                      trace("loaded ok");

    Good Luck.


    Author Comment

    It works great.  I'm pretty sure that I would have never thought of that.

    LVL 18

    Expert Comment

    by:Antonio Estrada
    Glad to help! :)


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
    In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now