here's where all you math genius' get to help me out. I know that this principal is not difficult and was taught sometime during my highschool years.I need a math formula which reduces the ratio of any x:y to the smallest quanity possible. Basicaly so that the smaller of the two numbers is 1 and the other number is whatever it would be, compared to 1... but, I need it to work for both posative and negative numbers.(I'm the ultimate Math newb.. bear with me)
so. I have x=20, y=20 is 1:1
-20, y=-10 is -2:-1
x=10, y=-5 is 2:-1
ect.
I am trying to create a Flash based website that runs full screen. It will have a series of still photos or possibly, a video as a background with a few menu buttons on top of them. What I don't understand is how to compensate for the various monitor aspect ratios. If I make it wide screen, a square monitor will show blank bars at the top and bottom. You can see an example of what I'm trying to do at [URL] Also, what is the optimal size to make the Flash video? I am running Flash MX 2004 (Version 7)
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?
I have an application, what playing server side playlists. The problem is: in the player (FLVPlayback) the videos with different aspect ratios displaying with the aspect ratio of the first video.
I have been watching too many peoples asking about various aspect levels for images and videos. Here is a simple demo to show your image/video with different aspect ratio levels. I hope the aspect ratio list is very tiny like, 3:2, 4:3, 16:9, 1.85:1, 2.39:1. Here is sample code:
Code: function setAspectRatios() { var widthR:Number = 2.39; var hightR:Number = 1;
I have a simple silly question that I've seen posted here a million times but now I can't seem to come across. Whats a good equation to keep aspect ratios on resize?
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?
When doing a gradient fill on an area chart, the gradient ratios are used only between the min and max of the chart. The area below the min is then filled with the last color in the gradient.
To make sure that it was using the ratios only between the min and max I inserted a zero (0) into the chart and the gradient expanded to the full height. I also checked the gradient values by creating a with the gradient fill.
How do i get the ratios to be effective through the entire fill not just between the min and 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?
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?
I have created a flash 3d racing game which relies heavily on AS3's Math functions (sin, cos, tan, asin, acos, atan). It also makes heavy use of Matrix3D and Vector3D functions. The game works great on a PC, but the cars flip around and display innacurate positions on Mac computers. I know this is an issue due to the note on the Math docs page: [URL]
which states: "Note: The Math functions acos, asin, atan, atan2, cos, exp, log, pow, sin, and sqrt may result in slightly different values depending on the algorithms used by the CPU or operating system. Flash runtimes call on the CPU (or operating system if the CPU doesn't support floating point calculations) when performing the calculations for the listed functions, and results have shown slight variations depending upon the CPU or operating system in use."
how do I get this game to work on a Mac? I've tried using lookup tables and inline FastMath style approximations. But lookup tables still create the same problem, and the inline approximations I have found are not accurate enough for my game. I've also tried rounding values with floating point errors, but that has not seemed to help (in my implementation) either. I think the specific problem is with the use of Math.atan. I have not found an accurate approximation for this.. but I maybe that is not even necessary.
What is math.round() do? In kirupa's Random numbers tutorial, he explained the use of math.floor(), but said round() was for another time. Yet I see that, and not .floor() in use in the random movement tutorial.
Envrironment: Flash CS3, AS3 I have a horizontal image scrolling project that I am working on, and it works but is not super smooth, I would like it to be smoother when it scrolls, and realize that this is a function of pixels scrolled over time and the FPS of the document.
Right now I am moving the items 1 pixel at a time on a timer with delay of 8 to get it to scroll at the speed I want. I am moving it at 1 pixel in order to catch exactly when an object should wraparound to the beginning of the scroller to show up again. So I don't know that I can really change the number of pixels moved to more than 1 and still have the images spaced perfectly, which makes me think I need to increase or decrease the FPS and or the timer delay to make it scroll smoother. Right now it is at 30FPS and as mentioned the timer delay is 8. Small changes to the delay is not a problem.
This is one aspect of flash i don't fully understand. I would really like to know how to figure this out so I can apply it to future projects as well without doing trial and error to make it smooth. Can it be function, like a way to figure out I need to move a 120pixel picture 60 pixels in 2 seconds, what should my FPS be and the picture size and movement size and number of seconds can be variables?
this math isn't working well. I'm using it for a rotated drag and drop (of a tone arm on a vinyl, a kind of abstract turntable simulation). Right now it just moves a bit in the middle of the vinyl (values between 21 and 36, is this degree or what unit is this?), but it should move between the two edges. The problem is that I don't know enough about trigonometry functions. Therefore I can't optimize the math for envisaged behaviour. Does anybody have an idea/tip how I can get a bit more control on the math and its effect? (maybe with more trace functions)
Set variable as numbers var monthly_num:Number = 0; var ttl_num:Number = 0; var ttl_rev_num:Number = 0; // user-entered numbers from an Input textfields monthly_num = monthly_txt.text; ttl_num = ttl_txt.text; // Multiply two user-entered number together to get new result ttl_rev_num = ttl_num*monthly_num;
Attempts to assign numbers typed into textfields to numeric variables causes errors. 1067: Implicit coercion of a value of type String to an unrelated type Number.
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.
I'm generating a random number between min and max with this code:return min + (max - min) * Math.random();And it works. However, the random numbers are very little usually between "1 or 3" even if the max is 80.
Some computationally intensive software are now using the GPU to solve mathematical problems. Now that flash has GPU support, is it possible to use flash to crunch math problems? How would it be done. In other words, does flash expose sufficient low level API to control the behavior of the GPU sufficiently to perform such a task? Example of problems; Find a message with the following hash: 2987432847298374298374982374
I think I broke my Flash. I'm using Flash CS5.5, and when I use AS3, any references to the Math class give me errors like this:1061: Call to a possibly undefined method sqrt through a reference with static type Class.1061: Call to a possibly undefined method pow through a reference with static type Class.1061: Call to a possibly undefined method pow through a reference with static type Class.The code in error is this:var dist:Number = Math.sqrt(Math.pow(initPos.x - pos.x, 2) + Math.pow(initPos.y - pos.y, 2));What the heck is going on here? Math is a top-level class, so I don't think I should be getting an error like this. Is it possible to somehow "break" the Math class? If so, how do I fix it?
I have an app (historical timeline) in which I am using one object (driver) to scroll another (driven) - like a scrollbox.There are limits on the movement of the driver, so I am using the % of the driver's movement to drive the % of the driven object's movement. It works fine on the ends of the driven, but I need to distribute the movement so that the driven object moves more at the end than at the beginning.Basically I need to multiply the % so that it moves from 0 - 1 non linearly.
I'm used to applying basic friction like this:[code]The problem is I don't know how to convert this to be described over time, so that can reduce the value based on the amount of time that has passed.Say I want to reduce the value to compensate for 1 second passing, or 500ms? How does that work in to the equation?
Strangely, the object flies up after a short while, meaning it floats up and down, but more up than down, even if the script itself is pretty straightforward.