Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Movieclip Copy Vs Duplicating



I'm having a meltdown...
I have a great movieclip that is a button for a menu. On the clip is written a menu item. What I want to do is duplicate the movieclip so I can have more menu items but change the item name for each one. But every time I duplicate the clip and try to change the text the original one changes as well. How do I separate them?



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 06-13-2006, 04:13 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Array Copy Points To Original Array Instead Of Duplicating
Hey all.
Spent a long time trying to figure out what was wrong with my code. Then I remembered about arrays being objects instead of primitive variables. My question is, how can I make a duplicate copy of an Array?

Details:

So this code

PHP Code:




package{
    import flash.display.*
    public class tester extends MovieClip{
        var a:Array = [1,2]
        public function tester () {
            var b = a
            trace (a)
            b.splice(1,1)
            trace (a)
        }
    }
}







results in this output:

PHP Code:




1,2
1







How can i make b an actual duplicate of a, instead of a pointer?

PHP Code:




b = new Array
b = a






doesn't work either.
Thanks!
DHP

Copy Or Move Movieclip In Other Movieclip
I have to duplicate or move 1 Movieclip from _root inside another
Movieclip. How to?

Max

Copy MovieClip ?
Hi

I want to make 5 buttons with the same effect, just change the text on them. And on mouseOver I have a movieClip effect with the text on it... Can I copy the entire movieClip and being able just to change the text layer? (I have it divided by layers). I tried Duplicate but when I change one it changes all of them. I also tried to copy all of the frames but that never worked with me. I select all of the frames, Copy and then in the next movieclip select and paste, but never worked, is there a special trick for Paste?

Thanks.

Copy Movieclip
there's 2 movieclip named mc and mc2
i want to copy mc to mc2 as a child movieclip
how can i do this?
like mc will be copied within mc2
like mc2.mc or something named. can u help??

Copy Contents Of A Movieclip
Hi

Is it possible to Copy the contents of MovieClipA to MovieClipB?

eg.

I have a slideshow with external JPEGs which is loaded into MovieClipTop.

Foreach new image which is loaded I put the previous JPEG in a MovieClipBottom (beneath MovieClipTop)
Right now I do that with loadMovie,
But that is not desireable because it creates a blink (before the previous JPEG is loaded again)

Is it possible to take the contents(JPEG) of MovieClipTop and do direct copy to MovieClipBottom?

eg.
psudo code:
transfer the content of MovieClipTop to MovieClipBotom
Load new image ...

Hope anyone can help with this one.

Best regards
Thomas

Copy Object From One Movieclip Into Another?
Hello there.
i'm still new in flash and trying to figure this problem i have:
I cant find a way to copy/move an object from one movieClip into another while keeping all the changes I did to the object (size, color etc.. ).

thanks

How Do I Make A Copy Of A MovieClip
I have a MovieClip that has a png file loaded in it using MovieClipLoader. I need to duplicate this MovieClip, but it dosn't seem to be working. Is there a way to duplicate a MovieClip loaded with MovieClipLoader?

How To Copy A Movieclip To Another Parent
the MovieClip.duplicateMovieClip method can only duplicate a movieclip in the same parent, right?

now i want to copy a movieclip to anther parent. how i do it now is: copy the bitmap to anther movieclip using attachBitmap() method. but the problem is: hit Area changes, not like the original graphic Area, the second movieclip's hitArea is the rectangle of the bitmap, thoght the bitmap i created is transparent.

what should i do, if i want keep the same hit Area as original graphic Area?

How To Copy A Part Of A MovieClip
Hello everyone, i have a doubt ( that is also a question! ). Let's suppose that i have a MovieClip onto the stage. This MovieClip (called mc) is a simple BackGround ( with horizontal stripes with different colors ). This background is loaded with Loader Class, and then a bitmap image is created with Bitmap class.

I want to select a region of this mc, using AS3 (that is, i want to select a stripe of this mc), and create a new movieClip with the same region selected dimension. In other words : i want trim a photo. How can i do that ?

I hope this is understandable!!!

Paolo

Help How Do I Copy And Then Replace A Movieclip With A Other?
I need help to do this:

1. Copy a movieclip1 to movieclip2 in the scene. Movieclip2 already contains something so that have to be replaced by the content of Movieclip1. (through timeline)

