ActionScript 2.0 :: Weirdness In Math.floor - Get A Decimal Return

Jan 28, 2008

project width is 500

tile_width=25;
map_collumns=Stage.width/tile_width
trace(map_collumns)

Sometimes I get a decimal return. Then, when I close it,and run it again, it shows the correct answer.

View 10 Replies


Similar Posts:


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 :: What Is The Diffrence Between Math.floor And Math.round

Sep 26, 2005

Wat is the diffrence between these two?

View 2 Replies

ActionScript 3.0 :: Math.floor Vs Bit Shifting Vs Int

Aug 17, 2009

I just ran some tests on round numbers.In preparation for getting max performance from AS3, I want to test as many areas as possible.All I did was generate a rounded random number a million times per frame, and record the time step in milliseconds.[code]Now the strangest part is having a non rounded random number generated a million times per frame netted an average time of 195 milliseconds, faster than using int as a random number. It must simply be that because Math.random isn't returning an integer, some form of conversion of taking place for your variable to be an integer.

Incidentally, using a Number instead of integer for the looping variable decreased performance minimally, just a few milliseconds.So simply having your variable as an integer, and using no rounding at all produces the fastest results if you want a round number.Remember though, there are many other areas in Flash to dramatically increase performance. Being that we're talking about a million iterations per frame, the difference in performance is not exactly dramatic here. One is not even twice as fast as another, over a million iterations.

View 5 Replies

ActionScript 2.0 :: Math.floor Function Is Not Working

Apr 16, 2007

For some reason my math.floor function is not working (trace yields "undefined")..[code]

View 2 Replies

ActionScript 2.0 :: Math.floor - Round Down To Nearest 10th

Mar 12, 2008

I want to round a whole number down to the nearest whole 10th. Like 52, becomes 50. Or 49, becomes 40. Or 2005, becomes 2000. Does that make sense? I imagine it has a math.floor approach, but I can not figure it out.

View 5 Replies

ActionScript 2.0 :: Math To 2 Decimal Places?

Jan 3, 2004

Im thinkn' its around but I just cant search it...Sooo....What is the Math.???? for making a number always have 2 decimal places?

View 5 Replies

ActionScript 2.0 :: Math Show Whole # + 1 Decimal?

Sep 9, 2008

I can't remember how to do this. I have a set of numbers that are esentailly like follows:

323.3434456764
4.349075639
5654.64547290477347

I need to truncate the number to show the whole number as well as the first decimal value. So like Math.floor, but truncating one decimal place.

View 1 Replies

ActionScript 3.0 :: Using Math To Round To 2 Decimal Cases?

Oct 10, 2009

I have this number

2,555555556

and I want to round it dynamically into 2,60 how can I do this in flash?

View 1 Replies

ActionScript 2.0 :: Rounding To 2 Decimal Places With Math.round Function?

Jun 16, 2002

How do you round a number to 2 decimal places using the Math.round function?

View 3 Replies

Professional :: Create A Simple Floor Plan That Highlights Where The Computers Are On The Floor

Mar 31, 2011

I am trying to create a simple floor plan that highlights where the computers are on the floor.

1. Each computer has a name for e.g. Comp1, Comp2, Comp3 etc.

2. The computer names are in a list on the left hand side.

3. On the right hand side is the simple floor plan with computer images (or clipart)

This is what is expected:

1. As the mouse is mover over the item on the list, the computer associated with it must light up (or highlighted) For e.g. when the mouse is over Comp1 in the list then computer1 image (or clipart) on the floor plan must light up

2. When the mouse is over a computer on the floor plan, then the associated computer name in the list must light up For e.g. when the mouse is over computer2 image (or clipart), then Comp2 in the list must light up. I was trying to get some ideas from [URL]. I was able to make the image for a computer. It doesn't go far enough to tell me how to accomplish the above. Using Excel, I did this nearly five years back, by putting the clipart in specific cells and hyperlinking them. Now we want to make it available on the web.

View 5 Replies

ActionScript 2.0 :: Return Value With Decimal And Comma

Jan 31, 2011

I am VERY new to Flash and Action Script (using Flash 8 & AS2) and my company butchered by training budget so I have zero $$s to learn. I have been muddling through with these great forums and tutorials but this has got me stumped.I have a button to calculate some simple math from number stepper components to populate dynamic text boxes.The script I came up with works but I need the return values to have decimal (2) and comma (at the thousands).[code]

