Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : duplicateMovieClip problem


PierreAlain
3/2/2004 11:04:27 PM
- I have a clip collection somewhere in my movie, adress stired in
_global.Album
- I have a clip elsewhere in the same movie where I want a copy of a clip
inside the "collection" clip.

I put traces. As I can see, the adress of the origine clip is fine, but it
seems the new duplicated clip isn't instanced.

Any help ?

thanks

====== code ========
function affiche( N ){
removeMovieClip(1);
duplicateMovieClip( Album+".Contenu"+N, "Photo", 1 );
trace( N + " -> " + eval(Album+".Contenu"+N) );
trace( N + " -> " + eval( "Photo" ) );
}
==================

======output========
0 -> _level0.instance1.Collection.Contenu0
0 ->
==================

--

Pierre Alain

pie@lifnet.com


mandingo
3/2/2004 11:23:51 PM
Hi,

just a quick look at your code and one thing that is obviously missing is a
unique depth for each instance of the duplicated movieClip.

also your format is possibly incorrect... it should be target,newInstance,depth

try:

function affiche( N ){
uniqueDepth++; // or use N if that is a unique integer being passed to the
function
removeMovieClip(1);
duplicateMovieClip( "Photo", Album+".Contenu"+N, uniqueDepth); //or N
trace( N + " -> " + eval(Album+".Contenu"+N) );
trace( N + " -> " + eval( "Photo" ) );
}

where Photo is the instance you are duplicating

if this isn't what you want, let me know further... otherwise, you probably
aren't needing a duplicateMovieClip more an attachMovie

hope that helps,
PierreAlain
3/3/2004 1:45:07 AM
Thanks for the reply, but it's not that :-(

- I have a unique depth as this clip kind can only have one onject in it. I
tried changing that but as I guessed, no better result.

====== code ========
function affiche( N ){
removeMovieClip(1);
duplicateMovieClip( Album+".Contenu"+N, "Photo", 1 );
trace( N + " -> " + eval(Album+".Contenu"+N) );
trace( N + " -> " + eval( "Photo" ) );
}
==================

Album is a clip on another branch of the tree on level 1. It contains 10
clips witch contains photos loaded with loadMovie. Those clips are named
contenu0 up to Contenu9.

The clip where the function is has to show one of the photos, which index it
received as parameter.

I don't use attachMovie as I have several clips in the movie which may need
to show those pictures, and that those pictures may change. I have
Photo0.jpg up to Photo9.jpg in the same directory. The loadMovie let me also
have the first pictures loaded at the start of the movie, other ones (wich
could then be numerous) have time to be loaded during the time the user look
at the first ones.

Anyway I don't understand why the object "Photo" isn't created as the trace
shows as I even tried creating a clip "test" on _root, and tried

duplicateMovieClip( _root.test, "photo", 1 );

without success.

--

Pierre Alain

pie@lifnet.com


"mandingo" <webforumsuser@macromedia.com> a écrit dans le message de
news:c23527$16l$1@forums.macromedia.com...
[quoted text, click to view]

mandingo
3/3/2004 2:20:02 AM
okay,

the duplicateMovieClip action is placing your instance of "Photo" on your
timeline (hopefully) but you need to reference the location of this instance...
try :

trace(this);
trace( N + " -> " + eval(this["Photo"]));

see what you get...


PierreAlain
3/3/2004 10:28:49 AM
I turn mad with that, and I bet it's just some stupid stuff.

ok.
- I set many traces
- I display on screen the original clips, they are there
- and it still doesn't work

=3D=3D=3D=3D=3D code =3D=3D=3D=3D
function affiche( N ){
removeMovieClip(1);
duplicateMovieClip( Album+".Contenu"+N, "Photo", 1 );

trace( N + " orig -> " + eval(Album+".Contenu"+N) ); //#### =20
trace ( "this =3D> " + this ); // ####
trace( N + " dest -> " + eval( this[Photo] ) ); // #### =20
trace( N + " existing -> " + eval( LaPhoto ) ); // #### =20
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D trace =3D=3D=3D=3D=3D
3 orig -> _level0.instance1.Collection.Contenu3
this =3D> _level0.instance1.pages.p4.SupportPage.PagePhoto
3 dest ->=20
3 existing -> _level0.instance1.pages.p4.SupportPage.PagePhoto.LaPhoto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20

note: "LaPhoto" is a "normal" clip , not an actionScript one. It is used =
to get _x and _y for created ones.

so "photo" isn't instanced :-(

Thanks for your help !
--=20

Pierre Alain

pie@lifnet.com


"mandingo" <webforumsuser@macromedia.com> a =E9crit dans le message de =
news:c23fci$det$1@forums.macromedia.com...
[quoted text, click to view]
AddThis Social Bookmark Button