2. Copy content from a other movieclip (Movieclip3) trough a button to Movieclip1 that also have to be replaced with the content of Movieclip3.

If some expert knows this please help me out on this one, thnx

Creating A Copy Of A MovieClip
I have a movieclip that I need to copy. The movieclip loads items and adds them to its stage, so I don't just want to make one like it and then have to reload the objects.

AS3 - Create A Copy From A Movieclip
Well, AS3 doesn't have any duplicate method on movieclips and has made me confused when I am trying to create different movieclips from a base movieclip which is also just being created through the class!

Here is the scenario:
in a class which has extended the MovieClip I have introduced a movieclip in the class variables like this:

protected var _box:MovieClip = new MovieClip();

and then in the class's constructor function, I added some other movieclips into it like this:

_box.addChild(_thumb_mc);
_box.addChild(_lable_mc);
_box.addChild(_detail_mc);

I still hadn't placed _box itself anywhere yet, so we can say that _box itself is still floating around, right?

Now, from outside of the class I am sending parameters like this:

myClass.add({lable:"Item 0", detail:"Some more information goes here", thumb:"01.jpg", data:"data0"});

which it calls a public function in our class... All fine up to here. now I am trying to keep that _box movieclip always floating around and instead of placing it directly somewhere, I wanna create a copy out of it and then using that copy to insert the appropriate information into its nested movieclips... and actually do the addChild on the copy version and always keep the original _box clean and floating so anytime later we will be able to call that "add" function again and create another copy... Am I making sense?!

Here is the function which tries to create a copy out of _box. but I see no success. Please HELP.


Code:
public function add(newBox:Object)
{

var tmpMc:MovieClip = new MovieClip;
tmpMc = _box;
tmpMc.name = "box" + _boxNum;
tmpMc.x = 0;
tmpMc.y = 50 * _boxNum;
_boxNum ++; // add one to the current number of boxes
addChild(tmpMc);

}

Duplicating An Attached Movieclip Into Another Movieclip?
Let's say I've attached a movieclip into one location in my file, and I want to move it to another location.

And by location, I don't mean x and y value, I mean the original is in _root.mc_clip1.here and I want to load it into _root.mc_clip2.there

What do I do? I've just tried this:


Code:
emptya.attachMovie("spot","spot",10);
button.onPress = function(){
rezzo=_root.emptyb.duplicateMovieClip(_root.emptya.spot,"spot",6);
trace(rezzo);
trace(_root.emptyb["spot"]);
}
My trace gives me the result:

_level0._level0.emptya.spot
undefined

What's the deal? What should I be doing instead?

Copy CHILD Movieclip To NEW Parent
Its really simple actually, and it seems like such a newbie question - which is also driving me a little crrrrrazy. Everytime I think I know what I am doing: *SMACK* Ah well. Thanks for any help in advance!

Here is the nut:
I have a CHILD movieclip attached to a PARENT MC, and I want to copy (or move - dont really care) the CHILD to a NEW PARENT. Everything is build in AS1.


Code:

//I make my first PARENT movie clip
_root.createEmptyMovieClip("OrgParent_mc", 1);

//I give it a CHILD
_root.OrgParent_mc.createEmptyMovieClip("ChildClip_mc", 1);

//I make a second PARENT movie clip
_root.createEmptyMovieClip("FosterParent_mc", 2);

//Now I want to make a copy. BTW This is so simple seeming its confounding!
// ?
//I tried:
_root.FosterParent_mc.attachMovie("_root.OrgParent_mc.ChildClip_mc", "BrotherClip_mc", 1);
//But of course its not a library clip, so no dice. bla.

//I tried:
_root.OrgParent_mc.ChildClip_mc.duplicateMovie("SisterClip_mc", 10);
//But that doesn't give the child a new home.

//And the Moock manual says using duplicateMovieClip() as a global function also sticks the copied MC in the same PARENT stack. SO Annoying! Why can't I choose a new stack?


So I really hope someone can help solve this little puzzle. I've tried searching through the threads, but the detail nuance seems to make searching very difficult.

P.S. the solution to this would be even more exciting when I can store the Child Clip target in a variable and pass it to the copying mechanism, rather than copying it directly. But this isn't really a problem if I can copy the MC.

There must be a way to do this, otherwise components wouldn't be possible.

Thanks Alot!
-AtomicBirdsong

