Flash - Float And Math Precision On Different Systems?
Jan 31, 2011
I want to implement a gameplay recording feature in a project, which would only record player input and seed of the RNG at the beginning of the level. Then I could take such record and play it on my computer in order to test it for validity.I'm only concerned with some numerical differences which might appear between different Flash Player version, Operating Systems or CPUs (or whatever else that might be affected). The project would be written for Flash Player 10.0.0+. What stuff I am concerned with:
[code]...
I won't be using stuff like hitTest, getObjectsUnderPoint, hitTestPoint, getBounds and so on, all collisions will be geometrical.So, are there any chances that using any of the pointed things above will yield different results on different systems? If so, what can I do to avoid them?
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?
The following will ensure that any large numbers will only be precise to the hundredths place (related to this answer):
public function round( sc:Number ):Number { sc = sc * 100; sc = Math.floor( sc );
[Code]....
What is the optimal way to round my numbers to the precision of .05? Is there something clever to be done with bit-shifting to get this result? For example, I would like:
I'm loading a toolbar that goes over the content of a website that is reviewed. The toolbar has some information we can fill in about the website we're reviewing. There is a problem when there's flash embedded in the original page. Our toolbar will show up behind the flash movie, so we can't use the toolbar as intended. Since we don't have control over the page that is loaded we can not alter the settings of the embedded video.
The question is: how can we make the DIV appear floating above the FLASH even though we don't have control over the embedded flash object?
I'm using BlazeDS to marshall Java objects to Flex. What I'm seeing is that if a Java Float holds a integer value (whole number, such as 123), then it gets marshalled to a ActionScript int. I would expect that a Java Float always gets marshalled to an ActionScript Number as documented in the BlazeDS Developer Guide.
Is there a way to configure this or is this just a BlazeDS bug? Follow-up: The float is contained within a map. The Java map that is being passed to BlazeDS looks something like:
[Code]...
So it's serializing the value correctly, just as the wrong type.
I got it from a code that make ball falling from top to bottom and i analysis that is this code that make it work. I wanted to change the code to make float from bottom to top.
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?
I am doing a custom function like TweenLite.to, but there is one problem. I cast that function on many objects. And they all move a little bit differently. It only happens when I don't do Math.Round(bonus_move). If I use numbers for example 0.58. It moves every stage child differently on about - 0.05.
Here's my function: Code: Select allpublic function moveTo(child, speed, px, py){ // configurable var movement_accuracy = 20; var delay_duration = 2/(movement_accuracy/10) ; var movement:Timer = new Timer(speed*12.5*delay_duration, movement_accuracy); movement.addEventListener(TimerEvent.TIMER, timerListener); function timerListener (e:TimerEvent):void{ [Code] .....
If anyone would please post everything they can about particles and particle systems, including tutorials, source files, links, movies, comments, help, and code, I am trying to learn about particles and particle systems, but I can't fin anything that meets my needs. Please post whatever you can!
URL...my flash buttons looks different on different systems, even if they have the same operating system the text is too big sometimes, which causes it to be truncated if this occurs on a system it occurs in both firefox and internet explorer.i cant have this! even if i make the test really small, it will mess up the justification my uncle told me it was because java was not installed, but installing it or updating it doesnt seem to make a difference
I'm having some problems with this Flash Cd I've made. The project is compiled of activities and videos. There are several videos in a row and they all load as external swfs. The third video freezes about mid-way through, but sometimes it doesn't - and then it's the other videos that freeze and are really jittery. Apparently the CD doesn't work on particular operating systems... But shouldn't that just be their hardware? The exe and swf's are all flash player 9. Even when I run the project locally it freezes. What's going on? How can I fix this?
I'm creating an interactive map in Flash. The stage size is 800 x 600. To this stage I am adding a large (zoomed-in) map in which I want to display many points. The large map is 4000 x 3000. This map is adding correctly but I experience trouble when I try to add the points to the map. I want to add these points directly onto this large map and I want them to move with it when it pans. Unfortunately, when I add the points their coordinates are read relative to the stage rather than relative to the large map MovieClip. The complication is that the large map is added to the stage at a different location dependent on where the smaller map is clicked by the user.The Question: How do I get flash to add these points relative to the large map's coordinate system rather than the stage's?
What I have tried: globalToLocal/ localToGlobal functions are fine for tracing but don't seem to give me a useable result Setting the coordinates of a Point to the result of this function to give the local origin obviously doesn't work.[code]
We have several systems, inside and outside (development, test and production), that we need to upgrade FMS on Over time, I have found the process utterly cumbersome, prone to errors and time consuming... and outright annoying therefore.The permissions are never consistent, usually insecure (tmp and other directories world writable), and so onI wonder if anyone here has come up with a nifty way to work around this. For example, our setup is pretty uniform, so it's really unnecessary to do an interactive install all the time -- I could of course strip down the installFMS script, but I don't want to conflict with future changes
I've recently discovered an interesting thing. I've made my own Speedmeter using Flash CS4 and ActionScript 3.0. The Download side is based on downloading 2 Mp3 noise files. Using the built-in method getBytesLoaded() and a simple math it's easy to calculate actual connection speed. Actual speed is evaluated every second.
It works pretty good and the actual and average speed is very accurate under Windows. But when I've tried this under Ubuntu the actual speed results are different--and by different I mean that my connection from ISP is 5 Mbit/s and it sometimes shows like 7 or 8 Mbit/s. But the average speed seems to be good.
What causes this strange behaviour? Does Ubuntu have some kind of download cacheing thing?
I'm using a .swf to connect to a socket and stream data as fast as possible for 60 seconds to measure connectivity speed.In other words a speed test.In the past say month or two, I've found Macintosh systems 10.5 and higher experience a significant slow down, In testing I see my socket connect and reach about 2.5Mbps - 3.5Mbps and literally stick as though the .swf was throttling the connection.
This 'problem' is random and appears to come and go. I've tested this in Chrome,Firefox and Safari with all the same results.Using the exact same test on any Windows or Linux OS works totally fine.Admittedly I'm an ActionScript novice however the code I'm using is below and has worked for some time up until recently.
ActionScript Code: var s:Socket; var Tbytes:Number = 0; function connectToSocket():void{