ActionScript 2.0 :: Math Power Function In Flash 8
Apr 9, 2006How can I make Flash calculate the value of the function y= (1 - x^2)^3 where x is the user input value?
View 3 RepliesHow can I make Flash calculate the value of the function y= (1 - x^2)^3 where x is the user input value?
View 3 RepliesI want to make a function like y= (1 - x^z), where both x and z are user input values. How is that possible?
View 1 RepliesI have a set of data (in ArrayCollection) and I need to fit a power function { f(x)= B + x^alpha } to it, before display in LineChart. As result I need the alpha and B paremeter.
View 1 RepliesI am new to Flash and Action Scripts. I am trying to put together some Mortgage Calculators for a client and am having issues getting the syntax for the formula correct. Below is my code could someone look it over and give some pointers on how to structure the formula. It is a standard mortgage payment calculator. num1 is Loan Amount num2 is interest rate and num3 is loan term they are the instance names of the unput text boxes.
equels_btn.addEventListener(MouseEvent.CLICK,equel sClick);
num1.border = true;
num2.border = true;[code]........
I get the folowing error when I click the equels_btn
TypeError: Error #1006: value is not a function. at LoanPayment_fla::MainTimeline/equelsClick()
I have problem about math. I want write function of laplace transform in flash.
X(s)=kd*s^2 +kp*s+Ki;
F(s)=s^3 +(10+kd)*s^2 +(20+Kp)*s+Ki;
Gc(s)=X(s)=/F(s);
How I write code(actionscript) in flash, when Kp Ki Pd is value of user input. And S is Laplace transform.
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?
The question is simple; I need the fastest way to calculate power 2. I need that for this formula which calculates distance between 2 points.var Dist:int = Math.sqrt( (mmx - ox) * (mmx - ox) + (mmy - oy) * (mmy - oy) );
View 2 RepliesHow to use math mod function in flex?
calculate like this 7 mod(%) 2 = 1
I wonder how to make a Math.random() function, or something similar where it chooses a number from 0-9. But as the program progresses, another random variable will appear. That random value is what I want removed from the 0-9 scale. (The other random variable is also from 0-9)
View 4 RepliesFor some reason my math.floor function is not working (trace yields "undefined")..[code]
View 2 RepliesI need a good Flash strategy for creating an ordinary PowerPoint presentation. We always need very media-rich presentations (PP is weak in this area). So far we have relied on embedding a Flash object in PP. This turned out to be a bad move because many of our clients deal with the Defense Department and are not allowed to D/L and install the latest Flash player. I have found that publishing a Flash movie projector (.exe) that advances slides like a PP is a good solution. The problem is that I have to put buttons on each slide and write unique functions to advance the slides I would like to be able to simpley click the mouse or use the arrow keys (like PP) for navigation. Should I use the "Flash Slides Presentation" template?
View 2 RepliesI am generating random numbers between 1 and 90 how do I do it so I don't get any repeats. Here is the code I am using.
ActionScript Code:
var num:Number = Math.ceil(Math.random()*90);
I cant get this to work. I think its pretty self explanatory what I want to do, set _x to a random position (b1 - b6)
Code:
onClipEvent (load) {
stop();
b1 = 462;
b2 = -462;
b3 = -1388;
b4 = -2314;
b5 = -3240;
b6 = -4166;
} onClipEvent (load) {
RanNum = Math.ceil(Math.random() * 6);
_x = ["b" + RanNum];
}
How do you round a number to 2 decimal places using the Math.round function?
View 3 RepliesI'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]...
Wat is the diffrence between these two?
View 2 RepliesI want to make an application with Flash CS4, to open to read inside either pdf either power point. I have some doubts.First: How I can open and see pdf document ? (an small application it would be ok to me, but I haven't see in samples).Second : can I open ppt ? I think probably not, but I am not sure. I read that with flashpaper you can convert ppt to swf, but that's not good to me, the user must select a ppt, and then the application must show it, but if that's not possible, I would like to known if I can load ppt, and the app internaly make the converts needed and then show it.
View 1 RepliesI'm building a website where I hook people up so that they can anonymously vent to strangers. You either choose to be a listener, or a talker, and then you get catapulted into a one-on-one chat room. The reason for the app's construction is because you often can't vent to friends, because your deepest vulnerabilities can often be leveraged against you later on. (Like it or not, this is a part of human nature. Sad.)
I'm looking for some insight into how I should architect everything. I found this neat tutorial, [URL], which suggests using python & stackless + flash. Someone else suggested I should try using p2p sockets, but I don't even know where to begin to look for info on that.
wat's the difference between finding a angle using Math.atan2(y,x) function and by finding using the movie clip's rotation (mc._rotation*Math.PI/180);
View 9 RepliesI 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 Replieswhy aren't they working? need any more details?
View 3 Replieswhy aren't they working? need any more details?
View 1 RepliesI've been wanting to learn to work with Flash for awhi l e and decided to start learning by attempting a game. I found a decent tutorial for a space shooter and used it to create the basic code (firing, etc...) and now I've been figuring out how to add other elements (splash screen/scrolling screen).now I'd like to add power-ups but can't figure out how.I've created a graphic, turned it into a movie clip, but can't think of what to define for its actions.
View 2 RepliesI have a problem with the sound capture of my Microphone in Actionscript 3.0.Particularly I would like to capture the "power" of sound, better if in decibel.Does a method / attribut of class Microphone exist.
View 6 RepliesI have been trying to implement the Round Up Power Of 2 algorithm outlined in the following link in AS3.
[Code]...
The algorithm works great for most of the values I've tested. It is mentioned that this will return 0 when given an input value of 0 which is technically incorrect but I'm ok with that output. What I'm not ok with is when given an input of 1 I get and output of 1. I'm thinking that this must be a caveat of AS3 and its wonky uint implementation but I can't seem to figure it out. I have also tried using the >>> logical shift operator to the same result. My C is a little rusty, but I'm not sure how this would even return 2 in C. Can someone explain to me whats going wrong here? I assume if an input of 1 was a special case it would have been mentioned in the above link.
I have an MC that occurs many times on the stage, and each one has a motion, and random scaling script in it. Would I save computing power by not having a script in each MC but rather assign them all to a prototype?
View 14 RepliesSo 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?
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 RepliesI'm making a 3D program and I've already made the back end which calculates where each object's polygons should be. However, I can't seem to find a quick way of drawing them without having to remove and redraw them each time, which I'm sure would take a lot of processing power, knowing the way that Flash does things. So is there a way to draw a shape (a quad in this example) and then alter the shape's color and the position of all of its corners in the next frame without taking a huge load of processing power? I would really like to be able to do this to at least 20 polygons, hopefully more, within the span of one frame at 20 fps.
View 3 RepliesI'm doing a prototype game like Worms and I would like not only to shot, but also see the whole projection curve where my shot will travel before it hit the ground. The only information given by the player is an angle and a power. There is also some level elements like wind and gravity.
Can I have a code for the projection curve? its like a parabola I think. I research about parabola but I had some difficult to apply these math formulas into the programming code.