[F8] Copy MovieClip Contents Using BitmapData
Hi,

I have a movie clip of which I want to copy the visual representation of its contents, using BitmapData. The problem is that the movie clip's registration point is in the center of the movieClip (and needs to be left that way for other reasons) and so when I go to create the BitmapData, I only get the bottom-right quarter of the movieClip.



Code:
myBD = new BitmapData(612, 373, true, 0x000000);

var myMatrix:Matrix = new Matrix();
var myColorTransform:ColorTransform = new ColorTransform();
var blendMode:String = "normal";
var smooth:Boolean = true;

myBD.draw(original_mc, myMatrix, myColorTransform, blendMode, new Rectangle(-306, -186.5, 612, 373), smooth);

my_mc.attachBitmap(myBD, 0, "auto", true);


I thought that if I used -306, -186.5 values in the Rectangle, it would compensate for the movieClip having a centered registration point...since 0 - (612/2) = -306... so that should be the top left corner of the mc...

However, even with those values I still only get the bottom-right 'quarter' of the mc.

Any ideas?

Thanks!
-b.

Copy Child MovieClip To NEW Parent
Here is the nut:

Its really simple actually. I have a CHILD movieclip attached to a PARENT MC, and I want to copy (or move - dont really care) the CHILD to a NEW PARENT. Everything is build in AS1.


Code:
//I make my first PARENT movie clip
_root.createEmptyMovieClip("OrgParent_mc", 1);

//I give it a CHILD
_root.OrgParent_mc.createEmptyMovieClip("ChildClip_mc", 1);

//I make a second PARENT movie clip
_root.createEmptyMovieClip("FosterParent_mc", 2);

//Now I want to make a copy. BTW This is so simple seeming its confounding!
// ?
//I tried:
_root.FosterParent_mc.attachMovie("_root.OrgParent_mc.ChildClip_mc", "BrotherClip_mc", 1);
//But of course its not a library clip, so no dice.

//I tried:
_root.OrgParent_mc.ChildClip_mc.duplicateMovie("SisterClip_mc", 10);
//But that doesn't give the child a new home.

//And the Moock manual says using duplicateMovieClip() as a global function also sticks the copied MC in the same PARENT stack. SO Annoying! Why can't I choose a new stack?
So I really hope someone can help solve this little puzzle. I've tried searching through the threads, but the detail nuance seems to make searching very difficult.

P.S. the solution to this would be even more exciting when I can store the Child Clip target in a variable and pass it to the copying mechanism, rather than copying it directly. But this isn't really a problem if I can copy the MC.

There must be a way to do this, otherwise components wouldn't be possible.

Thanks Alot!
-AtomicBirdsong

Copy + Paste Not Working For Movieclip
Hi im makin an arkanoid game where you have to destroy bricks with a ball. I tested the game with a single brick on the screen, and it works fine (the brick gets destroed when the ball hits and adds to the score as well).

But as soon as i try to multiply the movie clip to have lots of bricks on the screen, the ball does not recognize the movie clip and goes straight through it.

Further more, after hitting a particular brick, they all disappear at once!

PLz tell me the prob! this assignments due on friday !

Duplicating A MovieClip
I have a button in my flash animation and when you click it, it duplicates a MovieClip, I just want to know how to get the duplicated MovieClip to appear in a different position instead of right on top of the origenal. e.g. X position + 100, Y position + 100

is this possible?

Duplicating Movieclip
on press, i want to duplicate the movie clip into _level99.

duplicateMovieClip(this, "newName", depth);

there is no option for level, so how can i move this movieClip to _level99 ??

Duplicating A Movieclip
Hi all who read this, I'm working on my first attempt at a game. It's specifically an asteroids-type affair. I need to duplicate an object (the asteroid movieclip) which I can do by using duplicatemovieclip. This works fine, though I need the code from the first object (which makes it move forward, detects collisions etc) to work in the new movieclip also, though I haven't got this to work yet. I have made sure all the coding in the first clip refers to 'this' where relevant, rather than an absolute target, which I was hoping would make the same code work again in the new instance. Does the duplicate movie clip action also copy the code into the new instance? Can I use 'this' to refer to the new object within it's code of should I come up with a more specific path name?

Thanks in advance,

ADE