View 3 Replies

ActionScript 3.0 :: Math.random Twice, And 99% Of The Time They Return The Same Value?

Nov 11, 2010

i have a problem with Math.random().here is part of the code:

PHP Code:

//FIRST PLATFORM
 if (P1.vy > 0 && d1 <= 0)
{[code].....

as you can see i have Math.random twice, and 99% of the time they return the same value...

View 7 Replies

Flex :: Return Multiple Variables From Math-crunching AS3 Function?

Nov 9, 2011

I'm new to Actionscript programming. I'm trying to figure out what is the best way to return multiple variables, each having a different data type, from a function. For example, if a function needs to return variable aa ( a string) and variable bb (a number).

The function I'm using just crunches a lot of math, and doesn't relate to an object in a GUI. One method I got from a Google search used an Object, but as (I think) this requires me to create a class, I wondered if there was a simpler way. Since an array can hold elements of different data types, perhaps this is a simpler approach (?). [code]...

View 2 Replies

ActionScript 2.0 :: Math.atan2 Woes - /supposed To Be 90 Degrees But It Return 0?

Mar 31, 2004

Code:
function rtd (rad) {
return rad*(180/Math.PI)
}

trace(rtd(Math.atan2(0,10))) //supposed to be 90 degrees but it return 0

trace(rtd(Math.atan2(-10,0))) // supposed to be 180 but it also return 0

what to do?

View 1 Replies

Flash :: Math "Rate Of Return" Forumula?

Nov 22, 2010

Here is my formula, Not getting the right output.... I am looking for the monthly payment someone would have to contribute (with a rate of return %) to get their "Future Value"!! I am doing something wrong.. I believe it is really simple..

[Code]...

View 1 Replies

ActionScript 2.0 :: CreateTextField Weirdness?

Mar 19, 2005

When I load an external text file it takes two clicks of the button to get the text to loadThe first click is blank the second click loads the text.

Here is the function:
// Create TextField and load text
function makeTxtBox(txtFile, textVar) {

[code].....

View 6 Replies

ActionScript 3.0 :: MovieClip Resizing Weirdness?

Feb 25, 2011

I have a movieclip in an external swf, called menubg. In the library properties tab, it reports the size as 1024x768.I use an embed statement to pull the movieclip from the swf at compile time. It comes in just fine (as a Sprite since that seems to be the only way to instantiate an object from an external swf), you can see it without a hitch, but tracing out the size info does not return the same WxH as the original.Here's some code, and the trace outs

var mbg:Sprite=new wpa_menuBG;
trace(mbg.width,mbg.height); // 1028.95 777.95 --  that's not right
// the screen container[code]......

View 5 Replies

ActionScript 3.0 :: TextField Formatting Weirdness?

Feb 16, 2009

I'm building (see: struggling through) my first timeline-less app based on currentTarget and arrays.

I've run into a situation where my text fields will format text properly if called at load, but will not do it on a MOUSE DOWN; they just load plain text on the click.

[Code]...

View 2 Replies

ActionScript 3.0 :: Modulo Weirdness When Using Decimals?

Feb 23, 2010

I'm trying to do a pretty simple modulo equation but i'm getting a weird return.0.03 % 0.01I was expecting there to be no remainder, so the answer would be 0. However the return flash gives me is: 0.009999999999999998If I bump everything up to whole Numbers it works just fine: 3 % 1 = 0However I know eventually I'll be doing something like 3.4 % 1 and I'm concerned that at that point I'll run into this same issue.

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

Flash :: ActionScript 3 Start Drag / Sprite Weirdness

Oct 27, 2011

I have a match game, drag and drop a word to a definition. The flow of this game is that after you have answered you click a button and then the game removes the right answers and redisplays the wrong ones. So far that works, what doesn't is that after the answer portion and I put the wrong words/definitions the drag doesn't "visually" work. when i run in debug the drag is firing, but the object doesn't move on the screen. it also doesn't hit any target (which seems obvious). I never destroy the object.So As far as I can see the mouse events should still be working. example can be found here: [URL]

View 2 Replies

ActionScript 3.0 :: Flash - Sadistic Textfield Writes Text Over Previous Update Weirdness?

Mar 5, 2011

I tried something which was very simple in AS2, attaching dynamic movieclip and then attaching dynamic textfield inside that MC, which should update on progress event for loading an image, displaying percentage of loading done. Surprisingly, I have no problem with displaying accurate percentage info, my problem is this: most of the updates of textfield.text writes itself OVER the old text, instead of replacing it. Hehehehehe, LOL! You get it? It behaves like I create new textfield over the old one each time I update text. And I'm sure the code is not recreating textfield or MC, at least I'm positive thats not what I told it to do. So although I'm a bit new to AS3, and may probably doing something wrong, I'm getting more and more suspicious that this is a bug within flash itself, the thing that should not be.

It will be hard for me to recreate the code here, as I tried many different things in the meantime, so I'll just show bits of latest version which doesn't create totally dynamic MC and textfield, but attaches dynamically MC containing textfield which is inside library. The problem remains the same, and I'm sure I compile/upload latest swf version and clean browser cache everytime...Code://btw, timeline is public static MovieClip, which is like root,//and containerMC is public static MovieClip which is attached separately//Also if you see something without being declared as var, be sure its a static property declared in class

//func called after thumbnail button is clicked to open image
public static function prepareImageOpen(imgObj:Object)
{

[code].....

View 1 Replies

C# :: Build Interactive Floor With Projection?

Jan 15, 2011

is there any lib or api out to deal with this ? EVEN, if there is any resource , article from another language c++ , c , .. i just didn't have enough time to test lot of ways

If you search interactive floors , or interactive floor projection you can find some companies who provide such a thing

View 2 Replies

ActionScript 3.0 :: Papervision3D Lag With Map Floor And Test Sprite

Aug 10, 2009

I'm not sure if this is directly hardware related or not. I've just started playing around with papervision 3d and I threw together this map floor and test sprite to see how it would look. The problem is, whenever I have a large portion or the map in my viewport, it lags. I was just wondering if maybe:

a) My code is horrid
b) My computer is a piece
c) Papervision3D is just bad for 3D

