ActionScript 2.0 :: When A Specific Variable Equals A Specific Value A Random Number Decreases On The Current Number?
Feb 20, 2008
i have a project and i need that when a specific variable equals a specific value a random number decreases on the current number, its easy to make it decrease but i need to decrease instead of 4 to decrease a maximun of 5 and minimun of 3.ere is the code :
Code:
numeroDeTazos = 20;
quantidade.text = numeroDeTazos;
if (nrfinal2 == 33)
{
[code]....
View 1 Replies
Similar Posts:
Feb 14, 2005
What is the best way to find a random number that is not equal to two specific values?
1) find random number (let's say from 0 to 5)
2) check if the result is not 4 or 5
3) If it is, run the random function again and again until the condition is met.
Or maybe there's a way to set up that at once (find random number that is not equal to 4 or 5).
View 2 Replies
Feb 14, 2005
find a random number that is not equal to two specific values? ex:
1) find random number (let's say from 0 to 5)
2) check if the result is not 4 or 5
3) If it is, run the random function again and again until the condition is met.
Or maybe there's a way to set up that at once (find random number that is not equal to 4 or 5).
View 2 Replies
Sep 18, 2005
lets say that when you click on a button the variable number goes up 1 or 2 but it picks it randomly
how would i do it
[Code]...
View 8 Replies
Jul 16, 2009
Dear Guys I Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It , Is There Any Solution
View 5 Replies
Dec 21, 2008
i got an easy question that i couldn't find the answer to. what line of code do i need to use to change 123.456789 to 123.45.
code
oldNum = 123.456789;
newNum = ???
View 6 Replies
May 22, 2010
Are there anyway to get number of frames in a specific scene? There's a totalFrames property of MovieClip class, but that's the total frames of all scenes.
View 3 Replies
Feb 6, 2010
How could I get a number of all same objects in array (lets say I have five "Grass" objects and ten "Wood" objects. Now I want to get the number of Wood objects.
View 6 Replies
Mar 25, 2007
Is there a way, or even better a class available in flash to help me round a number to a specific point. For example, I have need to have a number rounded to the nearest 15th, how would I do that?
View 7 Replies
Oct 28, 2010
I have 4 movieclips that are animated around the stage and a basket movieclip button as the home button in the far left corner. When I click the basket I would like to have actionscript animate those 4 movieclips into the basket with an acceleration in 20 frames. This I can easily do without acceleration as I can find out the current location of the movie clips, find out the distance between it and the basket and then divide it by the number of frames I need, and then use that as the speed. But to be honest I am not sure where to begin when I include acceleration. I have dabbled with acceleration in the past but not with a specific number of frames in mind.
View 2 Replies
Feb 6, 2011
I need to count how many instances there is of a spesific attribute in my xml-list.
Here is my xml-file where I need to count how many children where the attribute "hjorne" is "1":
Code:
......
<element>
<fortoyning hjorne="1" />
<fortoyning hjorne="1" />
[Code]....
But I only need the number 3 as the value of "ant_h1". How do I do that or is it an another way to achieve this?
View 1 Replies
Jun 1, 2011
If I had some numbers in an array, and wanted to calculate how many were below a certain value?
View 4 Replies
Jul 16, 2009
I Want To Generate A Random Number Between 2 Number BUT Without Generating 2 Same Number I Mean If For Example Already Generated Number "2" Next Time Did Not Generate It,
View 4 Replies
Nov 8, 2010
I'm having AS3 create 12 random var (play1, play2, etc) and then I ask it to average the 12 vars (numbers) until I get a specific average number. When I run this in AS2 I get the "script time error, keep running?" question. I tell it to keep running and eventually AS2 finds the right set of 12 numbers to equal a specific average number. In AS3 I get a "stack over flow error". I know that all my AS3 swf needs is just more time to find it.
View 12 Replies
Apr 3, 2012
If I load a txt file into my flash movie using the following...
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
[Code]....
I get my text imported and it splits it every time the letter 'a' is found. That's fine.
How would I go about counting the number of times that 'a' or 'and' (for example) featured in the text?
View 2 Replies
May 28, 2009
If there a quick way code wise of getting a dynamic textfield to count upwards to a specific number?
i.e. I have a global variable named: _global.num and this equals 30 and I want it to count from 0 to 30 quite quickly.
View 1 Replies
Oct 14, 2002
Is it possible to link to a specific part of my flash movie from an html page. Is there any way to link to a frame number or label? The site is html based, but the intro/home page is flash. I don't want users to have to see the intro every time they go back to the home page from somewhere else within the site. Is there something that I can append to my link on my html page to make it go to a specific frame in the swf?
View 3 Replies
Jul 8, 2011
how to get a movie clip to loop a specific number of times in Flash? I know how to stop a movie clip from looping by using the this.stop (); command by placing the command in a separate Action Script layer, in a keyframe, inside of the movie clip's timeline. This allows the movie clip to play through once and then stop. But I need for the movie clip to loop more than once, maybe 2 or 3 times, and then go back to the main timeline.
Also, is it possible to place a pause (I'm guessing, maybe by using a timer of some type?) between the loops, so that the movie will pause a couple of seconds before it loops again and then stop? Please note I do not need the movie clip to stop when there's an event like a rollover or anything. I just need it to play a couple of times, pause between plays and then stop and go back to the main timeline.
View 1 Replies
Jul 8, 2011
Does anyone know how to get a movie clip to loop a specific number of times in Flash? I know how to stop a movie clip from looping by using the this.stop (); command by placing the command in a separate Action Script layer, in a keyframe, inside of the movie clip's timeline. This allows the movie clip to play through once and then stop. But I need for the movie clip to loop more than once, maybe 2 or 3 times, and then go back to the main timeline.
Also, is it possible to place a pause (I'm guessing, maybe by using a timer of some type?) between the loops, so that the movie will pause a couple of seconds before it loops again and then stop? Please note I do not need the movie clip to stop when there's an event like a rollover or anything. I just need it to play a couple of times, pause between plays and then stop and go back to the main timeline.
View 2 Replies
Jul 14, 2009
i want to load and play a swf file form a specific frame number
So when a swf finishes i want to load another swf file from frame number 6430.
Is it possible or not
View 3 Replies
Aug 22, 2009
I'm having a problem in linking sub menu buttons to specific frames in that html pageYou can follow the sample site to better understand.f these submenu buttons to [URL]
View 1 Replies
Dec 6, 2010
The buttons are used to jump to a specific (root-)frame (based on a variable); they're all nested inside a moviclip, each on its own layer, and for every frame there's one button more showing (imagine a staircase). Now, is there a way for a script that works for all buttons without adding the specific frame number every time? I started working with
ActionScript Code: on (release) {_root.gotoAndStop(_root.VAR+3);} where VAR also defines, how many buttons are shown (eg. frame number of the button-MC). +3 is just for the frame number on root. That way, of course, all buttons eventually lead to the same frame, or more precise: only the last button shown will lead to the correct frame.
View 4 Replies
Aug 22, 2009
I'm having a problem in linking sub menu buttons to specific frames in that html page. You can follow the sample site to better understand. [URL] If you click on "Films" a submenu appears. I want all of these submenu buttons to link to [URL] but each go to a specific frame label in the .swf located within [URL]. For example:[URL]("equipment" frame label within .swf) or [URL]("tips and tricks" frame label within .swf)
View 1 Replies
Sep 9, 2011
I'm trying to create a shuffle button for my mp3 player. I don't want it to repeat any song in the xml playlist until all the songs are played. Is there to display a random number on the click of a button, without repeating any number in the array until all the numbers in the array are used?
View 9 Replies
Aug 9, 2005
my functions in this fla i have. I use the function to create a random number and the char move accordingly depending on the number.
View 4 Replies
Nov 24, 2009
ActionScript Code:
var numbers:Array = [];
var newNb:Number;
var max:Number = 81;
[code]...
View 6 Replies
Jan 9, 2010
Im trying to do a hittest on a random movieclip... basically i have 4 'objects' and i am picking a random number to pick one of them... this is all fine except when i try to do a hittest on 'object' + randomNum...Below is the code that works first with a trace that is kicking out the name i want, and below is the code ive tried but doesnt work...
Code:
var randomNum:Number;
randomNum = Math.round(Math.random()*3)+1;[code].......
View 2 Replies
Dec 30, 2008
i want to make random number between 1 to 10 without repeat number twice or more i use this function to make random
function getRandomNumber(min:Number, max:Number):Number
{
var randomNumber:Number = Math.round(Math.random() * (max - min) + min);
return randomNumber;
}
getRandomNumber(1, 10);
View 2 Replies
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
Aug 20, 2009
the variable Im interested in is numSound which at the moment is a random number between 1 and 5, but it repeats too much and a sequence would be fine. I know very little actionscript and nothing I have tried works,the code, or what seems the relevant code, is
Code:
private function randRange(min:Number, max:Number):Number
{
[code].....
View 2 Replies