Skip to main content
December 12, 2006
Question

[Q] duplicating movieclip with loaded external jpg file

  • December 12, 2006
  • 2 replies
  • 447 views
Hi, Im trying to make thumbnail and enlarged picture by duplication.
What i tried was using duplication of thumbnail movieclip which jpg image is loaded
However it seems not working as i intended,so I had to make empty movieclip and loaded image again!!!


I am concerning that if I use new movieclip and loading the image again..it means users have to download the same image twice.

Basically, I am trying to make a list of thumbnailed images with enlarged picture popes up when mouse rolls over them

Is there any proper way to make it happen?
or duplication just doesnt work even thou movieclip is already loaded with image?

Thank you for your time~
This topic has been closed for replies.

2 replies

Inspiring
December 13, 2006
> simple create your movieclip. Now create an empty clip inside. You will
load
> your JPG in the empty clip. This one can't be duplicated, but you will be
able
> to duplicate its parent. Like that:
> myMc.anEmptyClip.loadMovie("blabla.jpg");
> myMc.duplicateMovieClip("theNameYouWant", levelNumYouWant);
>
> That will works.

No, that will not work

You are partly right - if you create a nested clip and assign properties
(such as an onPress handler) to the parent clip, you can then load content
into the child without overwriting the parent's properties. If you load an
image into the child and then duplicate the parent however, the image in the
child clip *will not be duplicated*. Try it.

> 2- Also, the way you where going to do, works too. yes the user will have
to
> load it again, but it is already in the Browser Cache. It means that will
load
> quickly the second time and after that. Bad side is more that you will
doble
> the bandwidth of the images loading on your site.

Again, partly right. Lets take it bit by bit:

> yes the user will have to
> load it again, but it is already in the Browser Cache

The movie will have to load it again, but will probably load it from cache.

> Bad side is more that you will doble
> the bandwidth of the images loading on your site.

Not so. If it's in the cache, it doesn't use any bandwidth at all - that's
what caching means! A copy of the image is saved on the user's local hard
drive, so no bandwidth needs to be used when loading from cache.

Basically, for the *majority* of users, loaded images will be cached (this
is dependent on browser settings, but most users will have their browsers
set to cache). This means that after the first load, subsequent loads of the
same image will be quick and carry no bandwidth overheads.

The real issue here is that dynamic content in movieClips, such as loaded
images, swfs, or graphics created with the drawing API will not duplicate
when the clip is duplicated/ The accepted work around used to be simply to
reload the aimge. Now with Flash 8 though you can use the BitmapData class
to grab a copy of the image and redraw it to the newly created clip if you
so wish.

Pete
--
-------------------------------
Remove '_spamkiller_' to mail
-------------------------------


Inspiring
December 14, 2006
Ok, here it is.
Before I've post a reply, I've test it and my first solution works great!

This part works:
------------------------------------------
simple create your movieclip. Now create an empty clip inside. You will load your JPG in the empty clip. This one can't be duplicated, but you will be able to duplicate its parent. Like that:
myMc.anEmptyClip.loadMovie("blabla.jpg");
myMc.duplicateMovieClip("theNameYouWant", levelNumYouWant);
------------------------------------------

Test it before telling me that does not works please!

About the second way and the bandwidth, It will works too, but I beleave when you tell that takes the images in the cache, and does not take more bandwidth.
Inspiring
December 13, 2006
1- MovieClip have some properties like duplicateMovieClip that disapear when you load something into them. Basicly I can't explain the real reason or all function or properties that does not work after a load, but you found one of them. Here is how you can fix that:

simple create your movieclip. Now create an empty clip inside. You will load your JPG in the empty clip. This one can't be duplicated, but you will be able to duplicate its parent. Like that:
myMc.anEmptyClip.loadMovie("blabla.jpg");
myMc.duplicateMovieClip("theNameYouWant", levelNumYouWant);

That will works.

2- Also, the way you where going to do, works too. yes the user will have to load it again, but it is already in the Browser Cache. It means that will load quickly the second time and after that. Bad side is more that you will doble the bandwidth of the images loading on your site.

3- You ask if there is a proper way to do that, it depends on how you build you application. A simple way sould be to enlarge the movieClip itself when the mouse goes over and reset it to the original size when the mouse out.

Hope that can help