Duplicating MovieClip
hello people i have question about duplicating movieclip.
i want to create 2 copy of single movie clip. first i tried a code something below

logo = new mc_logo();// a clip in library. exporting for actionscript
logo.addChild(evnt.target.content); // add loader content in to movieClip
logoContainer.mc_logos1.addChild(logo); // add it in to another clip

logoCopy = new mc_logo(); // for copy of original movieclip
logoCopy.addChild(evnt.target.content); // same data for copy clip
logoContainer.mc_logos2.addChild(logoCopy); // add it to copy moveclip

but when i run this code in scene seems nothing ???
when i removed "logoCopy" section then upper block works, it' s same for reverse situtation.

so, how can i duplicate this movieClip 8)
(i know there is no method called duplicateMovieClip)

thank you.

Duplicating A Movieclip...
Folks,

i'm tryng to copy a mc into an already existing movieclip, the already existing mc = mc_ThumbNails.mc_ThPic01 [created on stage], the mc I want to copy into this is aP[0][6], tried the code below, and also a straight assignment [which is //comment// now below].
Who can help me?

Martin

//this.mc_ThumbNails.mc_ThPic01 = aP[0][6] ;
this.mc_ThumbNails.mc_ThPic01.clear () ;
this.mc_ThumbNails.mc_ThPic01 = aP[0][6].duplicateMovieClip ("mc_ThPic01", this.mc_ThumbNails.getNextHighestDepth() ) ;

Duplicating A Movieclip
Simple movie clip and I am trying to duplicate it a few hundreds times. So it appears on various parts of the stage.

Anyone know the code?

Cheers.

G27

Duplicating A Movieclip
I need to duplicate a movie clip that has about fifty movieclips inside of it which also need to be duplicated. Is there an easy was to do this?

For Experts: How To Copy An Entire MovieClip/Class ?
I need to copy an entire movieClip/Class and not just call the construtor. I create a little class to illustrate my problem (you can copy/paste in frame 1 and create a empty movie clip in your library with linkage for actionscript (called the link "mcPolygon")).


Code:
FPolygon = function ()
{
trace(this + " constructor called");

this.createEmptyMovieClip("square_mc", 1);
}

FPolygon.prototype = new MovieClip();

FPolygon.prototype.Square = function ()
{
trace(this + " square called")

this.square_mc.lineStyle(1, 0x000000, 100);
this.square_mc.beginFill(0x000000, 100);
this.square_mc.moveTo(100, 100);
this.square_mc.lineTo(200, 100);
this.square_mc.lineTo(200, 200);
this.square_mc.lineTo(100, 200);
this.square_mc.lineTo(100, 100);
this.square_mc.endFill();
}

Object.registerClass("mcPolygon", FPolygon);

_root.attachMovie("mcPolygon", "polygon_mc", 1);
_root.polygon_mc.Square();
trace(_root.polygon_mc + " width is : " + _root.polygon_mc._width);

_root.polygon_mc.duplicateMovieClip("polygon2_mc", 2);


trace(_root.polygon2_mc + " width is : " + _root.polygon2_mc._width);
then they output is:

Code:
_level0.polygon_mc constructor called
_level0.polygon_mc square called
_level0.polygon_mc width is : 102
_level0.polygon2_mc constructor called
_level0.polygon2_mc width is : 0
As you can see, the black square is not present in the duplicate movie clip. This is my problem.

I want the figure drawn in square_mc to be also copied when I duplicate polygon_mc without calling the Square method. Is this possible ?

Thanks in advance.
Martin

ps: I know I could just recall Square, but in my actual class I dynamically loaded an 100K image and I duplicate it 30 times. When I use duplicateMovieClip, the image get download 30 times. That why I need to duplicate the whole content of the movie, and I don't want just the constructor to be called.

Copy Pixels From A MovieClip Containing Other Dynamic MovieClips
Hi folks.

