ActionScript 2.0 :: Duplicate MCs And PLace Randomly
Apr 16, 2009
I want to attach a mc from the library, then duplicate it 2-3 times, and have the duplicates start in random _x / _y locations on the stage. They then slowly drift across stage.The code I've got so far loads the mc from the library, duplicates it once, and places it randomly. But it only creates one duplicate instead of 2 or 3. And I suspect it could be simplified.So I need corrected code to create 2 or 3 duplicates, and have them start randomly and move at the same speed across stage. Maybe advice on how to allow them to move at different speeds would be useful as well.[code]
View 2 Replies
Similar Posts:
Apr 8, 2005
how can i duplicate a movie clip and then place it on a certain place on the stage
View 5 Replies
Jul 20, 2010
I'm trying to place my mc's at a different position each time the game starts but within a certain area. I've used random before...
random(300);
...but I want it to be randomly between the coords
_x 150 and 450
_y 250 and 350
View 5 Replies
Nov 30, 2005
Let's say i've got a tree that's coming at me... I can dodge the tree on my bike but if I hit the tree I get a cuncussion...
how would I be able to randomly duplicate the tree along _x?
I figured I would just create one movieClip and has an animation if the tree moving down (simulating it coming towards me), but I know I can do that motion through action script...
View 14 Replies
Jul 3, 2006
I want to load some mcs randomly on the stage, except for a footer area at the bottom of the stage. Is there a way to exclude just a certain part of the stage using something like Math.random()*Stage and then specifying the bottom 300 pixels as off limits?
I'm using the whole stage because the swf is embedded 100% across the browser, so I can't restrict the dimensions.
Code:
onClipEvent (load) {
x = this._x=Math.random()*Stage.width;
y = this._y=Math.random()*Stage.height;
}
View 14 Replies
Aug 13, 2009
how could I randomly place x number of rectangles on stage so that they dont overlap?
not tween, just place?
View 0 Replies
Feb 21, 2011
I am trying to figure out how to randomly place four cards on stage through external AS3, by arrays.For example:
Code:
var positionArray:Array = ["48.50", "125.50", "202.50", "280.50"];
function getXAxis():String
[code]......
View 0 Replies
Jan 17, 2006
I am new to flash programming. I have to create a flash card game for a client.There are 52 cards with back showing in 52 rectangles. Each time the swf loads the position of the cards has to be different (randomly placed) in those 52 rectangles. Click on the card and the face of the card shows. Also an option for shuffle. When the user clicks on shuffle, the cards are randomly placed.
View 1 Replies
Mar 8, 2011
Is there anyway to randomly place a MovieClip/Sprite on an irregularly shaped object?For a rectangle, it seems pretty straightforward (i.e. use Math.random with the range being the coordinates of an object)...but what if say, you would like to avoid placing objects in the center?
View 2 Replies
Sep 23, 2009
I have a 100 x 60 rectangle movieclip and I want to duplicate it n times (n is an arbitrary value taken from XML) and place the newly created movieclips in a grid.
The grid will have an arbitrary number of cols / rows, as these values are taken from XML too.
I'm using a for loop to place the movieclips horizontally, but I have no clue how to create a new row once the desired amount of movieclips have been placed horizontally, and so forth until the maximum (n) number of movieclips have been placed on the stage.
Here's my script so far:
ActionScript Code:
var n:Number = 28;//Maximum number of movieclips - this value is actually taken from XML
[Code].....
View 2 Replies
Dec 4, 2009
I have four dynamic text field created at the authoring time in Frame-4. I just need them to be placed randomly every time when I come from Frame3. I have known that there is a Math Class which generates random numbers which would be an effective way. how do I proceed ahead i.e shall I create an array and seed it with the their current positions etc etc
View 5 Replies
Feb 1, 2011
How to make this smoke effect work without mouse input. I am trying to have it spill from the end of a cannon, & my attempts to modify the position have resulted in all my bitmaps shifting. I changed this
doTrail(_root, _xmouse, _ymouse, currentBitmap);
To this
doTrail(_root, _x=80, _y=100, currentBitmap);
[Code] .....
View 0 Replies
Aug 21, 2010
I've used .x = and .y = with the position I want and the pane continues to show up in the top left corner instead. What am I doing wrong?
View 2 Replies
Mar 7, 2008
how can we place hundreds of instances of one movieclip on different place?
for exemple, pacman:
how should i code the placement of all the money?
i would go:
_root.attachMovie(
_root.attachMovie(
_root.attachMovie(
but that's not the good solution is it?
there must be a code to do that without hundreds of lines of code.
View 3 Replies
Mar 20, 2010
My problem is that when I click the letter movieclip it does create the duplicate as it should and it starts to drag the duplicate mc. However, when I release the clip it doesn't stop dragging? I realized that if I put onMouseUP event instead of onRelease it actually does stop dragging when I release the mouse. I would, however not like to use the onMouseUP event if possible.
[Code]...
View 2 Replies
May 4, 2010
If I have an object that calls
addEventListener(Event.ENTER_FRAME, update);
addEventListener(Event.ENTER_FRAME, update);
will that add 2 listeners?
View 2 Replies
Sep 24, 2007
Onmy stage I have a MC, and when I click it a random MC from the Library should appear and move around randomly.
I'm using this to make it move around randomly [URL]
how to make the random MCs appear from the library. And should I put the random moving script on each of my ten MC?
View 8 Replies
Sep 26, 2000
I am having problems dupliating a movie clip. I can make a duplicate from an original but when I edit the duplicate it also modifies what is in the original. (I am just changing the text, thats the only difference between the 2) How come it effects both clips when I only change one?
View 6 Replies
Sep 21, 2009
i tried it all but cant solve it on my own. i have 10 different MC,s. they shall appear by hitting a key on the keyboard. all i want them to appear and play on a random place.
all then 10 MC,s are deticated to 10 different keys on the keyboard. (so by hitting the "A" on the keyboard shall place and play MC "A" at a random place..
View 18 Replies
Jan 27, 2009
URL...that has videos in the work section (click work, then the tv icon or the radio icon at the bottom of the page) that will randomly not load.THe weird thing is that the files have never moved, and yet, the same computer on the same ISP using the same browser that could view the videos 2 days prior, suddenly cannot.I'm also having an issue where the flash won't even load on startup randomly.This had happened one time in the past, and I took the page from a test area of the site and put it live, and it solved the problem. So my last ditch plan z is to make a mirror to link to in case the videos aren't loading for a user.
View 2 Replies
May 4, 2009
im looking for action script that controls if MovieClip A lands at x coordinate and y cooridnate, then make MovieClip A1 happen.
does this actionscript go on the movie clip, a button or the frame?
what is the script?
View 2 Replies
Aug 8, 2009
I have a movie clip divided into three scetions. The first section starts on frame 6, the next on frame 11 and the last on frame 16. Is there a way to get flash to choose randomly between only those frames (6,11,16)and not the frames in between(1-5,7-10,12-15)?
View 4 Replies
Aug 18, 2010
I need to call external SWF's so they randomly appear within my main SWF. When one ends, the next will start and so on. I searched the forum and found a thread with the code below and have run in to an issue.
Each of the external clips is set up exactly the same... same length, same tweens, etc.
The code below is sitting the first frame, on the top layer within my main SWF:
randomClips = new Array ("Journey.swf", "Doobies.swf", "LedZep1.swf", "PinkFloyd1.swf", "Stones.swf");
function randomBackground() {
[Code].....
The main movie is one frame long and has three layers. The top layer has the Action Script (above), the bottom layer has my background image, and the middle layer holds the empty movie clip named mtClip
When loaded to the server, the movie plays and one of the external SWF's will load. When it ends, I need one of the other SWF's to load. What happens is that rather than randomly playing one of the other SWF's, it repeats the original external SWF. If I refresh the main SWF, it randomly selects one of the external SWF's and it will constantly repeat.
The external SWF's have no Action Script. I tried it with putting a Stop on the last frame, but that didn't help.
View 7 Replies
Mar 22, 2012
I've 3 movieclip on stage which is mc1,mc2,mc3at first they are alpha=0What I want is when i click on revealBtn, 1 of them will show up as alpha=1.But with my code below, sometimes I need to click about 5 times or more only can make all those mc show up.Is there any solution for what I wanted? I've try splice but it's still not working well.
var mcArray:Array = [mc1,mc2,mc3];
for (var j:int = 0; j < mcArray.length; j++)
{
[code].....
View 2 Replies
May 12, 2009
How can I mix an array randomly in as2? I have this code so far:
Code: Select allfunction startGame(){
for(i=1;i<=52;i++){
cards_array.push(i)
I gues you see this is for a card game (hearts).If I want to mix the cards I have to mix the array...
View 2 Replies
Mar 13, 2003
I want to have a few movie clips moving randomly over my flashsite. They will look bugs. And I want them to move in the direction the head is pointing.I have tried the random movement tutorial here on Kirupa but can't get the mc to rotate in the direction it's moving.
View 14 Replies
Feb 14, 2006
[URL] how I might go about loading the swfs randomly instead of 1. 2. 3. 4. etc. [URL]
View 1 Replies
May 29, 2009
I have this function that moves the cursor automatically to random points. I want to know how I can make them move to 4 specific points (x,y coordinates) instead.
I am assuming I need to create an array of the of some sort with the x,y points and tween them but have no idea how to go about this.
Code:
function autoMoveObject() {
if (!mouseControl) {
var moveObjectX:Tween = new Tween(cursor, "_x", Regular.easeOut, cursor._x,
[Code]....
View 1 Replies
Apr 26, 2010
I have 4 buttons that I have made invisible. After a random time, one of 4 buttons should randomly become visible.That button then will lead to another frame.How do I enable one of them randomly (and make it visible at the same time)?
View 1 Replies
Dec 17, 2011
I have the following XML
Code:
<countries>
<country>
<name>foo</name>
[Code]....
View 2 Replies