ActionScript 1/2 :: Random MovieClip Script Not Selecting From All Outcomes?

Oct 3, 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 more to be chosen.

Code:import flash.filters.*// Assumes a Video object named "myVideoObject" is on the Stageactive_cam = Camera.get();filterList = [                 /* 0 */ "multiply",                 /* 1 */ "multiply",                 /* 2 */ "multiply",                /* 3 */ "multiply",                /* 4 */ "multiply"                 ];positionList = [                 /* 0 */ {_x: 512, _y:

[code]....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Putting Data Into An Array Via XML And Then Selecting At Random An Image String To Load In A Pic At Random

Feb 11, 2009

I've been putting data into an array via XML, and then selecting at random an image string to load in a pic at random. But whilst doing this, I wanted to remove the String from the Array that I have just used, so I don't get repetition of the same image in the output. I initially thought that pop would remove the string I had just used - But of course it Removes the last value in the Array instead, which doesn't really help.

Ok - so how about randomizing the data once inside the Array, after it has been pulled in from XML!? That way I can load in the 'last' image, and then pop it out! Keeping a randomized selection of images each time 'it' is loaded

View 2 Replies

Actionscript :: Selecting The Random Variables?

Feb 16, 2011

Is it possible to randomly select from variables in action script?I have tried using or -

question.text = question1 || question.text = question2;

View 2 Replies

ActionScript 2.0 :: Selecting Random Number From Variable

May 30, 2010

So what I have here is a button that will take away a random number from a variable (in this case being money) this is nothing more than a learning experience and I just wish to broaden my horizons on flash AS.

Actionscript Code:
on (release) { money -= random(200); }on (release) {gotoAndPlay (2);}
While this code works just fine the only problem i have with it is that it will select a number from (0-200). Is there a way I can set this up to select a random number BETWEEN 2 numbers? EX: (150-200)

View 3 Replies

ActionScript 3.0 :: Selecting A Random Frame In Another Scene?

Dec 28, 2011

I have an app I'm creating with Flash CS5.5 with 42 different short stories in it.  It has 2 scenes.  Scene 1 is the opening and contents menu to access the stories.  Scene 2 contains the 42 stories.In scene one, I have a button that I want to be able to pick a random story so it would need to pick a random frame between 1 and 42 in scene 2.  I have seen some code in here that will pick a random frame when you open the program, but I don't know how to tie it to a button or pick a random frame in another scene.

View 14 Replies

ActionScript 3.0 :: Do A Math.random On Selecting A Certain Number Of XML Items?

Jul 5, 2009

anyway to do a Math.random on selecting a certain number of XML items?

View 8 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 3.0 :: Dynamically Selecting A Movieclip?

Apr 20, 2011

I'm trying to dynamically move the desired MovieClip depending on how many times the right or left button is pressed.

I've written this:

nml:Number = numpos + 2;
nmr:Number = numpos - 2;
var nmlm:MovieClip = panels.panel(nml)

[Code]....

View 9 Replies

IDE :: Selecting Movieclip Dynamically Within A Dynamically Selected Movieclip?

Mar 5, 2010

Lets say you have a bunch of similar movieclips and you want to move anyone of them dynamically. We would use:

[Code]...

Something like that. However, my issue is not selecting a movieclip dynamically, but selecting another movieclip dynamically within a dynamically selected movieclip.

View 2 Replies

ActionScript 2.0 :: Random MovieClip Load In Another MovieClip, With Its Own Functions?

Dec 29, 2002

I've got 12 MovieClips, which all have specific functions in the movie. Those MC's will appear and dissappear after a few seconds. But what I want is, that those MC's have to appear at random .If all 12 MC's have appeared, the appearance has to be stopped. So for example MovieClip number 4 has to appear just once. So 12 MC's will appear, but everytime when the movie starts, the appearance has an other sequence.What is written above I want to place in an other MC. So there is one MC which 'load' 12 MC's within it

View 2 Replies

ActionScript 3.0 :: How To Pick Random Movieclip

Oct 20, 2010

but I've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this:Actionscript Code:s1 = new Sound();_root.s1.attachSound("sound"+(random(10)+1));s1.start();...where there would in this example be 10 sounds in the library, with names from sound1 to sound10.Now, I want to be able to do the same in AS3. As a temp solution, I've been forced to do a lot of if statements, but that's ugly, timeconsuming and inefficient.I also tried this (AS3):

Actionscript Code:
var soundArray:Array = new Array(new sound1(),new sound2(),new sound3(),new sound4(),new sound5()) var randomInteger:int var selectedSound:Sound function

[code].....

View 4 Replies

ActionScript 3.0 :: Random MovieClip Play?

Oct 29, 2010

have 16 instances of one movie clip on the stage and each  one has their own unique instance name. The movie clips have a nested  animation and I want each clip to play randomly. I'm familiar with the Math.random class, but not for animating clips.  Here is what I have so  far:
 