I'm trying to copy the pixels of a MovieClip that's created as an empty movie clip, and has other MovieClips added to it via ActionScript (little blocks which make up an alphabetic character. I know how to copy pixels from a MovieClip that's already got content when in the library (with the BitmapData.draw method), and I've tested this with my current code: instead of starting off with a blank movie clip, I drew a square at the top left of a MovieClip, and put it in the library. Then, I drew my character onto an instance of that MovieClip, and then copied the pixels from it. What I got was a white rectangle, as usual, but with the blue block at the correct place - the top left.

So, what I'm asking is, does anyone know how I can copy pixels from a MovieClip that doesn't just have Transform, but also has these child MovieClips, which also have transform and contain child MovieClips, which also have transform?

Copy Child MovieClip To NEW Parent (for Printing)
I reused this title from another post because I have the same question and it was not ever answered in a way that is useful for me.

The problem is I am printing something that contains a MC that is being displayed. However the print formatting is quite different even though it contains an Identical copy of the object. Please also consider that I can't take a bitmap version of the object as the resolutions are quite different.

Currently, the only way I can think of solving this problem is by having the code insert an exact copy of the object into the printpage MC. Additional problems are that this will be masked as it will not fit onto the printed page other wise. Most of the time this object won't be printed. I am already doing so much with the processor that I am not getting my desired frame rate. I do not want to have to repeat every command to this second, very complex object.

So, with all that, does any one have any magic solutions? I can't believe that this is a unique printing problem, but I have not found any other posts on it.

Copy/Move A Movieclip From _root To Inside An MC
Hi again,
If I have a movieclip on the main timeline, is there a way to put this movieclip inside another movieclip on stage (ofcourse during runtime) ?
I know that one of the methods of doing this is using bitmapdata class to capture an image of the movieclip (draw method), then attaching the object it to another movieclip that can be anywhere, but this will make the movieclip lose it's interactivity behaviour, and vector quality.

Any other ideas?

Thanks

Continuous Duplicating Movieclip
is there an actionscript to continuously duplicate one movieclip.
so that you have a constantly sliding movieclip?

thanx in advance

Duplicating In Nested Movieclip
Hi,

I have movieclip that is duplicating with variables from ASP Page.
Here is my code:

xstart = 300;
for (i=0; i<TotalRecords; i++) {
duplicateMovieClip("mc", "mc"+i, i);
telltarget ("mc"+i) {
caption = eval("/:caption" add ../:i);
header = eval("/:header" add ../:i);
body = eval("/:body" add ../:i);
}
setProperty("mc"+i, _y, xstart+i*200);
}

TotalRecords is how many records are coming from my ASP page.
mc is my movieclip instance
the rest are my variables in the movieclip

Now I can get this work when I place the movieclip on the main stage,
but I want to create a scroll from the duplicating movieclip, so I created a new movieclip and placed the mc movieclip inside of it. The new movieclip is now on the main stage. Nothing comes up now. The new movieclip is like a holder for all the duplicating mc's movieclips so I can scroll through it.

Do I place the above code on the main stage or the new movieclip or the mc movieclip and how do I target it so it will be shown on my main stage.

Please Help!
Thank you,
Adam

Why Is My Movieclip Duplicating? Is It SwapDepths?
Okay, this is one heck of a complicated problem, so I'm gonna try my best to explain.

Basically, I've got a movieclip on the root called mcClip, let's say. I'm using Flash's drawing functions to allow the user to colour in this clip with their mouse (like a paint program) which creates a series of movieclips inside mcClip with the user's scribbles and fills.

Now, when I duplicate this clip to provide a 'print preview' the dynamically created subclips don't show up. To get around this problem (which I've given up on) I have chosen to simply swapDepths and shift the _x of mcClip into my print preview box, and then move it back once the user closes the box. The problem is, once I close the box, there is suddenly a duplicate of mcClip on the root!!!

So, I've attached my .fla, which has about 460 lines of semi-commented code in, in the hopes that someone can tell me why this is happening. Note that I've removed lots of graphics and sounds from the file to keep the size down.

mcButtonPrint's onRelease function contains the code to print the clip, so perhaps this is where the problem lies. If not, I'm stuck!

Thanks,
Aragorn

Duplicating Movieclip And Putting It Into Another Mc
Is it possible to duplicate a mc and put it into another mc?

[MX] Duplicating A Movieclip More Than Once At The Same Time
Right now I can only make one duplicate at a time. I am making a mouse effect where each duplicate has a 1/8 chance of going in a different direction. Can I make 8 duplicates at once so they appear in a circle form every time they duplicate?

[CS3] SwapDepth Duplicating Movieclip
Hi
I've developed a resource with drag and drop movieclips within a presentation.

