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
Similar Posts:
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
Apr 8, 2006
Code:
var Happy:Array
Happy[Happy.length] = "_root.Train1_mc"
[code].....
View 3 Replies
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
May 31, 2009
I have an SWF that has a var that is a string called fullpath. Now, if fullpath was "game.item1", How would I evaluate it as _level0.game.item1 in brackets [] rather than _level0.game.item1.Basically, how would I evaluate an item path from a string with brackets []? This is AS 2
View 5 Replies
Jun 6, 2011
This should be fairly simple but I understand why it doesn't work. I am hoping there is a clever way to do the following: I have a string 'movieclip1.movieclip2' I have a container movieclip - Container. Now to evaluate the string normally I would look something like: this.container['movieclip']['movieclip2']
Because clip2 is a child of movieclip. But I would like to parse or evaluate the string with the dot syntax to read the string as a internal path. this.container[evaluatedpath]; // which is - this.container.movieclip.movieclip2 Is there a function or technique to be able to evaluate that string into an internal path?
View 1 Replies
Apr 26, 2011
I have piece of ActionScript code which is supposed to evaluate a string of HTML and break it up into individual pieces. So a string like <p>Hi</p><span>Hi</span><a href="index.php">Hi</a> would be translated into:
1. <p>Hi</p>
2. <span>Hi</span>
3. <a href="index.php">Hi</a>
...
However, when I run a test version of this code, I get a value of null in return. I'm pretty sure my regexp string is good, but I'm doing something wrong in ActionScript. My code is below:
var evaluatedInput:RegExp = new RegExp('/<([A-Z][A-Z0-9]*)[^>]*>(.*?)</1>/');
var output:Object = evaluatedInput.exec("<p>Hi</p><span>Hi</span><a href="index.php">Hi</a>");
trace(output);
View 2 Replies
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
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
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
Nov 15, 2007
I have the following function:
Code:
getInfo = function (input, arrayData, desiredResult)
{
[code].....
View 1 Replies
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
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
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
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
Jun 30, 2011
For example:
for(var i:int=0; i<someArray.length; i++)
{
var loader:Loader=new Loader();
loader.load(new URLRequest("http://testurl.com/test.jpg"));
[Code]....
The second paramter (i) for imageLoaded is always 1, I guess because i no longer exists and is defaulting to 1. Is it possible to get that second paramter to be evaluated when the load is started rather than on complete?
View 2 Replies
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
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
Nov 5, 2010
I'm having a problem converting a regular expression from Python into Flex. My string is something like this:
SELECT "col", othercol,
othercol3" FROM doesn'tmatter...
Python matches just fine:
>>> re.search('select(.*?)from', 'SELECT "col", othercol,
[Code]..
match always ends up null. What am I doing wrong? I'm sure it's obvious to a seasoned Flex programmer...
View 1 Replies
Feb 25, 2011
Is it possible to create wrong Regular expression in ActionScript/Flex which will cause runtime error? I've tried so many weird regexpes in Flex and Flex never complained! How do I know If my regexp valid?
View 3 Replies
Mar 10, 2011
find the suitable regular expression to validate a string that has comma separated numbers, for e.g. '1,2,3' or '111,234234,-09', etc. Anything else should be considered invalid. for e.g. '121as23' or '123-123' is invalid. I suppose this must be possible in Flex using regular expression but I can not find the correct regular expression.
[Code]...
View 2 Replies
Aug 10, 2011
I need a regular expression pattern for validating the following path directory:
[Code]...
View 1 Replies
Sep 21, 2011
I have a String variable in my flex (flash builder 4) application containing CSV data. I need to allow the user to download this data to a local file. For example, giving them a "csv" button to click and it might present them with a save file dialog (and I would be sending the contents of my string variable).Is this possible / how ?I am using the ResuableFX component for the datagrid to csv. This the code I ended up with that works to save the string to a text file for the user (in a web browser):
var dg2CSV:DataGrid2CSV = new DataGrid2CSV();
dg2CSV.includeHeader=true;
dg2CSV.target=adgEncounters;
[code]......
View 1 Replies
Apr 13, 2004
I embed a text file into my Flex project and read its contents using code like this:
[Embed(source = "../../data/abc.txt", mimeType = "application/octet-stream")]
private var r_Abc:Class;
var xx:ByteArray = new r_Abc();
[code].....
View 9 Replies
Aug 6, 2003
Code:// This example is set to evaluate half a second pause (500)
if (Number(getTimer()-lastClick)<500) {
// Add your doubleclick actions here
if (Reaction._visible eq false) {
setProperty ("Reaction", _visible, True);
} else {
[Code]...
This is a double-click detector.. I was just wondering, since I've never seen lastClick, is there such a thing as lastMove? I'm thinking of using onClipEvent (MouseMove) with a x and y detection timer, or could the one above have some hope?
View 3 Replies
Feb 9, 2011
I have 25 textboxes on stage. I am using a for loop to point to each textbox and evaluate the contents. When I come across a textbox that has the letter "Y" in it I want to place a object called colorbox at a certain location. To do this I have created a variable called tf. When I trace this variable outside of my if statement it correctly shows the contents of the current box, however within my if statement it doesn't. Also the colorbox doesn't get placed at the designated coordinates and I get the following error message:
1176: Comparison between a value with static type flash.text:TextField and a possibly unrelated type String.
for(var i:uint = 1; i < 2; ++i)
{
var tf:TextField = TextField(getChildByName("sw" + i));
trace (tf.text)
[Code].....
View 1 Replies
Mar 14, 2012
I have three array holders that hold different text and numbers. First I need if(_root.achievements[0][i] (Needs to be evaluated as a string variable name for example _root.pKills because before I set _root.pKills to 10) == _root.achievements[1][i] (Need to be evaluated as a number so I can compare it to the string variable name))
[Code]....
View 2 Replies
Feb 11, 2011
I have 31 squares on stage named square1-31. Each square is defined as a movieclip. . Each square has a textbox within it named txtbox1-31. I also have an object in my library called marker.I am using a for loop to cycle through the squares. I need to evaluate the contents of each textbox in each movieclip and if it is not empty, addChild an object to the current square location. So far my cod is not working as AS3 doesn't recognize the name of my textboxes or their locations.
fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[code].....
View 1 Replies
Jul 25, 2010
I am getting these errors when I try to run this program:
1120: Access of undefined property whiteRoll.1120: Access of undefined property blackRoll.
They are being thrown by the bold line in the code. I can trace the ionName property I have created, but I can't compare it to input text. How can I get this to work?[code]...
View 1 Replies
Feb 8, 2011
I have 25 textboxes on stage named sw1 through to sw25. I want to evaluate the contents of each box using a for loop.
for(var i = 1; i<26;i++)
{
var t = "sw"+i
trace (t.text)
}
I get this error message when I run my program:
Property text not found on Number and there is no default value.at Mastercalendar_fla::MainTimeline/frame1()
View 1 Replies