How to insert an external image in MovieClip Flash, replacing it with the current one. There is a Flash with several MovieClip, you need to upload various images from external files. I am loading in Flash like this - the download is successful. var imgLoader: Loader = new Loader (); imgLoader.load (new URLRequest ("im.png")); Question: how to upload a loaded image to a specific MovieClip, replacing it with the current MovieClip image?

    1 answer 1

    If everything is as you described, it is relatively easy:

    mc.removeChild(img); // удаляем старый имаж mc.addChild(imgLoader); // добавляем новый 

    where: mc is a link to a MovieClip instance

    img - old image

    imgLoader - already loaded image

    • Thanks for the answer! I imagined that something was being done this way, but various variants did not work. But then I have an additional question: How to turn to the old picture? I have it in the library called: im.png and on the basis of it was created MovieClip. - dmail1976
    • How to set the img variable - which is responsible for the old image? - dmail1976
    • Unfortunately, not very strong in Flash CS Pro, I will not guess. I can offer to add the "old" picture when you start the flash drive, and then delete it, access to it will be easier. Another option is to add all the pictures at once, and change the visible property, that is, set visible = true, the one you want to show, visible = false and the rest. But the best option is loading / unloading, memory is saved, plus imagery can be dynamically changed without rebooting the entire flash drive. - ShockWave
    • So I have a question about how to do all this from the program code, how to add a picture - how can I even turn to it? I do not know how to get to the MovieClip image from the program code you wrote: mc.removeChild (img); // delete the old image so I have a question, how to access it - by the file name, create some variable of a certain type? The meaning of the download - the unloading was initially clear to me, but how to register it in the program code? - dmail1976
    • I have another way how to do it: but for it I need to programmatically set the registration point MovieClip. If I were told how to do it, I would be able to use this option. - dmail1976