ActionScript 2.0 :: How To Duplicate MovieClips Using Function

Jul 3, 2006

I have yet another "I die-problem", not so drastic this time, though. I've only tried to solve it for two hours or so,it's killing me Well, as usual, I end up here, at the Kirupa forums.. and of course, l end up emptying the coffe-machine at work.. *runs for more espresso* It's an issue regarding the duplicateMovieClip function. I know how it works, and I know how to duplicate MovieClips using the function, however, I do have an issue figuring this out: Now, explained roughly:I have a MovieClip which contains yet another MovieClip. I want to duplicate both the MovieClip and it's child, but I want it to stay inside the parent MovieClip, just as the original MovieClip contained the original child.

View 13 Replies


Similar Posts:


IDE :: Duplicate Movieclips Hittest?

Jan 15, 2009

I am designing a flash game and I am having a bit of trouble with the Actionscripting, I wondered if you might be able to help me? I will try and explain how the game should function and I attach a JPG that shows the rough layout as well, hopefully from that you may be kind enough to point me in the right direction.

How it should function The idea is you have a glass that you control, left and right keyboard arrows control left and right movements and it only moves on the _x axis and the _y axis always stays at it's current value, this works fine and I have managed to add actionscript to the glass movieclip to do this, the movement also has gravity and friction which means the glass slides on a little even when you move to go the other way.

Using the Glass you need to collect falling object movieclips, there are two types, good and bad. When you catch the good it adds to your score and when you catch the bad it deducts from your score.

The falling objects need to be random and I have successfully managed to get 1 movieclip to fall by using actionscript code and also I have managed to set the _x position as random each time , the actionscript to do this has been applied to the falling object.

[Code]...

View 3 Replies

ActionScript 2.0 :: HitTest Two Duplicate MovieClips?

Mar 15, 2009

I'm trying to hitTest two duplicate movies clips. One is a bullet and the other is an enemy. I have them properly duplicating, but I cannot figure out how to detect a collision between the two. I've trying everything I can think of, and so far I've only been able to get the hitTest working between the original enemy and the bullet duplicates.Here is the code for duplicating the enemy:

Code:
bb++;
duplicateMovieClip(_root.target, "t"+bb, bb);

[code].....

View 2 Replies

ActionScript 3.0 :: Using Same Class For Duplicate Movieclips

Mar 24, 2011

I have created an external class for a particular movieclip and I would like to link a duplicated version of this movieclip to the same class file.
 
Problem is I can't seem to do it. Even if I state the class as the BASE class of the new movieclip and create another random class name for it.

Is there a way I can get around this so I can assign my duplicated clip the same class name ??

View 9 Replies

ActionScript 2.0 :: Can't Rotate Duplicate Movieclips

Jul 23, 2006

I've created movieclips that duplicate and swap depths but I can't seem to get them to rotate. I want the mc to rotate when the rotate button is clicked. I have created a button file that executes the rotate function properly but I can't make it swap depths like the others. How can I get all of the functions into each object?

View 2 Replies

ActionScript 2.0 :: Removing Duplicate Movieclips?

Feb 29, 2012

I'm currently trying to make a cross-hair shooter game with an additional onstage character so that you not only shoot the AI, but also dodge using the arrow keys. The problem is, I have a code saying that if the AI hits the player unload the player, the AI, and the AI duplicates. The player and the AI are unloaded, but the AI duplicates are not! I tried fiddling with the code but just can't get it to work.

[Code]...

View 3 Replies

ActionScript 2.0 :: Rotation With Duplicate Movieclips?

Aug 4, 2007

i found this file a while back ("dynamic_rotation") and i would like to rewrite it to place all the code in the _root on it's own layer.the duplicated squares don't move.here is the original code on the mc:

onClipEvent (load) {
y=100;
Angle_Inc=12;

[code].....

View 11 Replies

ActionScript 2.0 :: Duplicate MovieClips Into A Multiple Numbers?

Apr 11, 2011

that how can i duplicate a movieclip to as much numbers i want through out the stage using actionscript2. i have searched lots of posts in sites but i can't get it

View 6 Replies

ActionScript 2.0 :: MX: Dynamic Duplicate & Remove Of MovieClips

Aug 9, 2005

I have a for-loop that creates instances / duplicates of a movie clip that works like a charm:

[Code]...

Then I position each instance- and I fill an array with the number ("pg"), because: I also have the option to switch to a different view and at that point I want / need the MoveClips to disappear. So I have a function tied to the switching that goes through a loop for all instances of the movieclip copies (using the array with the IDs from the example above) and remove them.

[Code]...

View 1 Replies

ActionScript 2.0 :: Collision Detection Between Two Different Duplicate MovieClips

Apr 8, 2007

I was wondering how to have collision detection between two differente duplicated movie clips. For example, a duplicated bullet hits a duplicated bird, how do I make it so that it detects collision when the duplicated bullet(bullet+x) hits the duplicated bird(bird+x)?

View 3 Replies

ActionScript 2.0 :: Functions In Duplicate Movieclips - Position Is Not Right

Apr 9, 2008

I will have 5 type of buttons. Each type I will duplicate (+1) at some condition. Each button is sharing a same functions, just some difference in value and positions. Button type's name:bug1, bug5, bug10, bug20, bug50

[Code]...

View 4 Replies

ActionScript 3.0 :: Duplicate MovieClips Made By Flash Drawing API

Jan 12, 2012

I have this current simple setup:

- MOVIECLIP1, with more than 30 run-time drawing shapes that modify on enterframe.
- and MOVIECLIP2, wich should contain an exact copy of MOVIECLIP1 drawed data.

The point is that MOVIECLIP2 will be as a "reflection" or "shadow" of movieclip1. I won't need to do any interaction with it, only apply filters. Is there anyway that this can be possible - rather than having to draw the same shapes twice on both movieclips?

View 4 Replies

ActionScript 2.0 :: Adjust The _x And _y Area Positioning Of This Set Of Duplicate Movieclips?

Jun 25, 2003

how can I adjust the _x and _y area positioning of this set of duplicate movieclips? 710 x 143 are the dimensions I would like the duplicateMovieClip to take place, but it is not the positioning. How can I fix this?

[AS]
duplicateMovieClip (flower, "mc"+i, i);
setProperty ("mc"+i, _x, random(710));

[code].....

View 11 Replies

ActionScript 3.0 :: Duplicate MovieClips Stop All On Start And Play Only One On MouseEvent

Sep 2, 2009

I have a bunch of copies of the same MovieClip that are dynamically created I want them to be stopped when the swf first starts.When I click on one of them I want that particular one to play.I think that I've figured out how to play a single MovieClip with event.currentTarget.play(); but I am stuck on how to stop all the clips from the start.I thought I could just use a instanceName.stop(); in my for loop, but no go.[code]I'm an artist working on a piece where I am cataloging sound recordings from people (eventually recorded live from the site... but that's a battle that I'll deal with in phase 2 and after I have a bit more actionScripting under my belt).I just wanted to explain myself a bit since Kglad, Ned, and dmennenoh have helped me a bunch through the development of the project.If your interested you can check out some of my works on my website.I know,I need to update the site, but its more fun to work on new projects.

View 5 Replies

ActionScript 2.0 :: Loop With XML - Duplicate Some Main Button MovieClips For Each <dept> Node

Aug 25, 2004

What Im trying to do is duplicate some main button movieClips for each <dept> node. When pressed these main buttons then show a second set of buttons for as many <menu> nodes there are. In the actionScript the displayMainButtons function is used to loop through the XML and display the Main buttons. With the other 2 display functions (displayFirstButton and displaySecondButton) Im displaying another button for each <menu> node. These too works just fine, but the problem with writing it this way is that I have to write another display function for as many <dept> nodes there are. Id like this to be written so it loops through it in one function so I can add as many <dept> nodes with as many <menu> nodes as I'd like without going back into the AS code to add more display functions. And as you can see, I had to do the same to delete the buttons.

View 1 Replies

ActionScript 2.0 :: Controlling Duplicate Movieclips - Communicate With Those Clips Specifically To Make Them Draggable

Aug 5, 2004

how to communicate with those clips specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.

View 7 Replies

ActionScript 2.0 :: Controlling Duplicate Movieclips - Make Draggable And Change The _rotation With Key.Right, Key.Left

Aug 5, 2004

I found the tutorial on duplicating movieclips, especially the line-by-line translation of the code. how to communicate with those clips�specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.

View 7 Replies

ActionScript 3.0 :: Error 1021: Duplicate Function Definition Function OnComplete1(event:Event):void {

Jan 14, 2010

im having this errors:

1021: Duplicate function definition function onComplete1(event:Event):void {
1021: Duplicate function definition function stopSound1(event:MouseEvent):void {
1021: Duplicate function definition function backSound1(event:MouseEvent):void {

codes i used:

Code:
var thereReq:URLRequest = new URLRequest("SOUNDS/how.mp3");
var there:Sound = new Sound();
var thereControl:SoundChannel = new SoundChannel();

[code]....

View 2 Replies

ActionScript 3.0 :: Duplicate A Function?

Sep 22, 2009

I have one action for stopping video when i go to another page, and it works great. Here's the code:

function newPage(e:MouseEvent):void
{
new Tween(highlight_mc,"x",Strong.easeOut,underline_mc .x,e.currentTarget.x,12,false);
removeChild(currentPage.targetMC);

[Code]....

View 1 Replies

IDE :: Duplicate Function Definition?

Nov 11, 2009

I'm new to flash/AS and trying to create a flash movie that shows a frame (1) which has a 'next' button to move to second frame(2), pauses uses a timer, before moving onto the next frame (3) which then has a 'next' button to move to the third frame (4).I'm building a presentation where the user has to pause to read the instructions on frame 2 before the next button appears.My two Action Scripts are, on frame 1 :

Code:
stop();
next_btn.addEventListener(MouseEvent.CLICK,next_btnMouseClickEventHandler);[code]....

It doesn't seem to like me calling the same function in two places (frames 1 and 3) and gives me an error '1021 Duplicate Function Definition' but surely that is the point of a function, that you can call it many times? I have worked around it by calling the button and the function a slightly different name each time it is used but this just don't seem right.

View 3 Replies

ActionScript 1/2 :: Duplicate Movieclip Function?

Jun 8, 2011

I'm working on a creating a button that will create (preferably unlimited) duplicates of one movie clip. I have something that works for Flash, pre-2004, but I'd like to update it to Actionscript 2.

Button:
on (press) {
i = i + 1;

[code]......

View 2 Replies

ActionScript 3.0 :: Duplicate Function Definition?

Feb 5, 2012

i know that the problem arises from naming two functions with the same name, and i fixed that. i have also learned that keyframes mean nothing to a compiled swf, and so i cant copy/paste the code and change a couple of variables further in the timeline, i must again rename the functions. Im trying to see if there is an easier way to do thisi have 3 buttons, all 3 of them move the movie clip to a different frame. when the playhead is moved, the movie clip animates for a few frames then comes to a "stop" keyframe. At this point, each button is supposed to take you to a different set of frames, animate, stop and rinse and repeatcurrently, my AS looks as follows (frame 1)

ActionScript Code:
rear_switch.addEventListener(MouseEvent.CLICK,fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void

[code]......

View 2 Replies

ActionScript 3.0 :: Getting The Duplicate Function Error?

May 2, 2009

Im getting the duplicate function error and I cant seem to get around it.

On one frame.

Code:
stop();
var myServiceUser = new NetConnection();
myServiceUser.connect("http://localhost.com/amfphp/gateway.php");
var responder = new Responder(getUsers_Result, onFault);

[Code].....

View 3 Replies

ActionScript 3.0 :: Copying Functions To Duplicate A Function Then Use It

May 21, 2011

I'm curious to know if there is any examples you all could give me any examples of copying a function in AS3; then use that copy independent of the original function it copied. I want to make an animation system that heavily depends on one type of function. Since it depends on one type of function, I cant have every single piece of code calling back to the same function if I want to use it multiple times. Is there a way of properly doing this? are their performance consequences? I'd really like to do this instead of writing several different functions out separately that work nearly the same. (plus I need to feed a set of values into those functions that are created, some being called by event listeners of course)

View 5 Replies

Flex :: Clone Function Duplicate Data

Feb 4, 2010

I've some strange behavior using ObjectUtil.copy() and ByteArray.writeObject/readObject(). I clone an ArrayCollection and sometime the result is two identical instance of the class. Example :

[Code]...

View 1 Replies

ActionScript 3.0 :: 1021 Duplicate Function Definition

Aug 17, 2007

I am trying to teach myself the workings of Flash in CS3 as I would like to teach myself some web design and eventually work until I know enough to do commission jobs. Right now though I really don't have anything to create so I decided to make a myspace profile in flash. I created a layout in flash where I have a series of 80x80 images that are 10px apart. There is another layer where each image has a corresponding clickable button with a defined instance name. There are a total of 15 buttons but when I try and export it to flash movie to see if it work I get 14 error messages telling me I have error 1021 which is discussed by adobe here: URL..."1021: Duplicate function definition.

View 5 Replies

ActionScript 3.0 :: 1021: Duplicate Function Definition?

Jul 28, 2009

I keep getting this 1021: Duplicate function definition.

I googled it, but couldnt exactly find how to fix it, im very confused.

the bold lines are the duplicate function definition that flash tells me.

Code:
window01.pbtn01.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
window01.pbtn01.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
window01.pbtn02.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);

[Code]....

View 3 Replies

ActionScript 3.0 :: 1021: Duplicate Function Definition

Aug 28, 2011

i have a flash movie that is part of quite a large project. it is the second swf file to load and contains a few different elements that stay throughout the whole "shabang"

i am using cs5 and cs5.5 to publish. and each time i try i get a

PHP Code:

1021: duplicate function definition 

error message (something that i never got in cs4)

reading up on it and asking a few people it looks like it is being called elsewhere - but it is not in any other class files and is not on any frames within the fla's either!!! even when i try to change function names it gives me the same error (also when i remove the path the class file from main i still get the error!)

[Code].....

View 9 Replies

ActionScript 3.0 :: Disable RollOut Function On Movieclips On Click Function?

Sep 13, 2009

I'm doing a basic site with frame labels on the main timeline whose name corresponds to the btn names. A simple  otoAndPlay(evt.target.name); I have a basic navigation setup of 7 mcs with mouse eventlisteners for CLICK, ROLL_OVER and ROLL_OUT.
 
Example:
prepare.addEventListener(MouseEvent.CLICK, navigate);plans.addEventListener(MouseEvent.CLICK, navigate);retire.addEventListener(MouseEvent.CLICK,

[Code]....
 
Does anyone know a better way to do this so when my mcs are clicked they display the rollover content/art? In essence I'm trying to achieve that when the user clicks a btn it goes to that "page" and the corresponding btn stays highlighted. Pretty standard web navigation technique but I just don't know what the best way to do this in flash is and with  how my site is setup.

View 1 Replies

ActionScript 3.0 :: Duplicate Function/Incompatible Override Errors?

Oct 20, 2009

I'm trying to create a simple game where you can click on shapes in a toolbar and then drop them on the screen.There are three shapes, so I want the user to be able to select different shapes and such.I've written the code thus far like this:

Code:
stop();
var cursor:MovieClip;
var shape:MovieClip;
var circ:MovieClip;[code]..........

I'm getting a duplicate function error and incompatible override error for both the "rect" and "pent" functions, but the code works fine if I eliminate these two functions and just include the "circle" function (albeit the old circle disappears the instant I drop a new one).

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved