-
jpeg loading question
Hey gurus, just a quick question about loading a jpeg into a movieclip.
I want to load a jpeg into my swf and create 5 instances of it in 5 different movieclips.
the only way I can see this working, is to load the jpeg 5 times.
I can't seem to find a way to load a jpeg into a "container" movieclip and create multiple instances of that clip either.
Am I missing something really basic here??
-
or if that can't be done, can I attach movieclip "bar" to another clip "foo" that has been "exported for actionscript". So every time "foo" is attached to a "holder" I can see "bar" (_root.holder.foo.bar) then change "bar" later to "disco" so when "foo" is re-attached I see "disco" (_root.holder.foo.disco)?
Can I access "foo" to attach a movieclip to it if it isn't instantiated, but is available to actionscript to be called??
-
just load the picture into a clip and then duplicate the clip as many times as you want
_root.container.loadMovie("pie.jpg")
for(i = 0; i < 5; i++){
_root.container.duplicateMovieClip("container" + i, i + 1)
}
-
Yeah that doesnt quite work for me... I think there is a way to duplicate a clip that has content loaded into it from the outside but .... ok i havnt been able to do it so maybe im stupid but you can accoplish what you want another way and it is loading in more movies but you can automate it in the same way with the for loop
Code:
for (i=0; i<5; i++) {
_root.container.duplicateMovieClip("container"+i, i);
myContainer = _root["container"+i];
myContainer.loadMovie("02.jpg");
myContainer._x = i*50;
}
But Ogre if you do find that your example really works and I am wrong or it just needs a small tweak I would personally love to be able to do it. It was one of the issues I was having when working my my photo-viewer.
Charlie
-
I ended up doing it a bit differently, but I'm not sure how it will work in practice.
what I did was 5 loadclip() calls.
Code:
_root.$jpeg0 = "image1.jpg";
for (i=1; i<=5; i++){
_root.loader.loadClip(_root.$jpeg0,"slice_"+i+".pi1");
}
this accoplishes what I need done, but I'm afraid my loader function will look for 100K worth of files instead of 20k. does flash recognize that the file being loaded is the same as the others it has opened a stream for?