ActionScript 3.0 :: Math Differences On PC And Mac
Jun 27, 2011
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.
View 2 Replies
Similar Posts:
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
Sep 26, 2005
Wat is the diffrence between these two?
View 2 Replies
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
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
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
Aug 13, 2010
I'm developing a simple Flash animation using Flash Professional CS5 and I'm writing some ActionScript code. I noticed there's a choice between using different versions of ActionScript.Wondering what the key differences are between 2.0 and 3.0...?
View 4 Replies
Sep 19, 2010
From a developer's point of view, are there other differences between Flash and AIR to take into account, apart from the certificate and AIR not supporting ActionScript 2.0?
View 2 Replies
Jul 18, 2009
I recently learned beginner grade skills for AS2 via Macromedia Flash. it had only AS2 so i thought i'd be good to programin that.well i completed my project (a minigame for a bigger game was the first time i programmed ever actually. Was really fun and you can find my "work" in the attachment) changing to adobe flash on the way its what the workstations in my u have. well i there saw actionscript 3 too. also, sometimes when i asked for help on here they told my i "should switch to as3" soon. now im about to work myself into as3 but first I'd like to know.what are the main differences and could someone show me a code in AS2 and the same code in AS3 or link me to a tutorial that makes good use of AS3 (possibily by using AS2 references to clarify the structures?)?why is As3 "better" than AS2?
View 9 Replies
Jul 11, 2010
i'm a student and have to code a flash game in AS2.0. I found a really good tutorial, which helped me to understand, how to code. The Problem is,the tutorial is written in AS1.0 and i don't know the differences between AS1.0 and AS2.0.
Code:
fscommand("allowscale", false);
fscommand("allowscale", false);[code]......
View 7 Replies
Dec 29, 2009
I used Jamie Durrant's tutorial for making a chat bot in flash. Everything works fine, but one thing which makes the bot remember people works only if the fla file is published in Flash Player 6 version. There are 4 symbols: a button, user, reply and custid: user is the textbox where the user inbuts the text, reply is the textbox that displays the bot's reply and custid displays the id of each person. If the version is newer than flash player 6 it says "undefined". It's a local shared object, I think. Could this code be edited to work in later versions or I have to stick with flash player 6 (the graphics are worse even at lossless compression)[code]
View 1 Replies
Nov 1, 2009
We have lots of log information (syslogs, database logs...etc) which is in CSV format. I need to present this information to key management about the activiites from the logs in Visual format but still has dynamic links. For the management sake, I need this application to be cross platform (Windows, MacOSX, Linux).What tool do I need to use Flash, Flex or (something else like Java)?
View 2 Replies
Dec 13, 2009
I have been moving over to JavaScript (esp. canvas) from Flash / Flex / ActionScript 3 (JavaScript is a more open platform), and I was wondering if anyone has any advice on differences between the two platforms, important things to note, pitfalls, optimizations, etc.
View 2 Replies
Sep 14, 2011
What are the differences between POST and GET methods of a URLRequestMethod ? In what context should we use them?
View 1 Replies
Jun 10, 2010
What are the differences between flex mxml and as3.
View 3 Replies
Feb 14, 2011
I have two text boxes on the same window. They are both set to Arial 14 Regular but they both appear very differently. To see what I am referring to: [URL] and go to the Conversion Tools at the bottom of the page. Click on Surface Finish and type in a value in the two different fields and click calculate. I really don't see anything that could be causing this difference in appearance.
View 2 Replies
Apr 11, 2011
I'm currently upgrading an app from Flex 4.1 to 4.5.We've noticed that the Arial font is rendered differently between the two versions when used at small sizes.Here's a simple app example:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"[code]....
When run against the 2 different sdks, here's an image of the font rendering we get:
Note that in 4.5 the font looks slightly squashed.
What's the cause of this, and how do we resolve it?
View 3 Replies
Apr 27, 2004
i've got a large video (48MB) that after 7% is loaded, it starts playback. on a pc it takes 10 seconds before it will start to play and it plays all the way thru with no problem. on a mac it takes 30 seconds before it will start to play and sometimes playback is choppy. why does this happen? what are the differences with playback of video on a mc and pc? is there some way i can get around this?
View 11 Replies
Jul 25, 2008
I'm not really good at figuring out how to do some things in Actionscript and I'm confused about looping throught functions with thins like eval. Here's my code :
[Code]...
I'm trying to loop to dynamically create functions. I have 5 boutons and I don't want to duplicate 5 times the same code. This code works but I don't seem to be able to use the same eval trick on the variable "blnBtn05". Anyone knows why and how can I be make it work?
View 4 Replies
Aug 3, 2010
What are the differences between POST and GET methods of a URLRequestMethod? In what context should we use them?
View 1 Replies
Dec 19, 2010
I found two difference that I feel might be important:
-If I decide to put the variables within a constructor, then I must have an object parameter for any function that wish to alter the variables, even if the code is internal to the class.
-Subclassing would cause the variables to not appear, something that causes problems when the class and any subclasses must have the variables in order to operate properly.
View 3 Replies
Aug 18, 2011
I am working on a project where I need to load a remote swf file into another using flash and as2. This should be simple, but the remote swf file is modular by design (i.e it needs to make calls to load other swf files into it) When I enter in the location to the remote swf file from a web browser it has no problem loading up. When I try and load the swf file using flash I get errors relating to the file system. It seems the flash being loaded into my flash is trying to load its other pieces and is looking for them on my computer.
[Code]...
View 1 Replies
Jan 26, 2010
I'm still struggling with memory-leak problems in the mega-project I talked about earlier (a children's fashion 'virtual showroom', where up to 600 videos and 3600 hires images can be viewed in one session).I'm monitoring memory use like this:
[AS]memory = Math.floor(System.totalMemory/(1024*1024)*100)/100;[/AS]
I cleaned up a lot of code, reusing objects whenever I can, and removing references (nulling) whenever I can, and I'm now at a point where memory usage is 'under control' on Windows machines, but not so on OSX machines.Results only vary slightly between various browsers on the Mac, and Firefox seems to perform the 'best'.The fact that there's such an obvious difference in memory leaking on Windows and on OSX, leads me to believe that my code is now okay, and that I'm hitting on differences in Garbage Collection-behaviour between the Windows Flash Player and the OSX Flash Player.Should I advice my client against the use of Macs (eventhough they just bought 60 MacBooks just to run this application on) because of this?
View 2 Replies
Sep 19, 2008
I have the following code,[code]This works great in Windows. Changes the color of the object.I tested in Mac too. It works great there too.But today I tested it under linux and the color isn't changed.I am using the latest flash player in all the testings.
View 1 Replies
Nov 21, 2010
I'm trying to hunt down some kind of class conflict I seem to be having when using TweeLite easing and found out the same code that errors in a document class works fine if I place it in the timeline. Example - this works in frame one of the timeline:
[Code]...
View 9 Replies
Mar 9, 2011
I had some code directly in the timeline that accessed/modified properties of some movie clips.
I then did the proper thing and moved the code to a Document class. I put the code that was formerly in the timeline into the document class constructor.
The issue I'm having is that if I access the movie clip properties "too soon" it reports that they are null. If I put the code in a timer event callback for half a second or so, or put an addFrameScript call with a frame of around 8 or higher, the movie clip references are valid and it all works.
So for some reason by the time the code in the timeline gets called all of the movie clip instances are valid. However, when inside of a document class constructor, they are not. I've tried using the ENTER_FRAME event callback but the movieclips still aren't ready.
The code is supposed to change some movie clip properties based on some loaderinfo parameters, so I do kind of need to set those properties before anything starts animating.
View 1 Replies
Jun 22, 2011
I need to convert Java regular expressions into Actionscript regular expressions. There apparently aren't any premade converters, so I'm trying to write one myself. Is there any resource that'd list all the differences? I'm aware of regular-expressions.info, but there doesn't seem to be a comprehensive listing of differences there.
View 2 Replies
Dec 15, 2011
I was wondering what's the difference between doing [code]However type 2 seems to work, but more people seem to reference type 1
View 1 Replies
Jan 20, 2010
I load a song and when I get the length the song never reach this value.Here is issue document by another guy AS3 - SoundChannel.position never reaches Sound.length.And here is my code
import flash.display.Sprite;
import flash.net.URLRequest;
import flash.media.Sound;[code]....
View 2 Replies
Feb 3, 2010
I've got to (quickly!) add an intro to an existing flash masthead on a site that I've inherited. I don't have access to the source .fla's, so I approached the problem by putting the intro in a wrapper swf and loading the current masthead and adding it to the display list on Event.INIT. So far, so good. (Incidentally, the swfs are built for flash player 9 and use AS3.)
The problem I'm having is that although the intro plays fine and loads / displays the beginning of the masthead swf, which is a loading animation, the masthead itself never actually plays. Essentially, my question is: what would cause an actionscript 3-based swf to behave differently when it's the child of another swf as opposed to at the top level of the embedded swf?
Potentially important details: Embedding is being handled with swfobject, and no flashvars are being passed in. There are two params, which are base: "/flash/" and wmode: "opaque". All the swfs and flash data live in /flash/. The flash elements (minus the intro I built) were constructed using the Inky flash framework, with which I'm not familiar.
UPDATE: I've reconsidered my approach to the problem and gotten it working by using ExternalInterface; I'm having the intro swf call a js function when it finishes playing, which swaps out the intro swf and replaces it with the current masthead (the approach is outlined here). I'd still like to know why I was witnessing the behavior I was seeing earlier, though, so any ideas and suggestions would be welcome.
View 1 Replies