ActionScript 3.0 :: Array + Random : Make Disapear A Special Movie Clip?

Nov 25, 2010

I'm trying to do a game in as3, but i get a problem, i got an array :var movieClipArray:Array = new Array(new monClip1(),new monClip2(),new monClip3(),new monClip4(),new monClip5())that each clip appears randomly and for a random time, but for special buttons, you can suppress some clips, the problem is that with monClip1, and monClip5, its quiet easy with shift() and pop(), because they will always be the first and last of the array, but for the rest, s they wont be the same order, we cant only use a splice(), so I tried with indexOf, but it doesnt work ...

if(blablabla ...)
{
movieClipArray.splice(movieClipArray.indexOf(new monClip2()), 1);
}

View 7 Replies


Similar Posts:


ActionScript 3.0 :: Random Movie Clip From An Array?

Aug 1, 2010

I am fairly new to actionscript infact I've only had flash for a few days, so still learning, but what I'vedecided to do are just small little projects to try and improve my skills and knowledge of Actionscriptas I am enjoying programming8-)I would like to be able to display a random movieclip from my library which I created earlier and convertedthem to a symbol of a movieclip and then linked them with names piece1, piece2, piece 3 and piece 4.What I would like to be able to do is display these movie clips randonly on the stage, I've use an array withjust 1 object inside it but not with 4.

var randompiece:int=Math.random()*3;var mazearray:Array=["piece1","piece2","piece3","piece4"];
I'm not sure where to go from here

[code].....

View 3 Replies

ActionScript 2.0 :: Random Movie Clip Out Of An Array?

Nov 19, 2009

i want to load random external movie clips into a movie clip i have about 4..

ActionScript Code:
Bmc.loadMovie("de_image_01.swf");
Bmc.loadMovie("de_image_02.swf");
Bmc.loadMovie("de_image_03.swf");
Bmc.loadMovie("de_image_04.swf");

How do i put it into an array for AS to pick a external movie clip randomly?

View 1 Replies

ActionScript 3.0 :: Selecting A Random Movie Clip From Array?

Mar 7, 2010

I know this should be easy, but I can't seem to make it work. All I want is for the variable currentPage to select randomly from an array so that every time the page loads, it displays a different currentPage. This is what I have so far:

var myImages:Array = new Array("outsource_mc","solutions_mc","staff_mc");
var randomImages:Array = [];
var randomCount:Number = 1;
var r:Number;
for (var i = 0; i<randomCount; i++) {

[Code]...

View 6 Replies

ActionScript 2.0 :: Loading A Random Movie Clip From An Array?

Nov 6, 2007

How do I load a movie clip randomly from an array? Do I need to use a container movie clip to load them into? I've tried a few methods that work for external swf's - but I want to load movie clips that are already in my library.

View 1 Replies

ActionScript 2.0 :: Make A Movie Clip Play At A Random Time?

May 14, 2003

How do you make a movie clip play at a random time? And keep on playing at random times until the flash movie is over.

View 1 Replies

ActionScript 3.0 :: Make An Array 'spawn' A Movie Clip?

May 13, 2011

Im asking this because right now im gettin some code off a tutorial named "How to Create a Platform Game in AS3" that creates the levels with arrays and also creates the sprites with code. [code]...

View 7 Replies

Set A Special Rollover Effect For A Movie Clip

Feb 6, 2009

I'm trying to set a special roll over effect for a movie clip i created. all i need to do is this: when i roll over, it should play from frame 2 and stop where i told him (at frame 5) when i roll out i want him to play from frame 6 and stop where i told him again. (at frame 10). i already did this with no problem except this: my movie clip has a very complex animation i created with other movie clips who works frame by frame style (actual animation). the problem is this: when i roll out after a short time (about half a second) the flash jumps to the rollout part of the movie clip and shows the rollout animation but doesn't finish the rollover animation, what makes the animation to jump (the animations i use is a bit long).

so i'm trying to see if anybody can explain to me how do i make this jump get out of my flash animation. what i mean is this : if i rollover the mouse and stays on the movie clip, the rollover animation is played and when i rollout out of the movie clip the animation continues as usual (this is something i already accomplished). but i want to make this a bit more complex : when i rollover and than right away roll out of the movie clip i want the flash to play the roll over animation and right after that the rollout animation without stopping .... ' i hope i made myself clear with this problem .... for some of you it may seem easy (using some action script tricks or something) but I'm only a beginner who's trying to figure it out ....

View 8 Replies

ActionScript 3.0 :: Make Content For Home To Disapear / When Another Button Is Clicked?

Jan 16, 2010

i have a menu, that works with a xml file.the xml has the specific code that triggers the .as file:[code]when i press the button home for example, the home will load...then i press the button about, and it loads as well, but the home still playing on the back.how do i make the content for home to disapear when another button is clicked? because the code works for all the buttons, it has to be something generic that would work for the event of anybutton being clicked.

View 23 Replies

ActionScript 2.0 :: Load A Random Movie Clip From The Library To An Empty Clip On The Stage Called (bg_graphics)?

Oct 20, 2004

I want to load a random movie clip from the library to an empty clip on the stage called (bg_graphics). the clips in the library are called (green, blue, yellow).

View 5 Replies

ActionScript 2.0 :: Access A Movie Clip Inside A Movie Clip Through Array?

Feb 11, 2012

i made a movie clip name floor, and inside it are movieclips called plan0, plan1, plan2, plan2, and so on.

so to make it easy, it put the movieclips inside the floor movieclip into an array, like this:

daFloor = new Array();
for(a=0; a<10; a++){
daFloor[a] = "plan"+a
}

[Code]....

both didn;t work. how to access the inside movieclips through array;

View 2 Replies

ActionScript 3.0 :: Make A Movie Clip Follows Anther Movie-clip That Could Be Moved By User?

Sep 7, 2010

iam tring to make a new project , i just wants to know how to make a movie clip ( constant speed ) follows anther movie clip <--- "which can be moved by the user "

<<<>>>> i believe that this idea is good , that i records the X and Y postion of the User's movie clip and just make the other movie clip points at this postion and move toward it ,

how to make the other Movie clip (( which is a car ! .. so it have acceleration , speed , steering , etc )) go to this position or let us say try to??

View 9 Replies

ActionScript 2.0 :: Loop (Every 3 Seconds) Random Clip From Array

Jul 4, 2009

This code produces a random clip from an array. I need it to loop every 3 seconds. Is this possible?

arr = ["strandA","strandT","strandC","strandG"];
arr.sort(function(){return Math.floor(Math.random()*3)-1});
var clip = arr[0];
this.attachMovie(clip,clip,1,init);

Using Flash MX 2004 V7

View 5 Replies

ActionScript 2.0 :: Random Clip From An Array - Loop Every 3 Seconds

Jul 5, 2009

This code produces a random clip from an array. I need it to loop every 3 seconds. Is this possible?

[Code]....

View 2 Replies

Professional :: Make Movie Clip Non-clickable Unless Another Movie Clip Is Visible

Mar 22, 2011

I'm making a room escape game and I've run into a problem. When an item gets added to the inventory, I'd like the user to be able to click on the item to affect another object (e.g. clicking screwdriver hides screws and displays other image) however when I add the code to the item, if the item is clicked and it's nowhere near the object it affects, the image pops up and it looks really stupid.

So what I'd like to be able to do, possibly using if and else statements or whatever's easiest, is to only have the inventory item be clickable if the movie clip of the object is affects is visible on the stage.

View 6 Replies

ActionScript 3.0 :: Make A Circle Object Movie Clip Call Ball And Make A Rectangle Object Movie Clip Call Mc

Dec 12, 2010

make a circle object movie clip call ball and make a rectangle object movie clip call mc and paste this coding.

[Code]...

can anyone explain about the movement about D? the D is talk about the distance if i go -X,way my ball go ++ to +x?

View 1 Replies

ActionScript 2.0 :: Random Script That Will Make Movie Clips Play In "random" Order

May 5, 2009

I have 5 boxes on the stage as movie clips, each one with the same animation waiting to be targeted. What I need is a random script that will make them play in "random" order. This should occur after a few seconds of inactivity where they each play, but once there's mouse movement, whichever ones did animate should "reset" or play back to their original positions, (assuming there's more boxes and there's movement before all of them play). I have some code in there for arrays and some random script that isn't working right now. I just need the random setup, really. I may be able to figure out the time delay, (maybe), and then be able to tweak the rest of it for how I need. Right now, I've just simplified everything in a 5 box example hoping someone might be able to work with what I have.

View 6 Replies

ActionScript 2.0 :: Make A Button That Changes Aa Mc's Color To A Random One From An Array?

Jul 12, 2002

I'm trying to make a button that changes aa mc's color to a random one from an array.The array:

Code:
mcarray = new Array();
mcarray = new Array(3);
mcarray = new Array("0x00FFFF", "0x00FF00", "0xFFFF00", "0x0000FF")

and the actions for a btn:

Code:
on (release) {
mccolor = new Color(_root.mc);
mccolor.setRGB(Math.random(mcarray));
}

But the mc turns black instead of some another color...I think it's the "Math.random(mcarray)" there...or is it something else?

View 3 Replies

Random Movie Clip PLay?

Oct 1, 2009

i have a collection of movie clips (mc0, mc1, mc2...etc etc), and when motion is detected on a webcam, one of these clips is shown on the stage.however, for some reason only mc0, mc1 and mc2 are being displayed,and i cannot get mc3, mc4 or any others to be chosen.

Code:
import flash.filters.*
// Assumes a Video object named "myVideoObject" is on the Stage

[code]....

View 1 Replies

ActionScript 3.0 :: Random In Movie Clip?

Nov 13, 2009

i want to add random mooving effect to my movie clip and adjust it's speed and direction

View 1 Replies

Random Frames In A Movie Clip?

May 11, 2010

I'm trying to make a series of 16 short movies loop infinitely in a random order. I have a master movie clip called "random_mov" that has 17 frames. In frame one is an action:gotoAndStop(1 + Math.floor(Math.random() * 17));Frames 2 - 17 are my individual movies (movie1, movie2, movie3, etc...), one per frame. The code above does seem to work, but it only works once, looping a randomly selected frame forever. I need it to go back to frame one after each movie is complete so it can select another random frame

View 2 Replies

ActionScript 3.0 :: Random Movie Clip Loading?

Jan 14, 2009

I am making a survey which consists of 50 questions in which each question will play one movie clip and will ask the user to enter in a text box what they think about it. After that they click next and will go to the next clip

View 5 Replies

ActionScript 3.0 :: Play Random Movie Clip?

Feb 13, 2009

I'm making a slide show that will be playing in the background at a retirement party. I have several different slides (movie clips) that I would like continually play at random.So far my random code looks like this:

ActionScript Code:
var MCs = new Array("ball", "box", "poly");
var selectedMC = MCs[Math.floor(Math.random() * MCs.length)];

Is there a way to make it gotoAndPlay once it selects the random movieclip?

View 2 Replies

ActionScript 2.0 :: Random Frames Of A Movie Clip?

Jan 24, 2010

I have a quick queshtion about movie clips. I was wonderng how to make them randomly go to a frame within themselves.

View 1 Replies

ActionScript 3.0 :: Random Text From A Movie Clip?

Sep 17, 2010

i want to load a random movie clip then.. as i load a movie clip.. the text from each movie clip should also be randomize.

View 1 Replies

ActionScript 2.0 :: Random Movie Clip On Load?

Mar 12, 2011

I have this code and file. It works, but I want just one movie clip to play randomly, not two, or three

Code:
var clips:Array = ["redl_mc", "blue_mc", "green_mc"];
playRandomMC();

[code]........

View 2 Replies

ActionScript 2.0 :: [fmx] Specify Random Effects On A Movie Clip?

Nov 14, 2003

I'm working on a variation of the photo gallery tutorial, and I've been trying to specify random effects on a movie clip which is dynamically loading photos. I tried using the idea of the randomly loading backgrounds to specify panning effects, except that flash is running several of them on each photo instead of one case to each time a new photo loads.Here is the script, without the random effects.......

[AS]
var absX = Stage.width/2;
var absY = Stage.height/2;
this.pathToPics = "";

[code]....

View 3 Replies

ActionScript 2.0 :: Random Movie Clip Actions?

Apr 14, 2005

I want to have a background that has random movie clips playing. Originally I was going to have long timelines with blank frames. Is there a simple a frame action that I can use that stops the playhead and makes it wait for certain amount of time and then plays?

View 6 Replies

ActionScript 2.0 :: Creating Random Movie Clip?

May 11, 2011

I have a movie clip which i gave instance name "abc" (suppose). I want this movie clip to automatically load randomly on the scene when i load movie. I mean this movie clip should be seen randomly making lots of duplicates scattering all over the document (like stars twinkles randomly all over the sky).

View 1 Replies

ActionScript 2.0 :: Play Random Movie Clip?

Sep 6, 2007

I have 4 movie clips on the stage, which can be numbered or named whatever you like.

To start, I need some code that tells one of them (at random) to play.

Then when the clip finishes playing, on the last keyframe, some similar code that tells another of the 4 clips to play (at random), but not the same clip again.

View 9 Replies







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