ActionScript 2.0 :: Positive To Negative Numbers?

Jan 19, 2007

Whats the best way to flip variable:Number polarity from + to - and back.Is there an actual method, or do you just assign the var to itself...eg...

speed = 5;
speed = -speed

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Test For Negative Or Positive Numbers?

Nov 9, 2009

Is there a way to test if a number is negative or positive.I have some clips that position themselves on and off the stage. IF one moves in the other moves out the same direction the other is moving in. This also works the same in reverse. I'm trying to do this by checking the current clips position and see if its a negative or positive number. If its a positive then I can move it onto the stage and move the other off in the same direction. Maybe there is another way of doing this but I thought if I could check its value and see if its negative or positive it would be a start.

View 5 Replies

ActionScript 1/2 :: Rotation Positive And Negative Numbers?

May 12, 2009

I am creating a roulette type game that calculates the winning number based on the rotation of the main wheel. I am using if/else statements to determine the winning number based on the rotation. I am tracing the rotation in the output panel. I would like my rotation to go from 0-360, but the output panel traces 0-180 then it starts counting from "-180-0"
 
The wheel can spin multiple times. how to keep the numbers positive from 0-360 and not have to write my if else to accomodate the negative numbers?

View 5 Replies

ActionScript 3.0 :: Random Negative And Positive Numbers?

Feb 10, 2009

How can I create random numbers (negative and positive) ?Math.random() only produces numbers between 0 and 1.

View 2 Replies

ActionScript 2.0 :: Reversing Negative And Positive Numbers

Jul 9, 2009

I have a function set up to determine the speed of the mouse, if the mouse is moved to the left it is returned as a variable in a negative number. I also have a function to make a movie clip scroll along, at the moment if you set the speed to 3 it will move to the left. So a positive number will move the movieclip to the left So you can see my predicament because the numbers are opposite, is there way of reversing one of them?
Here it is in short

[Code]....

View 1 Replies

ActionScript 3.0 :: Generate Random Negative And Positive Numbers?

Mar 11, 2009

How can I generate random negative and positive numbers?

math.random generates only positive ones.

View 3 Replies

Actionscript 3 :: Convert Negative Into Positive?

Jun 1, 2010

i'd like to negate a number and would like to know if there's a built in method that will convert a negative number to a positive OR a positive into a negative, depending on the number.

i know about Math.abs(), but that only seems to convert negative into positive. is there a method that will do both?

View 3 Replies

ActionScript 2.0 :: Convert A Negative Number Into A Positive?

Nov 13, 2007

Is there a way to convert a negative number into a positive using actionscript?

View 5 Replies

Flex :: Change Style For Positive And Negative Values?

Jul 6, 2009

Is there a way to change the style of Flex Chart according to the values.For example, in column chart, set green for positive value and red for negative value?

View 1 Replies

Actionscript 3 :: Generate Random Positive / Negative Number?

Feb 7, 2011

How do you generate a Number that is randomly postive or negative?

View 3 Replies

ActionScript 2.0 :: Negative To Positive Random Number Range?

Aug 29, 2006

How would one produce a random number, ranged from say, -100 to 100?

View 3 Replies

Actionscript :: Create An XML Of Several Images (positive And Negative) But Can't Find A Program That'll Do That For Mac OS X

Jun 2, 2010

I have an object that I want to be able to recognize in AS3.There's a port of OpenCV for AS3 already, that works with Haars cascades, so now I need to create a cascade of my object.

From what I've read, I'll have to create an XML of several images (positive and negative), but I can't find a program that'll do that for Mac OS X.

Is there anything I can use that'll generate that XML on Mac OS X?

View 1 Replies

Actionscript 3 :: Turn Negative Number To Positive With Bitwise Operations?

Jul 16, 2011

Is there a direct way how to turn a negative number to positive using bitwise operations in Actionscript 3? I just think I've read somewhere that it is possible and faster than using Math.abs() or multiplying by -1. Or am I wrong and it was a dream after day long learning about bytes and bitwise operations?

What I saw was that bitwise NOT almost does the trick:

// outputs: 449
trace( ~(-450) );

If anyone find this question and is interested - in 5 million iterations ~(x) + 1 is 50% faster than Math.abs(x).

View 4 Replies

ActionScript 3.0 :: Getting A Movie Clip To Motion Tween From A Positive Value To A Negative Value?

Oct 13, 2009

I'm having a problem getting a movie clip to Motion Tween from a positive value to a negative value. I have two movie/buttons on my stage. When you click one the other movie Tweens from a y value of 0 to a y value of 400. That works fine. However, when you click the other button, the movie clip should then Tween from a y value of 400 back to a y value of 0. I cannot get this reverse tween to work.

Code:
// code for positive tween
function movePeople(event:MouseEvent):void {
movePlacesTween = new Tween(pageloaderB, "y", Strong.easeOut, 0, 400, 0.5, true);
}

[Code].....

The second tween never reverses. It just stays in place.

I've also tried the same tweens using the y value of pageloaderB... so tweening from pageloaderB.y to pageloaderB.y+400, which works, but the reverse does not -- pageloaderB.y+400 to pageloaderB.y.

why the reverse tween is not functioning?

View 1 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

Flash - Fastest Way To Get Negative Numbers?

Jun 10, 2011

Is there any Fastest way for this line?
ballAngelRadianVector = -ballAngelRadianVector;
And also this:
ballDegree = fee - ballDegree ;

View 1 Replies

ActionScript 3.0 :: Finding An Angle - Get Rid Of The Negative Numbers?

Jun 2, 2009

I have an object that moves to wherever the mouse is clicked, I need to be able to determine the angle at which it is moving like so

[Code]....

View 2 Replies

ActionScript 3.0 :: Negative Numbers As Target-value Of A Tween

Dec 13, 2010

I'm not sure if if this has occurred to anyone before.... I'm using the built in tween-class of flash (cs4). In my script I try to display a notification-box using a slide-in effect: var slideIn = new Tween(this.warningBox, "width", Regular.easeOut, 0, 150, 0.5, true); This works. The box is invisible at start and then builds up like a flag unrolling from left to right. However, what I really want to do is sliding it in from right to left. So I tried to do this: var slideIn = new Tween(this.warningBox, "width", Regular.easeOut, 0, -150, 0.5, true); Obviously, I modified the warningbox so the pivot point is to the top right, but it still won't work. It seems the endvalue must not be a negative number. Can anyone confirm this, or have I missed something?

View 3 Replies

ActionScript 2.0 :: Sort Array Correctly With Negative Numbers?

Jan 17, 2010

I'm Trying to sort an array firstly with QUANTITY then STOCK LEVEL using the code below. This is fine, the Quantity sorts perfectly but the negative numbers are reversed??

[Code]...

View 0 Replies

ActionScript 2.0 :: Negative Numbers - Counting Down From 9999 Instead Of Beginning At -0001?

Jan 30, 2011

I am currently taking a value from another source and splitting it into Thousands / Hundreds / Tens / Ones to drive MC's containing images of numbers. Originally I was using this external value to drive a dynamic text box and that was absolutely fine. When the external value went below zero the dynamic text box reflected this and started counting downwards ie 0 -1, -2, -3 ......-100 etc etc. However with the system I am now trying to implement when the external value goes below zero my counters show 9999 and count down towards zero.

For example the actual value of the external value = -32 but my counter system is showing 968. Always the sum of the actual value and my counter value = 1000. So again maybe actual value is -160 but my counter shows 840.Below is the section of the script splitting the external value (roundelevation) into 1000/100/10/1's

Code:
roundelevation = Math.round(scaledelevationMils);
EliThous = Math.floor(roundelevation / 1000);
EliHund = Math.floor(roundelevation / 100) - 10 * EliThous;
EliTen = Math.floor(roundelevation / 10) - 100 * EliThous - 10 * EliHund;
EliOne = Math.floor(roundelevation) - 1000 * EliThous - 100 * EliHund - 10 * EliTen;