var turkeyArray:Array = new Array();turkeyArray[0] = turkey1_mc;turkeyArray[1] = turkey2_mc;turkeyArray[2] = turkey3_mc;turkeyArray[3] = turkey4_mc;turkeyArray[4] = turkey5_mc;turkeyArray[5] = turkey6_mc;turkeyArray[6] = turkey7_mc;turkeyArray[7] =

[code]....

View 40 Replies

ActionScript 2.0 :: Random Some Movieclip On A Flash?

Nov 26, 2009

I was thinking about create a flash that I past some movieclips on.I like to random so it spread out all over the flash.To add a a movieclip is no problem. To make it random inside the flash is no problem when I use Stage. That I have problem is that have happen the moviclip have lap over another movieclip.What I have understand I have to create some kind of array that have information about where the other movieclip is and make a zone around it so no other movieclip is close.

View 9 Replies

ActionScript 3.0 :: Movieclip Moving Random Around?

Oct 6, 2010

If I have a movieclip moving random around the stage, and I have another movieclip I one corner. is it possible to add an event listener to listen after if the random moving movieclip comes over the other movieclip?

View 1 Replies

ActionScript 2.0 :: Random Movieclip Postition?

Feb 20, 2008

How do i make it so the moviclip loads at a random X when tween starts.(but keeping it inside the stage)This is my origanl code.

Code:
mport mx.transitions.Tween;
import mx.transitions.easing.*;

[code]....

View 1 Replies

ActionScript 2.0 :: Choosing A Random Movieclip?

Sep 8, 2008

I'm trying to achieve the following:

On my stage are 8 movieclip, respectively called squid1 to squid8. I'm trying to make actionscript designate one of these 'actors' at random once in a while, and make it pop up/do something. Dont know what exactly yet. Here's what I'm working on...

