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
Similar Posts:
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
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
Mar 26, 2010
I have a basic XML file and a parser in as3.
So far, I can get it to parse and trace data from the xml file:
{
xml = new XML(e.target.data);
var tester = xml.item;
[Code].....
My objective is to pass in a bunch of variables from my XML file that I can use anywhere in the flash project.
View 5 Replies
Feb 6, 2012
I was wondering if this concept is doable:
Scenario:
4 areas on 1 stage which are quite similar (eg webcamconference, each area has the same functions)
Buttonobjects are numbered(eg area 1 has playbutton1,mutebutton1,namebutton1,namelabel1, etc)
every area gets a close-Button which closes/shuts down the area.(close1,close2,close3...)i want to archive the following:
if(close1.isPressed){
function invisall(1);
}[code]....
this should do the trick via dynamic Nr at the end of each default button(eg playbutton)
but ofc
"playbutton1"._visible=false;
doesnt work because playbutton1 is still a String.how can i take the String as a Buttonname /ButtonObject? do i need to write an new function? this would destroy the purpose of less code. for now i will split the area into frames that i put on the stage.
View 2 Replies
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
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
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
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
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
Dec 30, 2011
I need a XML Parser in as3
View 1 Replies
Nov 19, 2009
i have a class that has something like this
public class Foo {
public var f:Function;
public void method(s:String)
{
[code]...
so i need to assign to the f a function that takes an argument f(s), something like
myFoo.f = thefunction
function(s:String)
how to do all this, so it will work correctly?
View 3 Replies
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
Dec 6, 2010
i've been taking advantage of the new XFL file format recently and it's really opened up a lot of possibilities. i've started a C++ project which parses and builds XFL files as a addon for openFramworks.here is the project on github => https:[url].....im now up to the point where i need to work out how to parse the content of DOMShape so I can draw custom shapes.im finding that online docs on this topic are non-existant.i need to understand how Edge is being encoded - example XFL snippet below,[code]...
View 1 Replies
Jun 8, 2010
This is my first post ever on ActionScript.org. I confess, I suck at ActionScript. Yet I had to put together a website, for which I had to shamelessly borrow code snippets from so many different places. It was working fine, until I got stuck with some colour management issues. I am a 3D artist making a portfolio website. There are some categories under portfolio such as 3D art, 2D art, Photographs, etc. So I wrote down the category names in an XML and used a parser script in case I need to re-use it or create categories of different names later.
[Code]....
View 8 Replies
Jun 4, 2009
The flash XML parser working fine with '>', but when I try '<' or '"' it doesn't read them correctly. Is there a way to get the parser to load in < and "?
View 9 Replies
May 20, 2003
allright, this is the problem, i got this xml file...PHP Code:
<portfolio>
<item>
<img>blaat.jpg</img>
[code]....
View 4 Replies
May 15, 2010
I am attempting to create a custom Collada parser. I Think I'm getting something wrong with the uv's. Attached is the class. Also attached is my model class so you can see the exact methods I am using to render.
View 2 Replies
Sep 19, 2011
I am evaluating the possibility of developing a JSFL script to parse a FLA and need to know first if it would be able to do what i want to do. I need the script to parse through all the library's linked assets, recursively go through their children, replace all the children of type "Group" with a bitmap and then save that FLA as a new file. I haven't received an ok to develop this yet at work, but i'm trying to evaluate the possibility for a proposal.
View 1 Replies
Nov 8, 2009
Simple html parsing library, written in as3 for a flex project?
View 3 Replies
Sep 23, 2011
I need to load and apply CSS at runtime in my Flex app. I know that the adobe docs say that you need to compile the CSS before loading it but I would like to find a work around. I know that you can set individual styles like this:
[Code]...
I know that the adobe flex.text.StyleSheet class has a CSS parser but I could not find a way to harness that. (Is there a way to get that source code?)
View 2 Replies
Apr 25, 2006
I've tried to make an XML parser class using ASBroadcaster, that would act as a listener, and then have methods like getNode(n), which when called, would return the value of that node as a string to the dispatcher/caller.
This doesn't really work all that well, since I'm unsure of how to adress the dispatcher/caller in an economic way.
Do I have to supply the caller object as an argument when broadcasting from it, then do another broadcast for setNode inside the XMLParser.getNode method, supplying it as an argument again, and then check with an if statement in the setNode of the caller, whether it is the right one or not. Seems a bit over the top.
I'd want XMLParser to be a centralised class, that all other objects would refer to via some listener or get/set thing, instead of having an instance of it in each of the objects that would use it.
View 1 Replies
May 16, 2009
i have this code:
Code:
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("http://internetradio.vrt.be/internetradio_master/productiesysteem2/epg/41_epg_huidigeweek.xml"));
loader.addEventListener(Event.COMPLETE, loadXML);
[code]....
but i get error:
1095: XML parser failure: Unterminated attribute.
View 3 Replies
Oct 17, 2010
I am getting the above error, I cant see the problem in my xml.
<?xml version="1.0" encoding="utf-8"?>
<Work Columns="4" XPosition="30" YPosition="80" Width="100" Height="100">
<Image id="images/images/images_01.jpg" thumb="images/images/thumbs/thumb_01.jpg"</Image>
<Image id="images/images/images_02.jpg" thumb="images/images/thumbs/thumb_02.jpg"</Image>
<Image id="images/images/images_03.jpg" thumb="images/images/thumbs/thumb_03.jpg"</Image>
<Image id="images/images/images_04.jpg" thumb="images/images/thumbs/thumb_04.jpg"</Image>
<Image id="images/images/images_05.jpg" thumb="images/images/thumbs/thumb_05.jpg"</Image>
<Image id="images/images/images_06.jpg" thumb="images/images/thumbs/thumb_06.jpg"</Image>
<Image id="images/images/images_07.jpg" thumb="images/images/thumbs/thumb_07.jpg"</Image>
<Image id="images/images/images_08.jpg" thumb="images/images/thumbs/thumb_08.jpg"</Image>
<Image id="images/images/images_09.jpg" thumb="images/images/thumbs/thumb_09.jpg"</Image>
<Image id="images/images/images_10.jpg" thumb="images/images/thumbs/thumb_10.jpg"</Image>
</Work>
View 3 Replies
Aug 21, 2009
I need to make a parser to be able to extract logical structure from a text input in order to construct a query for some web service.
I tried to use regular expressions but it gets really complicated to handle imbrication logic
ex:
( (foo1 and bar) or (foo2 and bar2) ) and ( (foo3 and bar3) or foo4 ) and "this is quoted"
the result should be something like this:
{
[Code].....
View 3 Replies
Feb 9, 2011
So I'm trying to make a Vertical 3D Carousel using Flash CS3, ActionScript 3, a program called TweenMax, and some XML. The site I got a tutorial from is a dead site, there.
Here's the error I'm getting:
TypeError: Error #1090: XML parser failure: element is malformed. at outrageouslycooltitlescreennoerrors_fla::MainTimeline/xmlLoaded() at
[code]......
View 3 Replies
Jun 24, 2010
Is there a good way to get the name of a function in as3 in a String or as a String. I have seen sneaky ways by forcing an Error call and stack trace, but that is not what I am look for.
View 5 Replies
May 15, 2009
I want to have a loader function that passes the loaded data to the correct function. So I can do this:[code]Is there any way to type the second variable to avoid the clumsy switch routine, like so:Function (sendTo) ();
View 2 Replies
Oct 28, 2009
Is it possible to call a function from a string? such as if I passed the name of a function to this function, is there a command to convert the string to a function call? :
function CallSpecific(passedFunctionName:String)
I used String, but it was just a guess...
View 9 Replies
Dec 21, 2009
Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.
Code:
var text:String = "Goodbye World";
function myfunction ( varToChange)
{
varToChange = "Hello World";
}
myfunction("text")
View 2 Replies