I mean the concept is simple, there's nothing fancy going on and I'm only using planes. Maybe it's because I'm using 25x25 of them? Is there a better path to use 3D than paper3d? Anyways, here's the code.

ActionScript Code:
//import files
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.special.*;
[Code] .....

View 2 Replies

ActionScript 3.0 :: Floor Not Recognised By Character Movement?

Feb 8, 2010

I am designing a character to move right and left but the character is not recognising the floor movieclip and is falling straight threw the floor.I have attached a zip file with the flash document sample and associated Actionscript file.

View 2 Replies

Professional :: Creating Interactive Floor Plans In Flash CS4 Possible?

Apr 29, 2010

Is it possible to create interactive floor plans in flash CS4? Are there any tutorials out there to do this?

View 1 Replies

Make An Interactive Picture Scroll With Reflective Floor?

May 17, 2010

I WAS WONDERING HOW TO MAKE AN INTERACTIVE PICTURE VIEWER IN fLASH LIKE WHAT APPLE HAS IN LEOPARD AND SNOW LEOPARD.  FOR EXAMPLE, WHEN THE PICTURE IS IN FRONT OF YOU AND YOU CAN SEE OTHER PICTURES BESIDE IT BUT THEY ARE FURTHER AWAY AND YOU CAN SEE THE REFLECTION ON THE FLOOR OF IT  IS THIS A POSSIBILITY IN fLASH?

View 2 Replies

Flex :: Image - ARCGIS Overlay Floor Plan Png

Oct 25, 2010

We have floor plans of a building in the DB in PNG format. We am using arcGIS flex api. We want to build something like [URL] How can we load my building floor plan onto the arcGIS flex map.

View 1 Replies

ActionScript 2.0 :: Game - User To Fall When He Is Not Touching A Floor?

Mar 28, 2004

im making a game but im already having trouble with the first code, i just want the user to fall when he is not touching a floor....i put this code on the user:

[AS]onClipEvent(enterFrame){
if(falling=true){
this._y=this._y+5}[code]....

theres is no errors but it doesnt stop when it hits the floor

View 4 Replies







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