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


Similar Posts:


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

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 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 :: Reversing Momentum With Collissions

Jun 14, 2009

I'm having problems getting my player to switch directions and just bounces off of the walls of the stage. I tried reversing the rate but it still shoots off into the distance and this is what I have now, it just stops the guy at the edge and nothing more. Does anyone know how I can properly make him bounce?

[Code]...

View 8 Replies

ActionScript 2.0 :: [CS4] Controlling And Reversing Animation On The BG

Jul 2, 2011

I'm trying to do the following:

1. Have a permanent animation on the background, running over and over again.

2. My buttons should control that animation. What I want to do is to reverse the animation (going backwards on the timelime) when the user press the button, no matter in which frame the animation is.

3. Finally, when the animation is "gone", the buttons must point to an specific label.

I'm not sure how to to the reverse motion thing and if that's possible usings AS2. BTW, I'm attaching the file (just 8Kb) to show the idea, the real animation in the background is gonna be a movie clip but it's heavy to upload and I don't believe anyone will download it.

View 0 Replies

ActionScript 2.0 :: Reversing Animation Using A Function?

Mar 11, 2007

I have an mc which when rollOver plays an animation (works like a button), on rollOut I want the animation to play in reverse... I have seen it done before using a fucntion, but can't seem to get it to work... If I just reverse all the frames and get it to play that on rollOut it doesn't work properly...

View 14 Replies

ActionScript 2.0 :: Reversing An Array's Contents?

Jul 17, 2007

I seem to be having trouble reversing the contents of an array

this is the code:

Code:
stop();
// Attributes arrays
var nd:Array = new Array();

[Code].....

i've tried changing the 'for' loops for both the 'n' and 'i' variables to decrement them and also tried idnum.reverse(); but i can;t get it to work.

It's a news page so i'm basically trying to get the newest story(which is attached to the highest id number in the databse) to post first and then post the rest in descending order.

View 2 Replies

ActionScript 3.0 :: How To Reversing Frame Animation

Apr 1, 2009

I have a 23 frame animation that is moved forward or back on a mouse over. The problem is trying to reverse it. It is ok until it gets to frame 1 then it just stops. I need to get it to jump to frame 23 and to start reversing aagain.

function reverseIt(e:MouseEvent):void{
rewind = true;
this.addEventListener(Event.ENTER_FRAME,revFrame);

[code]....

View 1 Replies

ActionScript 3.0 :: Reversing Movie Clip?

Apr 21, 2011

I am trying to have a small simple animation. This animation needs to have a roll over listener. This roll over listener must begin a downward motion for this movie clip. And then another listener must be a click or rollout that will make the clip reverse and begin an upward motion at any point that it is executed. This is the code I got so far, but the only thing that seems to work is the rollover downward motion. I cannot seem to get the upward reversing motion to execute.

stop();
mc.addEventListener(MouseEvent.ROLL_OVER, playy);
function playy(e:MouseEvent):void

[code].....

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

Button On Movie Clip Reversing Frames?

May 29, 2009

I make a button with some animated effects. On main work area I select object and press F8 to convert button with the name of (button1). The Up as it is which I make: w=70, h=50. Press F6 and same button on Over, here I again select object and press F8 and convert to Movie Clip. Here I insert 10 frames, one by one the button extend width and height. On 10th frame the button size 110x90 width and height. To animate and stop the button I put "stop" action on frame 10.I want that if the user's mouse over on button than the 10 frames play as I mentioned above but if the user don't want to click on (button1) than all of these 10 frames play reverse or add more frames and button will go to their original size and place. Is there any script bcuz I am new and don't know about action scripts.

View 1 Replies







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