ActionScript 3.0 :: Calculate Expression Stored In String?

Jul 11, 2011

I have a string "5^2". Is there a way to calculate the value of the expression stored in the string?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Way To Use String Stored In A Variable As Regular Expression

Aug 29, 2009

I am using RegExp to search for character sequences within strings. I was wondering if/what is the proper way to use a string stored in a variable as a regular expression. For example: [code]I'll have to use another string manipulation tool to search for the sequence.

View 5 Replies

Flex :: How To Use A String As An E4x Expression

Oct 2, 2009

Possible Duplicate:In Flash, how would I run an e4x statement when that statement is stored in a String?I know there is an existing question regarding this problem, but it got no replies.Ideally, I would like to stick an e4x expression in a string and run it.

var tempXML:XML = someXML;
var stringe4x:XML = "pictures.picture.(size > 200)";
tempXML.eval(pictures); //something instead of eval

Since AS3 doesn't have eval, this doesn't work; however, there is the ability to use elements() and attributes() to get the elements or attributes on the same XML node level, but this doesn't work for the more complicated e4x filters such as "(id > 300)" or ".." notation.

View 1 Replies

ActionScript 1/2 :: Convert From String To Expression?

Mar 16, 2009

I need to convert a string such as "x*y+2" (from an input text field) into an expression x*y+2, so that it can be evaluated normally, eg f=x*y+2. The variables x and y are already defined and can have various values; I need to evaluate the strings as expressions.

I have tried f=Number("x*y+2") but it seems to work only when the string is actually a number such as "1.2e-4".

View 1 Replies

Flex :: Evaluate An Expression In A String?

Feb 4, 2011

I need to evaluate an expression in a string at run time . Not sure how to achieve this in Flex. My requirement is as follows

var test:String = "myparams.id=10" ;
//test will be a string populated at runtime.
// I need to treat it as an expression and evaluate it at runtime

[Code]....

is it possible to do something like this action script 3?

I believe the eval function earlier allowed this, but now it has been depreciated?

View 4 Replies

Regex - Regular Expression To Count How Many Newlines () There Are In A String?

Jan 10, 2011

I'm trying to find the number of newlines in a string using the Actionscript 3.0 RegExp engine. Using the string.match function and RegExp(" ","g") does not find the newlines in a string which contains newlines. Is there something I need to add to the pattern or something else that I am missing?

View 1 Replies

ActionScript 2.0 :: Adding String Data To An Expression For Evaluation?

Nov 15, 2007

I have the following function:

Code:
getInfo = function (input, arrayData, desiredResult)
{

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Read Regular Expression From String

Aug 14, 2010

I want the user to input a regular expression, which is then used.

I'm using following at the moment.

PHP Code:

var filterEx = new RegExp(filterTxt.text.split("/")[1], filterTxt.text.split("/")[2]); 
filterTxt is a textbox, when traceing the pattern is seemingly correct, but i.e.:

[Code]...

View 2 Replies

Regex :: Regular Expression To Check If A String Has HTML Code?

May 31, 2011

give me the Regular Expression that can check if a given string has any HTML code in it, and coming to think of it I would be bothered with <a href="something">something</a> exactly.

View 2 Replies

ActionScript 2.0 :: Use A Stored String Variable?

Feb 9, 2009

trying to use a stored String variable in the following:

Code:
var meuXML:XML = new XML();
meuXML.ignoreWhite = true;
meuXML.load("subdir/"+PAGE);

[code]....

'button.page' is the aforementioned String variable How can I make this work?

View 6 Replies

Actionscript 3 :: Validating Alphabets Only Stored In A String In Flex

Nov 11, 2011

I am trying to validate if only alphabets are typed in a text box. The code i am using is

<mx:StringValidator id="loginValidator" source="{loginTextField}" property="text" required="true" minLength="2" />

validatorErrorArray = Validator.validateAll([loginValidator, ...])

Now the problem is, it also validates characters like */- and ;',./ etc i want to validate only numbers and or alphabets. If anyone can point out mistake and changes that should be made

View 1 Replies

ActionScript 3.0 :: Regular Expression To Test If A Single String Character Has Both Upper And Lower Case Character?

Nov 27, 2010

Does anyone know the regular expression to test if a single string character has both upper and lower case character?

eg. All A-Z and a-z.

View 0 Replies

ActionScript 3.0 :: Calculate Age From XML Data; Calculate Dates

Jul 1, 2011

I as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:

ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;

[Code]......

View 0 Replies

Actionscript 3 :: Find E4x Expression From The Given Xml?

Mar 14, 2012

I need to extract the name of the video from the below xml. find the e4x expression for this?

[Code]...

View 2 Replies

ActionScript 3.0 :: Property Value Changes When Used In An Expression?

Apr 9, 2011

I'm new to these forums and to actionscript as well, so please excuse my lack of clarity when explaining this situation, I'm learning on my own and in my free time!This isn't really a problem in the sense that I've found a workaround to it, but it's bugging me that I don't understand what's going on in this situation. In the last couple of weeks I have been working on a gridless pathfinding solution for a point & click game, I finally got it done, but I was stuck at some point for a few days and I discovered that there was an x property of a point I was referencing that kept changing back to a previous value assigned to it. I don't know if I'm making any sense, but so you guys see what I'm talking about:

[Code]...

View 8 Replies

ActionScript 2.0 :: Literal Value For Expression?

Feb 3, 2004

First a fabric button sets:

_root.fabricbuttonselected="_root.fabric01";

then the color button sets:

_root.selectedcolor=_root.fabricbuttonselected + "_chip10_name";

This returns the name of a variable:

"_root.fabric01_chip10_name"

however I have preset the variable to "Rose"

_root.fabric01_chip10_name = "Rose";

My dynamic text box is set to:

_root.selectedcolor

but instead of displaying "Rose" it displays"_root.fabric01_chip10_name" Basically I need to get the literal value to equal an expression- how do I do this?

View 6 Replies

ActionScript 2.0 :: Delete An IF Expression?

May 30, 2004

Is it possible to delete an IF expression? Like when you delete an onEnterFrame ?

View 4 Replies

ActionScript 2.0 :: Expression In Quotes Around The Word

Mar 22, 2009

I am scripting a button and something like this: _root.READ = ("image6"); takes me exactly where I want, the frame labeled "image6" However i want to reuse this button and I want to switch it to something like: _root.READ = (trace(this._name)); where it calls upon the instance name (image6). However, this doesn't work, and I believe it's because there are no quotes around the word. Is there someway I can output what the trace calls and put it in quotes?

View 2 Replies

ActionScript 3.0 :: Evaluate An Expression In A Switch?

Sep 7, 2011

So why can I evaluate an expression in a switch like so:

[Code]...

If I trace vidList[currentIndex].video before the switch I get "city" but tracing vid after the switch I get null Quickly solved by just assigning to a variable and then using that in the switch... but it still seems odd I can't just do it directly.

[Code]...

View 4 Replies

Regex - Flex 3 Regular Expression?

Mar 11, 2010

I've written a url validator for a project I am working on. For my requirements it works great, except when the last part for the url goes longer than 22 characters it breaks. My expression:/((https?)://)([^s.]+.)+([^s.]+)(:d+/S+)/i

It expects input that looks like "http(s)://hostname:port/location". When I give it the input: https://demo10:443/111112222233333444445

it works, but if I pass the input https://demo10:443/1111122222333334444455

it breaks. You can test it out easily at[URL].. Oddly, I can't reproduce the problem with just the relevant (I would think) part /(:d+/S+)/i. I can have as many characters after the required / and it works great. Any ideas or known bugs?

[Code]...

View 2 Replies

Flex :: AIR SQLite IN Expression Not Working?

Mar 14, 2010

I'm having a problem with an expression in my sql statement in SQLite for Adobe AIR basically I have this sql = "UPDATE uniforms SET status=@status WHERE customerId IN(19,20)"; updateStmt.parameters["@status"] = args[1]; updateStmt.execute();

if I run the above code it works, updating the status when the id are 19 and 20

but if I pass the ids list as a parameter like this

sql = "UPDATE uniforms SET status=@status WHERE customerId IN(@ids)";
updateStmt.parameters["@status"] = args[1];
updateStmt.parameters["@ids"] = "19,20";
updateStmt.execute();

it gives me and error, saying could not convert text value to numeric value, which make sense because I'm passing and string but the IN expression should convert it accordingly, like it does when I pass directly the list values, why is not working the other way,

View 1 Replies

ActionScript 3.0 :: Chat App - Regular Expression URL

Feb 10, 2009

I'm creating a chat app and I would like to if someone enters a url that it turn color and turn into a hyperlink. I am not sure how to write the regular expression. I guess the approach would be to check for "http://" or "www." or ".com" ?

View 0 Replies

ActionScript 3.0 :: Regular Expression To Add Tags?

Jul 9, 2009

I'm trying to create a replace method that allows me to surround parts of a string with tags. I tried this with a regular replace technique (join and split) but thats case sensitive. what i want is:

: "A nice example line"

and replace "Ice" in that line to surround it with bold tags, result:

text: "A n<b>ice</b> example line"

ActionScript Code:
var str:String = "A nice example line";
var pattern:RegExp = /(w+)-(w+)/gi;
trace(str.replace(pattern, "$2,$1"));

But i just can't figure out the replace pattern

View 4 Replies

ActionScript 3.0 :: When To Use Primary Expression Keyword (This)

Sep 18, 2009

I'm a complete novice to ActionScript, OOP and Flash. I have no idea when you are supposed to use the keyword "this". I have searched the forums but obviously searching for the word "this" is not very successful! I've read quite a few tutorials now and it seems that different people have different opinions on when and where it should be used. For example what should I be doing in the following class? Both seem to work but is one the "correct" way? Are there situations where things will not work if you omit the "this"?

ActionScript Code:
public class Sector {
private var _radius:Number;
public function Sector(radius:Number){
[B]this.[/B]_radius = radius;
} public function get radius():Number{
return this._radius;
} public function set radius(value:Number):void{
this._radius = value;
}}

I have another possibly related question with regards to naming conventions. I like the use of underscores for properties with getters and setters but what about the names of the constructor parameters that are used to initialise these properties? In the above example I have used "radius" for the constructor parameter although it is also used for the getter and setter functions. It seems a bit of a palaver to come up with different names for the same quantity but is what I have done really bad coding practice?

View 5 Replies

ActionScript 3.0 :: Using An Expression To Access An Array?

Sep 22, 2011

I have 3 extenal flv files that can be loaded into the main movie when pressing a button.I am using seek and cuePoints to provide a DVD 'chapter-type' navigation.The cue points (in seconds) for each flv are stored as separate arrayshen I click to load a flv, I want to change the array that is being used to seek the playhead.I thought I could do that by using a 'current movie' variable and use an expression to access the relevant array. The essential code (for brevity) is like this:

//
var flv1cuePoint:Array = new Array(10,30,50);
var flv2cuePoint:Array = new Array(30,50,60);

[code].......

View 2 Replies

ActionScript 2.0 :: Posible To Delete IF Expression?

May 30, 2004

Is it posible to delete an IF expression? Like when you delete an onEnterFrame ?

View 4 Replies

ActionScript 2.0 :: Way To Evaluate A Variable As An Expression?

Apr 8, 2006

Code:
var Happy:Array
Happy[Happy.length] = "_root.Train1_mc"

[code].....

View 3 Replies

ActionScript 2.0 :: Goto And Stop On Frame Expression

May 30, 2010

I have a php file that has three variables that are passed to a flash file. I know the variables are going through, as I can display them via input text elements.

one of the variables is called percent I want a movie clip called 'thermo' to go to the frame number that the variable 'percent' has stored. For whatever reason, this is not working

_root
loadVariables("scripts/membership_drive.php", "");
_root.thermo code on frame #1
stop();
gotoAndStop(_root.percent);

Like maybe the script does not see the variable percent as a number?

View 6 Replies

Data Integration :: PHP Regular Expression Of URL In Text?

Feb 27, 2008

I have some text that is displaying from a database table and inside that text is a web address (i.e.,

[Code]...

View 1 Replies

ActionScript 3.0 :: Pass A Variable Within A Regular Expression

Sep 29, 2011

I am trying to understand some basics of Regular Expressions.For just a experiment I wanted to count the total words in a string.var str:String = "hello, this is some text to count the word hello and to check if Hello is ignored by case and if hellow is different";[code]Here i get the array of the values. and using it's length I can use the total number. This works, but the regular expression is not dynamic.[code]

View 2 Replies







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