There are a huge number of drag and drop clips, so I've added a bit of swapDepth code so that the chosen movieclip is always in view. The problem now is that when I go to the next page (which contains a different drag and drop activity), a movieclip from the previous page is duplicated.

Is there any solution to this? I've tried an onenterframe unload for the next page, but obviously this deletes the MC permanently making it fairly useless.

I've attached an example to illustrate the problem.

Duplicating Nested Movieclip
Hi,
Can some one tell me how to duplicate a nested movieclip.

I have a main holder movieclip on the stage(rectangle in shape) in which i have another small moveclip nested.(ball shape)

I need to create duplicate of the nested movieclip (ball) so that it fills the main holder movieclip at runtime.

Can anyone tell how this can be done.


Thanks in advance.

Amit.R.Chinchane

Duplicating Movieclip Into A Certain Position
Hey folks

Am working on a little flash game and have got stuck with a piece of code. When "clix" is in collision with "bomb" I need an instance of "explosion" to be created where clix was when the collision took place. I'm currently attempting to just make it duplicate and move to a set position but I can't even grasp that...

n= random(10000)
if (_global.timemanzeelives == true) {
if ( this, hitTest(_root.bomb)) {
duplicateMovieClip(explosion, "explosion"+n, 0)
newmovieclip="explosion"+n
newmovieclip._x = 300;
newmovieclip._y = 300;
}
}

I know that the hit test is working as if I put it to delete the mc "this" it deletes it successfully.

If anyone could give me a hand it would be very much appriciated!

Note that there are a significant number of "clix" and there there needs to be more than one "explosion" on screen at a time
-Jordan

Duplicating MovieClip AND It's Contents..
Any of you guys know how to duplicate a movie and also retain all the other movieclips within it?

I've created an empty movieclip - then loaded a dozen or so images into empty movieclips within that so that they appear in a row.. then i wanted to just copy the original to create several rows.

does that make sense??

i guess i'm trying to avoid repeating code..

cheers


fil

How Do I Erase A Duplicating Movieclip?
Hi,

I've got the following actionscript to create a flame which works great. But i want to erase the flame at frame 90 and can't seem to get it to disappear. Putting a stop command just halts the rest of the animation. Can anyone offer some advice?


Frame 1:
i = 1;
max = 60;
x = getProperty("fire", _x);

Frame 2:
if (Number(i)<=Number(max)) {
duplicateMovieClip("fire", "fire" add i, i);
i = Number(i)+1;
}

Problem Duplicating MovieClip
Hi, Im hoping someone can help me, I want to duplicate a MC from within a MC. When I do it on my main timeline it works fine but when i place the code inside a MC it doesnt work. Im nearly sure that it's a path problem but I can't figure it out. I've attached the file.

This is the line that's causing me the problems:

Quote:




duplicateMovieClip(_root.B2, "boxes"+i, 0);




Any help or suggestions would be great, thanks.

Help With Removing And Duplicating Movieclip
i have this function that everytime i click the screen a box appears.


function box () {
_root.onMouseDown = function(){
movie = _root.attachMovie("mcBox", "mcBox", _root.getNextHighestDepth());
movie._x = _xmouse;
movie._y = _ymouse;
}
}



how can i make it so i only have one box on the screen at a time
like this


if (there is a box on the screen) {
function = false
} else { continue function; }


i cant figure out how to do that in actionscript.

Problem Duplicating MovieClip
Hi, Im hoping someone can help me, I want to duplicate a MC from within a MC. When I do it on my main timeline it works fine but when i place the code inside a MC it doesnt work. Im nearly sure that it's a path problem but I can't figure it out. I've attached the file.

This is the line that's causing me the problems:

Quote:




duplicateMovieClip(_root.B2, "boxes"+i, 0);




Any help or suggestions would be great, thanks.

Duplicating Movieclip With Loaded Jpg
what im trYing to do is duplicate a movieclip with loaded external jpg then position them horizontally ... the name of the movieclip that has to be duplicated is holder and the jpg is w1.jpg , w2.jpg and so on

im experimenting and dont seems to work can anyone help me please here is hte code i used and it doesnt work ..

ActionScript Code:
for (var i = 1; i<5; i++) {
    holder[i].duplicateMovieClip("holder"+'i', i);
    holder[i].loadMovie("thumbs/w"+i+".jpg");
}

