ActionScript 3.0 :: Creating A Mathematical Curve(like Test Average)?

Feb 11, 2009

I'm trying to create a balance beam for an education video game and am having trouble making the balance look just right.When the student slides the weight on a triple beam balance, the beam rotates from its pivot to show how far off the weight is. The student then continues adjusting it until the weight matches. My problem occurs because the length of the weight arm means the rotation values are very small, range -4 to 4 degrees, and when the student gets within a few grams it appears level.

My question is how to create a mathematical curve. Like 100 = 20, 50 = 15, 20 = 10, 1 = 4, .2 = 2, etc, so that I can have large movements towards the more accurate side and less when the weight is far off.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Curve A Dynamic Text From A Straight Line To Circular Curve?

Sep 9, 2009

I want to curve a dynamic text from a straight line to circular curve (using a slider). I have placed the characters of the string in each textfield created at runtime.

View 3 Replies

Flash :: Function For Extrapolating Points On A Spline Curve Or Hermite Curve Similar To Keframe Interpolation?

Aug 26, 2011

I was hoping someone could help me working out some advanced data reformatting. What I'm hoping for is a function where I can input a value along with an array of key positions like so:

function remap(percentage:Number, keypoints:Array) { ...

The array would start with the minimum and end with the maximum point, with nested key points along the way. For example, I would input something like remap(0.25, [0:0,80:50,100:100] ) and the function would 'imagine' a spline curve graph from (0,0)-(100,100) with a key point of (80,50), then return the y value that is 25% along that graph.

View 1 Replies

ActionScript 2.0 :: Plotting On A Curve - Return The X And Y Of A Point Along That Curve?

May 10, 2007

I have a curveTo an anchor point and a control point.Then I have a function that will return the x and y of a point along that curve if I give it a number as a percentage of the curve (0 to 1).It looks like this, and works perfectly..

Code:
function drawOnCurve( interval:Number, x0,y0,x1,y1,x2,y2)
{
interval = Math.max( Math.min( 1, interval ), 0 );[code]....

x0,y0 are the start point, x1,y1 the control point and x2,y2 the final anchor point.But... I want to give it a _y value instead of a percentage (interval) and it return where on the curve that would intersect.

View 2 Replies

IDE :: Creating A Speed Test?

Sep 1, 2009

I need to create a basic speed test for a website I'm putting together, but my flash is a little rusty.

View 1 Replies

ActionScript 2.0 :: Creating Test's In Flash?

Jun 6, 2006

i'm trying to create a kind of test with multiple aswers like this:

i'm portuguese..................true/false;
i have 21ears old...............true/false;
etc...

and a result btn that shows the points.something like 3points for every right question

View 1 Replies

ActionScript 3.0 :: Creating A Test Engine?

Feb 24, 2010

I am going to make a test application that will present tests to students. I am thinking that there will be two parts to this project; a test "writer" and a test "reader" (the reader is what the student will see as the test). My question is, can I create an external file which is populated by the "writer" and also read by the "reader" into arrays at run time.

View 3 Replies

ActionScript 2.0 :: Mathematical Progression For A Spectrum?

Sep 17, 2007

Does anyone know the math to create this type of spectrum?

I'm using the F8 bitmap object and this image for a color preferences panel, and would like to use the same image for a fall-back to F7.

For F8, I'm using getPixel(), for F7 I'll need to determine the color (or as close an approximation as possible) using the math used to create this type spectrum.

View 3 Replies

ActionScript 2.0 :: Run A Mathematical Calculation On The Data?

Apr 30, 2004

I have XML data that looks like this: 197,168,198,168,204,168,206,168,207,169,208,etc This stuff is XY coordinate pairs, X1, Y1, X2, Y2, X3, Y3, etc. and are used by a drawing function to trace out a particular freeform shape. This array of data is usually 200-400 items long.Here is the AS code that is handling the reading of the XML and the drawing of the shape. This all works wonderfully:

[code]...

I am looking at the array and grabbing some points out, namely the first and last XY pairs, which I need for something else. That's the origXexp, origYexp stuff.The real problem is that I need to run a mathematical calculation on the data in this array. While this is a little hard to explain, I need to create a variable, let's call it expert_area, and then sequentially rip through that long string of numbers and do the following math (I'll use the simple X1 Y1 example): expert_area=0 expert_area = expert_area+((X1*Y2 - X2*Y1)/2)

where we move through the long string a pair at a time. So the first calculation would be (X1*Y2 - X2*Y1), the next would be (X2*Y3 - X3*Y2), (X3*Y4 - X4*Y3), etc. I've tried building loops to get the length of the expertArray[i] and then using that as the basis to proceed through the data. But everything I try either produces no results, or gets Flash stuck in an infinite loop. I'm unsure of where to put this, and how to construct it.

View 3 Replies

ActionScript 3.0 :: String To Mathematical Function Parser?

Jun 13, 2009

Does anyone know of a parser for math functions?

Basically, I want to be able ot take a string such as:

(x + (x - 3)/2 * 4)^2

and compute the answer. Before I make the parser on my own, I thought I'd check to see if anyone has something similar already made.

View 1 Replies

Actionscript 3 :: Display Unique Mathematical Properties In A Textfield?

Mar 9, 2011

Is there anyway I can display exponents or fractions properly in a textfield.

I'm creating educational software and want to see actual symbols as opposed to: 3/4 or x^2

View 1 Replies

Actionscript 3 :: Mathematical Error In Physics Restitution Formula

Aug 14, 2011

I admit it. I'm a mathematical imbecile. should I be attempting this at home? Probably not without serious injury. Anyway. Anyone that has a bit of experience in games and physics who can review this code and provide insight into why there is a built in "loss" in velocity in prototype would be hugely admired.

the concept: the actor falls from the sky, at some point intersects a boundary (trampoline.y) after which gravity (in this example a value of 1.6) stops operating and a restitution factor (in this case a value of -6) takes over.

right now I'm trying to create a zero-sum situation where you have the same velocity coming out of the trampoline "bounce" (hero.y >= trampoline.y) as you did going in. That's just not the case as the traces reveal.

[Code]...

For now I'm hoping to have a solution where the velocity on the tic after the character leaves contact with the trampoline is the same (but negative) of the velocity just prior to going in. Heck I've even tried storing and retrieving the entry position and velocity, but that just looks like a hiccup.

View 1 Replies

ActionScript 3.0 :: RegEx Var To Match Out The Ends Of A Mathematical Expressions Out Of A String

Aug 21, 2011

I've gotten stuck on some issue using AS3 and RegEx. I'm trying to use a RegEx var to match out the ends of a mathematical expressions out of a string. But for some reason, the RegEx only matches the first expression and ignores the one after the conditional.

[Code]....

View 5 Replies

ActionScript 3.0 :: Average Input NaN?

Jun 14, 2011

I made involving the user inputting 4 different numbers into seperate InputText component boxes. I have an output showing "Your Average Is _____ " but i keep running into a problem saying "Your average is NaN". Here's my code, tell me what is wrong with it.also, Flash shows no errors in my code. It's just shows NaN.

Code:
var average:Number;
grade1.restrict = "0-9";
grade2.restrict = "0-9";[code].....

View 6 Replies

ActionScript 3.0 :: Mathematical Function That Will Return A Number Based On A Graph That Starts At 0?

Sep 23, 2009

I'm completely useless at maths due to paying no attention whatsoever to it in school when I was a kid so forgive my lack of knowledge of basic terminology.I need a mathematical function that will return a number based on a graph that starts at 0, curves to (eg.) 100 and then curves back down to 0. I have a feeling it has something to do with Math.sin or somesuch wizardry but am not sure.Basically, I want to feed it a number between (eg.) 0 - 60 and for it to return a number on aforementioned curve. The purpose of this is to be applied as a lateral force on some basic ball physics. The idea of the 'curve' is that (depending on timing of the shot) there will be a 'sweetspot' in the timing.

View 5 Replies

ActionScript 3.0 :: Get Average Brightness Of A JPG Movieclip?

Feb 22, 2011

I was working on a project a few months ago, which I had to put on hold but am finally getting back to. One major feature I need that I wasn't able to figure out before was how to measure the average brightness of an image file loaded as a movieclip. I remember spending hours going through tutorials but I wasn't able to get it working. Now I don't even remember what or where I read before and I'm not keen on rereading all of it and still not knowing what to do.

I just want the simplest possible way to get an average brightness level of an image, I don't care which way the brightness is measured as it is only important relative to other images which will be measured the same way.

View 9 Replies

ActionScript 2.0 :: Average Colour From BitmapData?

Oct 27, 2008

Is there a way to loop through all the pixels of a bitmapData object to find the "average" colour or light level? I basically want to make a light level detector using the webcam. Does anybody havehow I could accomplish this? All searches I have tried return tutorials on motion tracking.

View 3 Replies

ActionScript 2.0 :: Average X Coordinate With Arrays?

Jan 16, 2012

I am wanting to take the average x co-ordinate of several movieclips, mc_01, mc_02, etc. using arrays. That is, I would like to sum all the x co-ordinates and then divide by the number of movieclips.

View 1 Replies

Get Dominant / Average Color In GetPixels ByteArray?

Jan 10, 2010

So, I've got this [code]...

Is there a way to get, efficiently and quickly, the dominant color and/or the average color in pixels ByteArray.

noise is used for the example here. I'll be having something else drawn on that BitmapData instead.

I found some ways to extract the average color palate from a BitmapData, but this isn't enough for me since I want the average from a rect over that image.

View 2 Replies

ActionScript 3.0 :: Getting The Average Pixel Value Of The Rectangular Area Behind A Mc?

Nov 28, 2009

I have a vector movie-clip of a cat. Behind it, there is a picture of a park. The picture of the park takes up the entire stage, but the cat is only 32x16. How could I use BitmapData to sample all pixels (of everything, not just the park) within the cat's bounding box (but not including the cat itself in the samples (so like the cat is invisible); also 4 pixels wider in each direction, so it would effectively be 40x24) and then return the RGB average (in hexidecimal) so that I can set a masked transparent mc in front of the cat to that value?

Basically, so it looks like the color of the cat's surroundings affect its tint, to crudely simulate global illumination in 2d.

View 1 Replies

Java :: Apply Mathematical Rules Stored In Database To A Variable Gotten From Human Machine Interface?

Jun 10, 2011

I'm developing a project with Flex, Spring, Hibernate, MySQL, Tomcat, but one of the functionality is: " i have to store a mathematical rule like for example " a+b " into database, then in my human machine interface, i have two fields when user write the variables "a" and "b", then a button with the label calculate which if it's clicked, it'll show bellow the result of applying the rule " a+b " to the variables "a" and "b" which the user previously." Now, i'm searching for an Java or Flex API or any other way that will give me the ability to apply a mathematical rule stored in database as string, to variables i got from human machine interface"

View 1 Replies

Capture Numeric Input From User And Calculate Average?

Feb 26, 2010

This can't be too difficult but its killing me. I want my user to be able to type 3 numbers into 3 different input boxes, capture those numbers, calculate and display their average in a fourth text box.

I am not sure how to capture input from a textbox in AS3 in order to do these calculoatilo.

View 1 Replies

ActionScript 3.0 :: Calculate The Average Of A Series Of Numbers In An Array?

May 27, 2011

So I've got an input box on the UI, where integers are entered and stored in an array. I want to find out the average of the integers, but how would I calculate the sum?

View 1 Replies

ActionScript 2.0 :: Cannot Be A Dynamic Text Because The Font Is Not A Normal Average One?

Nov 24, 2004

I know it's possible i saw it on several websites does some one know how i can use a static text in preloader counting to 100%? For an example look at ILOVETECHNO.BE The preloader a heart use a static text i think it cannot be a dynamic text because the font is not a normal average one

View 1 Replies

ActionScript 3.0 :: Getting Specific Average Number - Stack Over Flow Error

Nov 8, 2010

I'm having AS3 create 12 random var (play1, play2, etc) and then I ask it to average the 12 vars (numbers) until I get a specific average number. When I run this in AS2 I get the "script time error, keep running?" question. I tell it to keep running and eventually AS2 finds the right set of 12 numbers to equal a specific average number. In AS3 I get a "stack over flow error". I know that all my AS3 swf needs is just more time to find it.

View 12 Replies

ActionScript 2.0 :: Load A Value From A .php File Labeled $average Into A Dynamic Textbox?

Jan 18, 2008

I'm trying to load a value from a .php file labeled $average into a dynamic textbox. I'm using this code to accomplish this, but I only get "undefined" in my textbox. Can anybody see if there's anything wrong or just a syntax error, or anything..

[Code]...

View 6 Replies

Flex :: Test Spark Components In FlexUnits Visual Test Environment

Sep 17, 2011

I'm trying to test a custom Flex 4 skinnable component, using the FlexUnit UIImpersonator class. If I run my tests from a FlashBuilder Spark only project everything works fine. If I try to test from a project with the mx component set on the classpath I get a "getElementIndex not available in non Flex 4 projects" error.Can I unit test spark components in FlexUnits visual test environment while still having the mx component set on the classpath?

UIImpersonator delegates it's method calls to a "testEnvironment".The implementation used for this "testEnvironment" is decided by the VisualTest EnvironmentBuilder class and the FlexEnvironmentBuilder class. If the FlexEnvironmentBuilder class can find the "mx.core.Container" on the classpath it returns a MX environment, else a Spark environment. Only the spark environment has valid implementations for Flex 4 relevant method calls on the UIImpersonator - like the addElement method.

View 1 Replies

Actionscript :: Calculate The Average Frequency Of An Audio Recording Captured As A ByteArray In Flash?

Nov 30, 2011

Keeping it simple for now but assuming i have a ByteArray full of sample data is it possible to calculate the average frequency (thus a pitch) from the entire recording? Is this along the right lines? p = 69 + 12 x log2(f/440hz) ...

View 1 Replies

Professional :: Buttons Don't Work When Test Movie/Test Scene?

Aug 4, 2011

My buttons only work when I click on them on the stage while having the "enable simple buttons" option on. They do not work if I try to "test movie," "test scene" and publish it to a SWF. Nothing responds whenever I am in these modes. I am using Adobe Flash Professional CS5 Actionscript 2.0.
 
This is the code that I put in for the buttons:
 
[Code].....

View 5 Replies

ActionScript 3.0 :: Movie Works In Flash Test But Not Html Test?

Aug 30, 2009

i have a movie that has worked fine in past during Html test but ive been doing some dubugging using the flash test latly and it runs fine here but when i go back and try to test in Html mode no errors come just the movie never fully starts (starts up about as much as if there was an error).

View 5 Replies







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