I am using these variables (EliThous / Elihund) etc to move to different frames of mc's inside the Mc's each frame is an image of a number.It works absolutely perfectly when the external value is above zero and my counter is counting upwards / downwards. However as soon as it begins having to deal with the external value being a negative number it begins counting down from 9999 instead of beginning at -0001 and counting -0002.how to make this work when dealing with a negative input value and I really don't want to have to go back to using the font and dynamic text box approach.

View 4 Replies

ActionScript 2.0 :: Distance From Center - Output Distance Only In Positive Numbers

Jun 17, 2005

I am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.

View 1 Replies

ActionScript 3.0 :: Check If A Negative Number Is Less Than Another Negative Number?

Jul 17, 2011

check if a negative number is less than another negative number. The if condition logic seems to be in order as far as i can tell but it doesent work for some reason :

Code:
public function minuscheck(testnumber:int):void
{
if (testnumber < -1)

[code]....

View 6 Replies

ActionScript 3.0 :: Make My Var Always Positive?

Mar 14, 2012

I have a var that measures the distance my movieclip moves from its starting postion. the problem comes when it moves left on my stage and the distance var i created becomes negaitive.is there a way to make my var always positive, or find the absolute value of my var? here is my code

powerX = (JnowX - JstartX);the goal is to keep powerX positive

View 3 Replies

ActionScript 3.0 :: Convert A Number To Positive?

Dec 12, 2011

Does flash have any native function (maybe in the math library) to convert a number to positive. ie[code]...

View 2 Replies

ActionScript 3.0 :: Angle Between Two Vectors - Positive Values

Jun 22, 2011

When I'd like to know the angle between two vectors, sometimes I get negative values (radian or degree). How do you convert them so I always get positive values? Flash seems to have a strange system for calculating angles. I used the following code for doing this, but sometimes I get negative values.

Code:
public function rangedAngleBetween(otherVector:EuclideanVector):Number {
var firstAngle:Number;
var secondAngle:Number;
var angle:Number;
firstAngle = Math.atan2(otherVector.position.y, otherVector.position.x);
[Code] .....

View 2 Replies

ActionScript 3.0 :: Photo Gallery - Variable Always To Be Positive Whole Number?

Aug 21, 2009

I am building a photo gallery and I want my variable to always be a positive whole number, here's the code for the buttons using UIimage loader etc.

var dinnerImageNum:Number = 1
function forwardImage (evtObj:MouseEvent):void{
//adding to the variable number, dinnerImagenum
dinnerImageNum++;
[Code] .....

How do I make my var dinnerImageNum always equal to or greater than 1?

View 5 Replies

ActionScript 3.0 :: Generating Subtraction Equations That Only Return Positive Values?

Jan 21, 2010

create a random subtraction equation where the result will always be positive? For example, my current scripting will return something lilke 3-6=-3. I don't want equations like this- only postive answers

//random numbers//1.function randomNumbers(min:Number,max:Number)   var Results:Number=Math.floor(Math.random()*max)+min;  return Results;}
//2.new_mc.addEventListener(MouseEvent.CLICK, showRandomnumber);

[code]....

View 5 Replies

ActionScript 2.0 :: Generate A Variable Number Of Random Numbers Less Than 16 With No Duplicate Numbers

Nov 2, 2004

how to do this and not found much, so here goes:

I want to generate a variable number of random numbers less than 16 with no duplicate numbers

Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.

if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.

View 3 Replies

ActionScript 3.0 :: AIR Handling Large Numbers - Convert A String Having Numbers To An Integer

Feb 18, 2010

I am trying to convert a string having numbers to an integer.

//15 9's are there
var str:String="999999999999999"
var res:Number = new Number(str);

But it is not able to convert correctly as the the var res now has the value 100000000000000000. I know that the number has 52 bits of memory, then why is it not able to do the conversion?

View 6 Replies

ActionScript 3.0 :: Generate Four Random Numbers With Total Of 4 Numbers Equal To 100?

Feb 19, 2011

Generate four random numbers with the total of the four numbers equal to100?[code]...

View 8 Replies







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