I try and try but could not do it:
I`m trying to attach a mc into position x=0, y=0 and load an image into it.
Until here the code works! But I cant make it duplicate 3 times. What I really need is to duplicate it in 3 different places.
First duplication place: x=310; y=0;
Second duplication place: x=0; y=310;
third duplication place: x=310; y=310;
Here is the code:
// comando para fullscreen
fscommand("fullscreen", "true");
fscommand("allowscale", "false");
stop();
// funcao que atacha mc_loadimg e carrega img
function attachmc () {
loadhere.attachMovie("loadimg", "mc_loadimg", 1);
// load img into attached mc_loading
loadMovie("001.jpg", _root.mc_loading);
// trace
trace("img loaded");
trace("posX =" + _root.loadhere._x);
trace("posY =" + _root.loadhere._y);
}
// funcao que duplica mc_loading
function duplicaMovie () {
for (var i=0;i<4;i++) {
_root.mc_loading.duplicateMovieClip("newmc"+i, i);
// trace
trace("funcao duplicaMovie OK")
}
}
from the looks of it, your attachmc function seems to be adding the movie in the same layer, 1, which shouldn’t work if you want to load multiple things in the same layer. loadMovie works just like duplicateMovieClip: it has a parameter for the layer in which to load the movie and put the duplicate, respectively. perhaps you should add a parameter to the attachmc function which tells what layer to put the movie in:
…and if you don’t think that’s the problem, it might be because you’re naming it the same thing everytime you call the function and flash (or any other programming language) can’t handle instances (variables) with the same name and different content.
As Thor said, you’re going to have a problem with your depths. You attach a clip at depth 1, and then you duplicate it at depth 0, 1, 2, 3, so basically you erase that clip.
Moreover, duplicating a clip in which you’ve loaded something won’t duplicate the loaded item. So there’s not point trying to do it that way. And even if it did work, the jpg won’t be loaded when you try to duplicate it.