ActionScript 1/2 :: Math - Formula To Change A Number

Dec 24, 2011

how to convert it to 0 and also if the number wsa 9, convert it to 1, and if it was 8 it gets converted to 2.. and so on.. where if it was 0 it would then be 10 Is there a formula? The 0 to 10, and 10 to 0 may not be possible but that's ok.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Math Formula Conversion?

Jun 21, 2011

I'm not that good with Math and i have a formula for a that it's universal from what i understood but i dont know how to transform it to work with Flash's Math API. 

View 2 Replies

ActionScript 3.0 :: Formula For Calculating "true" Isometric Tile Row/number?

Nov 18, 2010

I'm trying to do a isometric game, diamond shaped stage. And want to know how the formula for translating the mouse position over a tile into the correct row/column of it.

[Code]...

View 7 Replies

ActionScript 3.0 :: Math Random - Getting Number Between 10 And 70?

Jul 8, 2009

I don't get it. I know it's Math.random(), but how do U use it. Let's say I want a number between 10 and 70.

View 4 Replies

ActionScript 2.0 :: Math - Find Out If Number Divisible By 6?

Aug 19, 2007

I have a for loop that arranges icons in rows, and I want 6 icons per row. The number of icons is variable. So I was thinking that if I can find out how to test if a number is a perfect multiple of 6 (or 7, I suppose), I could then add a line in the loop that changes the _y value of the thumb to a higher number and resets the _x value to 0, thereby creating a new line. how do you test to see if a number is round?

View 4 Replies

ActionScript 3.0 :: Adding To (Math.random() Within A Number Set?

Apr 29, 2010

I have created a tween with actionscript that moves a movie clip of a cityscape along the x axis whenever the mouse is clicked.

This is my code

var skylineTween:Tween=new Tween(skyline_mc,"x", Regular.easeInOut, skyline_mc.x,Math.floor(Math.random() * (-1022 - -16) ) + -3,2,true);

Right now it generates a random number from between -1022 and -16 (positions along the x axis).

However, sometimes the skyline movie clip only moves a few pixels and looks boring.

I added 200 pixels to the movement (Math.random() * (-1022 - -16) +200 ) and it looks better. However, sometimes this slides the movie clip past -1022 or -16 and off the stage.

How can I set the value to +200 without passing -1022 or -16?

View 0 Replies

ActionScript 2.0 :: Math Quiz - Generate Multiple Of First Number

Apr 20, 2009

I am trying to develop a maths quiz where I need to generate a random number, I then need to generate another random number but this needs to be a multiple of the first number. I just can't work out how I can generate a multiple of the first number.

View 2 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 :: Avoid Math.random() From Looping The Same Number Twice?

Nov 26, 2011

I'm trying to play a random gallary image by making it stops at different frame every few seconds, and the actions is completely random.

The problem is, since there are only 5 different images(5 frames) I'm displaying, there is a high probability that it stays at the same frame, how do I avoid that? Like avoid staying at the same page twice, if not run the function again.

[Code]...

View 4 Replies

ActionScript 2.0 :: Getting Math.radom To Load A New Number After Every Keypress?

Oct 17, 2005

Alright,I have the MC I wanted to move everytime "A" is pressed now. But I still have one more question. Right now I have a random number generated between 1 and 10. Every time that "A" is pressed my horse (for the game) moved across the x axis in an increment between 1 and 10 (the random number). BUT the problem I'm having is that when the "A" button is pressed it loads a random number and uses that number over and over when I press the "A" button.How do I get it to load a new random number everytime "A" in pressed?

View 3 Replies

ActionScript 3.0 :: Convert String Math Equation To Number

Oct 9, 2009

I was wondering if there was a way to convert a string containing math symbols such as +,-,*,/ and numbers. I am building a calculator.I have a string variable that I keep appending the value of the button.In the end the string looks something like this 8+3+3-4*9.I was wondering if there was a way to solve the equation just using the information in the string. I tried setting a Number to the string and I would get NaN. The hard part about this is trying to count for the math oop i.e Multiplying before adding.

View 1 Replies

ActionScript 2.0 :: Use Math.Round To Ensure That ALL Text Boxes Are On Whole Number, X,Y Coordinates?

Apr 20, 2004

Is there a way to use Math.Round to ensure that ALL text boxes are on whole number, X,Y coordinates?

View 4 Replies

ActionScript 3.0 :: Math To Get Width Based On Z-axis Change?

Oct 14, 2009

Does anyone know the formula to determine what the width of a Sprite would be based on changes to the z-axis?  I know the width property is updated after the change, I'm hoping to know what the width will be pre-change.

View 1 Replies

ActionScript 3.0 :: Change The Frame In The MC Math.atan2 According To The Direction It's Facing

Dec 14, 2009

I've got a movieclip which follows a predefined path (like in those tower defense games). Normally the mc changes the direction it faces with Math.atan2 method and then rotates the movieclip, but because this game is in a tilted view( in stead of directly from the top) I need it to change the frame in the MC according to the direction it's facing.

Is it possible to read out Math.atan2 method data, and then change the frame the MC is displaying, according to this data? I used [URl]...on-and-realism as a base for this game. If Math.atan2 method

View 1 Replies

ActionScript 2.0 :: What Value Is Seeded To Math.random() To Generate The Random Number

Nov 18, 2010

1) what value is seeded to Math.random() to generate the random number?

View 2 Replies

ActionScript 3 :: Flash - Math.floor Acting Like Math.round?

Mar 7, 2011

Here is the problem:

var p:int = 0;
var n:Number = 0;
n = 32.999999999999999;
p = Math.floor(n);
trace(p); // returns 33
n = 32.11111111111111;
p = Math.floor(n);
trace(p); // returns 32