Duplicating Movieclip After External .swf Is Loaded Into It?
I have a movieclip called "textcolor" that loads an external "movie1.swf" into itself when a button is pushed -- and it works.

But when I attempt to duplicate the "textcolor" movieclip after the "movie1.swf" has loaded into it, it doesn't work. Of course I can control all other attributes about "textcolor" such as alpha and size using other buttons, why can't I duplicate it?

Here's my simple code:

---------------------

on (release) {
_root.textcolor.duplicateMovieClip("textshadow", 1);
textshadow._x = 200;
textshadow._y = 200;
}

---------------------

Is there something I'm missing here?

Much thanks,
--Chuck
http://www.letterheadfonts.com

Duplicating MovieClip Inside Another? Thumbnail Help... Please
Hello all,

I know this is probably something totally obvious that I am missing but...

Here is the code that works, it basically duplicates an empty movieclip (ThumbMc) on the root timeline and fills it with thumbnail pictures & gives the invisible buttons a name to load to the big "Container" that holds the big picture.

This code works fine for a static page:

images = new Loadvars();
images.onLoad = function() {
x = 20;
container.loadMovie(images.starting);

for (i=0; i<Number(images.count); i++) {
duplicateMovieClip("thumbMC", "thumb"+i, i);
_root["thumb"+i].holder.loadMovie("icon_"+images['image'+i]);
_root["thumb"+i].bigPhoto = images['image'+i];
_root["thumb"+i]._x = x;
x += 40;
}
}

images.load("fashion.txt");


But when I go to create a movieclip on the root timeline called "scroller" to load the thumbnail movies into, so I can scroll the movie, it breaks down and does not load them anymore.

This code below doesn't work...

images = new Loadvars();
images.onLoad = function() {
x = 20;
container.loadMovie(images.starting);

for (i=0; i<Number(images.count); i++) {
_root.scroller.duplicateMovieClip("thumbMC", "thumb"+i, i);
_root.scroller["thumb"+i].holder.loadMovie("icon_"+images['image'+i]);
_root.scroller["thumb"+i].bigPhoto = images['image'+i];
_root.scroller["thumb"+i]._x = x;
x += 40;
}
}

images.load("fashion.txt");

Please take a look and advise what I am doing wrong. Thanks in advance for your help.

Thanks Musicman and Pellipiano for the help and inspiration!!

I have included the fla files, with the thumbnails and txt file. They should all go in the same directory after unzipping.

Thanks,

DjCheetah

Duplicating A Movieclip Does Not Duplicate It's Children
I'm trying to duplicate a dynamically created movieclip while retaining all it's properties (other movieclips too). When I duplicate the parent clip, the child clip (draw) is not duplicated. I've even tried it with the initObject parameter, but to no avail.
To my understanding, it should. Any soluytions on how to do this? Thanks.


Code:
Object.prototype.drawLines = function (lineThickness,col,w,h,fillCol,fillAlpha) {
this.clear();
this.lineStyle(lineThickness,col,100);
this.beginFill(fillCol,fillAlpha);
this.lineTo(w,0);
this.lineTo(w,h);
this.lineTo(0,h);
this.lineTo(0,0);
this.endFill();
}

_root.createEmptyMovieClip("c",0);
c.createEmptyMovieClip("draw",0);
c.draw.drawLines(1,0x000000,300,100,0xffff00,20);

_root.c.duplicateMovieClip("z",1);
z._y = 200;
trace(z.draw)

Duplicating A Movieclip Based On An Array
Hi guys, I am using mdm zinc to create an application that gets the folder and file names of a certain directory then duplicates a movie clip for each file. The problem does not seem to be from mdm, because I am able to trace out each of the file names in my loop, but when I go to duplicate the movieclip it seems to only do a a couple of each. Im sure my problem is something stupid and obvious, but I havent been able to find it. Here is my code, thanks guys.


Code:

var linksArray = new Array();
linksArray = mdm.FileSystem.getFolderList("files");
var numberOfLinks = linksArray.length;
var totalLinks = numberOfLinks - 1;
for (i = 0; i <= totalLinks; i++)
{
_root["listArray" + i] = mdm.FileSystem.getFileList("files/" + linksArray[i], "*.swf");
var numOfSubLinks = _root["listArray" + i].length;
var totalSubLinks = numOfSubLinks - 1;
currentArray = _root["listArray" + i];
for (j = 0; j <= totalSubLinks; j++)
{
duplicateMovieClip("checkbox_mc", "checkbox" + j, j);
_root["checkbox" + j]._x = 5;
_root["checkbox" + j]._y = 5 + j * _root["checkbox" + j]._height;
_root["checkbox" + j].thisLabel = currentArray[j];
_root["checkbox" + j].category = linksArray[i];
mdm.Dialogs.prompt(currentArray[j]);
}
}

Duplicating MovieClip On Stage From A Class
Hey All,

say I have a main MC (linked to a Main Class) on the stage and inside of that I have an MC sitting offstage (called shot...has a Class linked to it (called Laser) and Main does have a reference to that Class). Say in Main when the mouse is clicked I want it to duplicate that "shot" MC. How would I do that?

This is not working:

Main.as

mouseListener = new Object();

Code:
mouseListener.onMouseDown = function ()
{
this.duplicateMovieClip("laser_mc","shot",5000);
this.shot._x=111
this.shot._y=111
trace("MOUSE FIRE!");
}
the trace is working but it is not duplicating the clip.

Thanks, Dvl

Stop Duplicating Movieclip While Dragging
i trying to stop duplicating my movieclip after my dragging. How can i stop it?









Attach Code

on (press) {
//Duplicate Movieclip Behavior
//Requires Flash Player 7 or later
var newdepth = this._parent.getNextHighestDepth();

var newname = "copy" + newdepth;
var prevname = "copy" + (newdepth-1);
if (this._parent[prevname] == undefined) this._parent[prevname] = this;
this.duplicateMovieClip(newname,newdepth);
this._parent[newname]._x = this._parent[prevname]._x + 50;
this._parent[newname]._y = this._parent[prevname]._y + 10;
//End Behavior

//Start Dragging Movieclip Behavior
startDrag(this);
//End Behavior

}
on (release) {

//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior

}

Loading And Duplicating A MovieClip (using Senocular Tip Of The Day)
I am trying to load an external swf (AS3) in an AS3 application, using basically a duplicateMovieClip() function from the "Tip of The Day" (the loaded swf should appear in several places in the Container - each with its own timeline - that is, I want to be able to play() ant stop() them independently); ofcourse, I'm trying to avoid loading the same file multiple times.

The problem is that it doesn't work. This is the code, and I would appreciate any suggestions:


Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="main()" width="500" height="500">
<mx:UIComponent id="spriteHolder"/>
<mx:Script>
<![CDATA[
public var swfCovers:Array = new Array;

public function main():void{
var swfLoader:Loader = new Loader;
swfLoader.load(new URLRequest("assets/Slave.swf"));
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addSwf);

function addSwf():void{
var i:Number;

for(i=0; i<4; i++){
swfCovers[i] = MovieClip(duplicateDisplayObject(MovieClip(swfLoader.content)));
swfCovers[i].x = i * 100;
swfCovers[i].y = i * 100;
spriteHolder.addChild(swfCovers[i]);
}
}

function duplicateDisplayObject(target:DisplayObject):DisplayObject {
// create duplicate
var targetClass:Class = Object(target).constructor;
var duplicate:DisplayObject = new targetClass();

// duplicate properties
duplicate.transform = target.transform;
duplicate.filters = target.filters;
duplicate.cacheAsBitmap = target.cacheAsBitmap;
duplicate.opaqueBackground = target.opaqueBackground;
if (target.scale9Grid) {
var rect:Rectangle = target.scale9Grid;
// Flash 9 bug where returned scale9Grid is 20x larger than assigned
rect.x /= 20, rect.y /= 20, rect.width /= 20, rect.height /= 20;
duplicate.scale9Grid = rect;
}
return duplicate;
}// endfunc duplicateDisplayObject()

}

]]>
</mx:Script>

</mx:Application>
Behavior: with a swf created in Flash CS3, FlashPlayer simply crashes; with a swf created in Flex 2.0, nothing appears on screen, no error messages given.
This is a simple swf in Flex:

PHP Code:



<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"><mx:Panel title="My Application" width="186" height="300">    <mx:Label text="Welcome to Flex!" mouseDownEffect="WipeRight"/></mx:Panel>    </mx:Application>

Copyright © 2005-08 www.BigResource.com, All rights reserved