This content has been marked as final. Show 8 replies
EDIT: changed fotos to "fotos" (I had thought it was a variable, but I presume now its supposed to be a property name for the array inside the attached movie)
How is the array being created. I can see you pushing in destino[fotos] but I don't see it being created.
If its being created in code in the movie being attached, perhaps it hasn't run yet by the time you're trying to push a new element onto the array.
If not then you might need to do it this way:
actually that should probably be
destino.fotos = new Array();
destino.fotos.push(proyecto[ i ].childNodes.childNodes[ j ].attributes.cargar);
thnks a lot!
It was a thing on the time creation of the items...
no problem - you're welcome
Oh, man I´m having another problem. I´m using a movieclipLoader function to load the images.
i´ll post the new code here:
Its a little hard to advise you because I don't know what code you have in the proyecto movieclips that you're attaching. I'll assume that cargadorFoto is a MovieClipLoader that you also create in the attached clip. It's probably the same problem as before..
Why don't you have the MovieClipLoader loadClip issued inside your proyecto clips and you can make sure that the fotos array is pre-populated by doing it this way (I just typed this quickly so didn't check for errors):
I made it work just after posting the message...
I included the load action into the loaded MC.
What i´ve seen is that the functions in the MC begin to work when the "building" actions finish... I thought that when I attach a movie, it starts to work just in that moment. But it seems not.
Thaks a lot!
Yes that's what happens with code in attached library symbols. I'm not sure when exactly it runs although I'm guessing probably at the next frame.
I don't know exactly what best practice is here. Probably it makes sense to make a class that extends MovieClip so the constructor function runs. I think that when a class is associated with a library symbol that its constructor runs at the time of the attachMovie (immediately following). I know that the initObject argument in the attachMovie is still processed as well... I assume that comes first. (Others feel free to jump in and correct this if I'm not correct)
Anyhow if you don't do that and just use the symbol, the way I would tend to approach it is either:
a)make sure its got everything it needs to 'know' before its code runs - the best way to do this is probably in the last optional argument in the attachMovie method - the initObject or
b) have something early in the attached clip's code call a function on its parent to request whatever customisation data it needs in a return value.