I would expect both of these to return 32. I have searched, and it seems this is an unreported bug in AS3. Or ... am I doing something wrong?

View 4 Replies

ActionScript 2.0 :: Math.round() - Round A Number To 4 Digits

Mar 27, 2005

how do you round a number to 4 digits... so 3.45356345345 is 3.456 and 1 is 1.000

View 5 Replies

ActionScript 2.0 :: Create A Random Number Without Using Math.random()?

Feb 5, 2010

How can i create a random number without using Math.random() I think this can be done with a array... i just don't know how.

i need it for a google banner. they don't allow Math.random() of random() in the sript

View 2 Replies

ActionScript 2.0 :: What Is The Diffrence Between Math.floor And Math.round

Sep 26, 2005

Wat is the diffrence between these two?

View 2 Replies

ActionScript 2.0 :: [F8] Math.round And Math.ceil?

Feb 16, 2009

I have a code in which I have to use Math.round if a certain value is for example 3.67 (67 is higher than 50) and Math.ceil if a value is for example 3.23 (23 is lower than 50). What can I do to make flash calculate if what after the dot �.� in 3.23 (for example) is higher than 50?

View 2 Replies

Actionscript 3.0 :: Math.cos - Change Arithmetic Positive Progression To Negative Progression

Jul 20, 2009

Code: Select allimport caurina.transitions.*;
addEventListener(Event.ENTER_FRAME , kop)
function kop(e:Event):void {
dot.x = mouseX ;
dot.y = mouseY ;
[Code]... 

What i done there i draw a box and made it to movieclip and instance named it hook and created a invisible dot and called it dot. Then I calculated distance from box to the mouse then i took that number and put it in Math.cos command. And finally i made tweener to change box scale depending what my mouse distance from it.So if my mouse is close the box is big , if far - box is small. Ok, I want to know is there another way to do this ? Cuz , i cant think of other way to change arithmetic positive progression(like 3,6,9,12) to negative progression(like 12,9,6,3) than Math.cos command.

View 5 Replies

ActionScript 2.0 :: Math.min And Math.max?

Jan 16, 2004

So here is a piece of code that I have seen used a lot but don't really quite understand:

myVar = Math.min(Math.max(myVar, this.min), this.max);

or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.why this is done? And how do you know when to use it?

View 3 Replies

ActionScript 2.0 :: Math.min And Math.max

Jan 16, 2004

So here is a piece of code that I have seen used a lot but don't really quite understand:[code]or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.And how do you know when to use it?

View 3 Replies

ActionScript 2.0 :: Change Number To Negative?

Jan 25, 2009

how to turn a variable number from positive to negetive using AS2? eg:

Code:
myVar1 = 40;
//use code to change to negetive number
myVar1 = -40;

View 4 Replies

Why Does 'x' Property Change To Crazy Number

Aug 31, 2009

I was just working in a Flash file, and an mc was in the top left, with an x vale of around 12px.I copied and pasted that mc into another file, and when I looked back at the first file, the x value was 448.6px.

View 3 Replies

ActionScript 3.0 :: Change The Number Of Images?

Jul 20, 2011

I was wondering if there is way to replace the checkNumber() function with a more flexible code. That will allow the user to change the amount of images in a folder.

Lets say i have 7 images in a folder (gal1) that im showing in a simple gallery.

What i wish to do is to be able to add or delete or change the number in the images in the folder without having to change the acctual code.

if(imageNumber==7) is rather hard, how can i make this more flexible to allow for the changes?

Code:
next1_btn.addEventListener(MouseEvent.CLICK, nextImage);
var imageNumber:Number = 1;
function checkNumber();void{

[Code].....

View 2 Replies

ActionScript 3.0 :: EventListener For Var Number Change?

Jun 1, 2010

I have 3 buttons that increase/decrease the var 'StressPercent' and this in turn shows the new number in a 'Stresslevelbox' text box. How do I now add an EventListener for when the 'StressPercent' var changes?

Code:
var StressLevelbox:TextField = new TextField();
StressLevelbox.text = "Stress";
StressLevelbox.x = 10;

[Code]....

View 2 Replies

ActionScript 2.0 :: Change Text On Frame Number?

Oct 12, 2010

I want to change the text of a dynamic text box based on the frame number. [code]...

View 4 Replies

ActionScript 3.0 :: Number Addition On Data Change?

Aug 17, 2011

how can I add number to a current variable in actionscript. My variable has data coming though php(numeric data) so I want to create an if statement to say this:

If the data number(let's use 5) is equal to 5+any number then do something.

Should be pretty simple but I can't seem to figure it out right now, how can I say "any number" with code?

ActionScript Code:
if(myVar == myVar+1){
//do something;
}

Thing is the + number is uknown... so + 1 may not work cause the number may be higher than 1.

View 4 Replies

Change Frame Number Of Graphic Instance?

Nov 19, 2005

I'm stuck on this annoying bug of Flash:to animate a character i have different graphic symbols of hand positions inside a single container graphic symbol; that way instead of having to swap different symbols while animating and tweening, i just have to change the number on the "single frame" input box on the properties of the symbol.

It worked fine a few sessions ago, but now it won't let me change the frame number if there's a tween before that keyframe; tha keyframe isn't participating on any tween, and may even have some frames between the previous tweening one. The only way it will change is if i remove the first tween or add a blank keyframe between them, wich of course isn't an option when animating... i know it would work if i add a new layer and continue there, but it'll add a lot of mess to the already busy timeline.

The strange thing is that it remains working on some frames, from the previous session, and if a cut and paste them i can change the frame number freely; but if i try to build a secuence from scratch, it won't let me, even on a new document.

View 2 Replies







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