Code:
function chooseActor() {
var pickNumber = (Math.floor((Math.random()*8)));
var result:Object = new Object();

[Code].....

Now chooseActor funtion does what I intend it to do, i.e. generate a variable consisting of the word 'squid' combined with a number. I expected I could simply use this variable as the name of a movieclip and then just unleash all sorts of wackiness on it. But it doesnt work.

View 5 Replies

ActionScript 3.0 :: If Statement And Random Movieclip?

Aug 3, 2010

I'm creating a small guessing game where on stage there are 6 squares, and the user has to click on a square, and see if it's the correct one (it should be a bit more exciting when it's finished!) The random answer is created using the math.random method and I'm using an array for the square movieclips. The problem I now have is with the IF/ELSE statements.

have a look at the following code, and the bit I need you boffins to look at is just after the if statement.

var myArray:Array = [mc_square01, mc_square02, mc_square03, mc_square04, mc_square05, mc_square06];
myArray[Math.floor(Math.random() * myArray.length)].addEventListener(MouseEvent.MOUSE_DOWN , chooseMe);

[Code].....

View 3 Replies

ActionScript 3.0 :: How To Use Math.Random On MovieClip

Sep 24, 2010

How to use math.floor(math.random) on a movieclip. Basically I have 2 movieclip called apple and orange. Apple and orange will move out from the right of the stage to the left of stage. the ending part of the stage is at the 3/4 mark and it will disappear. The disappearing part I have already solved it but not the appearing at different speed part. How do you like use the above method <Math.floor(math.random)> to make the apple and orange appear at different timing? I went to research on how to make random objects move at random and found math.floor(math.random).. but I do not know how to do it..to make them move at random.

This is what I have come up with using logic.
apple.x -= math.floor(math.random(something something));
Minus sign before equal sign to make it move from right to left on the x-axis but the rest of the method of math.floor and math.random i have no idea how to use it. [URL]

View 3 Replies

ActionScript 3.0 :: Get A Random Exported MovieClip?

Dec 5, 2010

I'm developing this game and I want as3 to get a random exported movieClip.

You usually call:

Code:
var mc1:ExportedMC1 = new ExportedMC1();
var mc2:ExportedMC2 = new ExportedMC2();
//do stuff with mc1

[Code].....

I know for a fact that this won't work, but how do I do this?

I also tried getting the class by string, but that returns a Class class (lol) instead of the movieclip class...

View 2 Replies

ActionScript 2.0 :: CS3 : Random Image/Movieclip On Refresh?

Dec 4, 2009

I'm currently using Flash CS4, and Actionscript 2.0 to make myself a website for my artwork. My entire website is being created in Flash (not using Dreamweaver, so keep that in mind.) My site is constructed so that Frame 1 is my Home page, Frame 2 is another page on the site, etc.On my Home page, I want a random image (of my artwork) to show up in the body of the site (there is an interface surrounding it), every time a viewer visits/refreshes the page. It sounds simple, but I've been struggling with this a lot because I keep coming across really complicated Actionscript.

I know there are two possible ways to do this. 1) The images can be drawn from the same folder as my .fla file is saved in...OR...I can attach Movieclips (of my artwork) from my Library, to a blank target Movieclip where they will load on the page. Here's an outline of the functions I want:

-Random selection of image/movieclip
-target destination (where imagery can load)
-(I'll have a total of about 3 images)

View 2 Replies

ActionScript 3.0 :: Apply Random Alpha To A Movieclip?

Oct 15, 2009

I want to create a box that has a random alpha effect over 31 frames.I'll be putting this box over top of other graphics to make it look like it's flickering.I can do this with animation but hope there is a solution using as.

View 9 Replies

ActionScript 3.0 :: Loading Random MovieClip To Stage

Oct 18, 2010

I have 3 mc's in my library each with linkage "icon1", icon2", icon3". What I'm trying to do is load one of them randomly in to the stage. Here's the code I have so far:

Code:
//creating an array that holds the mcs
var iconsarray:Array = new Array("mc1","mc2","mc3");
//creating a random number to use for loading the mc
var randmc:Number = Math.round (Math.random ()*2)+0;
//this is just a string to hold the mc with the number, not used
var all:String = (iconsarray[randmc]);
[Code] .....

View 1 Replies

Actionscript 3.0 :: Random Number MovieClip Reference?

Sep 21, 2010

I'm working on a project where I have 10 movieclips on the stage, each with a different instance name. I'd like to use a random number generator to play each one at random, but I'm not sure how to do it. I've been looking for the topic online but all I can find is loading them randomly to the stage... my movie clips are already on the stage. I want them to stay on the stage but only play when called upon* EDIT:ere's what I have. Super simple but I'm a little lost I guess.At the moment I'm referencing a function when I should be referencing a variable but I'm still not sure how to fix it.

function randomMC(low:Number=1, high:Number=10):Number
{
return Math.floor(Math.random() * (1+high-low)) + low;

[code].....

View 10 Replies

ActionScript 3.0 :: Random Color Fill In MovieClip

Feb 22, 2009

How can I fill a MovieClip with a random color using Actionscript 3?

View 13 Replies

ActionScript 3.0 :: Transform The Random Color Of A Movieclip

May 13, 2009

I'm trying to transform the color of a movieclip, the movie clip is duplicate in more and those move from the center of the screen to the sides. I want some colors specifics those i drop inside a var but i don't know how to make the random take those colors. I'm used this code

[Code]...

View 4 Replies

ActionScript 3.0 :: Random Movieclip Location Without Overlap?

Aug 22, 2009

I am working on a flash file that imports xml data. This data gets run through a for loop and each xml child gets its own movieclip called menuItem. Then the various instances of menuItem are randomly placed on the stage. However, they always overlap to some extent. I don't want this.

So, how would I make sure they don't overlap? I looked at the hitTest function but it seems to require 2 different movieclips to check for the collision. I only have one movieclip with multiple instances.

View 10 Replies

IDE :: Center Movieclip (with Random Reg Points) On Stage?

Mar 3, 2010

I'm working on a project where I have to load multiple movie clips and center them on the stage.

PHP Code:
loaded_clip._x = Stage._width/2;loaded_clip._y = Stage._height/2; 

Unfortunately, in this case that doesn't cut it. The move clips I'm loading all have different registration points, and they end up looking anything but centered. Is there a way to center them based on some other factor other than the registration point, so that they look centered?

View 5 Replies

ActionScript 2.0 :: Movieclip Which Is Added To The Stage Every Second At A Random Place?

Sep 9, 2009

I have a movieclip which is added to the stage every second at a random place.i want all instances of this movieclip to move to the postion x=100px and y=200px on the stage at a rate of 5px.im not sure how to code this, i would like the code to be in as3 if possile as i do not know as2.

View 2 Replies

ActionScript 2.0 :: Load Random Text Quotes Within A Movieclip?

Mar 9, 2010

So on my scene is one button and a movie clip.

and so far i have it that when you click the button the movie clip plays and the cookie breaks and the fortune animates out.

my question, is their a way to generate random quotes or "fortunes" every time you play the movie clip. like can their be dynamic text inside the movie clip that randomly picks one of the fortune to display?

View 3 Replies

ActionScript 3.0 :: Buttons And Random MovieClip - Calling Array

Feb 17, 2009

I'm learning AS3. I would like to call an Array which contains five mc. Although when I check for errors on the script it says that it doesn't have errors, when I test the movie I have a
couple of errors.
1046 Type was not found or wan not a compile...
1180 Call to a possibly undefined method
placeRandomPicture();

Here is my script.
var listLoader:Array = new Array(back_1, back_2, back_3,back_4, back_5);
bt_1.addEventListener(MouseEvent.CLICK,
function (evt:MouseEvent): void {
function placeRamdomPicture (): void {
var iRandomImage = Math.round (Math.random() *
listLoader.length-1);
iRandomImage = (iRandomImage > -1) ? iRandomImage : 0;
picHolder.addChild(new listLoader [iRandomImage]);
} placeRandomPicture();
});

View 15 Replies







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