ActionScript 2.0 :: Eval New Array From String?

Jun 21, 2008

I am passing flash a variable in string format and it looks like this

var stringVar = "new Array(new Array(1,3,4),new Array())";

Now i need to make an array out of it. I tried this:

var stringArray = eval(stringVar);

but had no success.

View 4 Replies


Similar Posts:


ActionScript 2.0 :: Any Way To Eval String Into Array?

Dec 9, 2010

I have a response coming in from a server that contains a ton of strings that I need to eval to have them replace arrays already set as globals. So program fetches response, evals string into an array, and then we do stuff with the array. I've played around with little tests and can't get it working.

ActionScript Code:
var superArray= new Array('3','4');
var testArray="superArray=['1','2']";
function testEval() {
eval(testArray);
trace(superArray);
[Code] .....

View 1 Replies

ActionScript 2.0 :: Any Way To Eval A String Into Array

Dec 9, 2010

stuck on a bit of code, trying to transition a program over from JS to AS2 flashlite 3.1.So here's the deal, I have a response coming in from a server that contains a ton of strings that I need to eval to have them replace arrays already set as globals. so program fetches response, evals string into an array, and then we do stuff with the array.I've played around with little tests and can't get it working. This is a dumbed down version of what I need to happen.[code]

View 3 Replies

ActionScript 2.0 :: Eval ( String) - String Is "myArray[1]" - Get Nothing

May 8, 2002

I have an array like this: myArray = ["a", "b"] I have a function with argument y like this: x = eval (y + "[0]") if I call the function with y="myArray" I am expecting "a", but get nothing.

View 3 Replies

ActionScript 2.0 :: Looping Non-array Variables With Eval()

Sep 3, 2003

I want to do a for loop that grabs values from different variables. This function works nicely without the eval() statement (using the commented line below it) but not with it.

function saveData ()
{
saveUrl = "savedata.php?";
for (count=1; count<=numberOfVariables; count++)

[Code].....

View 14 Replies

ActionScript 1/2 :: Eval Or Array Push - Storing Variables And Displaying It?

Mar 9, 2011

I have a variable call php_variable that loads from the php. It echos all the necessary variables. I have 2 array, Tel_start and Tel_area. The messages.text is just a text field I use to test if things are loading properly.

[Code]...

It display the correct string. But when I use Tel_start[0] like above, I got undefined. So here, the actual quesetion, what's the proper way of storing those variables and displaying it?

View 9 Replies

ActionScript 3.0 :: Flash Dynamic Eval Of Path Using Array Syntax

Jul 29, 2010

Having a hard time trying to resolve this issue, done a bit a of digging but can't find what i'm after. I'm pretty new to AS3 but know that Eval() has gone and been replaced with [] syntax. However, i'm trying to access a dynamic path to a clip and it seems that the array syntax will not allow more than one variable in a path.

[Code]...

View 2 Replies

ActionScript 3.0 :: Check If Any String Of An Array Is Matched To The String?

Feb 3, 2009

I am looking for a way to check if any sting of the Array is matched to the string that in the TextField. In the code it should be something like that:

Code:
var TestString:Array = new Array ("chicken", "cat", "dog");
function LookStringArray(){
if (TestArrayTextfield_txt.text == (anyString.TestString)){

[code]....

View 2 Replies

ActionScript 2.0 :: SortOn(DECENDING) For The Number Array And Then Have The String Array Sort To Match

Jun 14, 2007

I have two arrays. One contains numbers and the other contains strings. I want to do a sortOn(DECENDING) for the number array and then have the string array sort to match. if my string array is

[Code]....

View 6 Replies

ActionScript 3.0 :: Get Array Position Of Clicked Item To Fetch String From Another Array?

Mar 23, 2010

I put my mc's in an array.I have another array with strings.when the mc is clicked I want to get its position in the mc array and return the string from the same position in the string array.How do I do that?

PHP Code:
var numBtnArray:Array = new Array;
function addNumButtonsToStage():void{

[code].....

View 4 Replies

ActionScript 3.0 :: String.split(" ") - Spilt String Into 2 Parts And Save Them Inside An Array

Jul 12, 2011

I have a string that contains a full name input, and I would like to spilt them into 2 parts and save them inside an array, first name and last name. How do I do it with string.split? My current code is myNameArray = str_adminInput.split(" "); This code only works if the names are : Jack Lee, June Poh. This code does not work if the names are: Lee Tok Kong, Tan Beng Seng.

View 7 Replies

ActionScript 2.0 :: Use Hittest And Eval?

Jul 24, 2005

when I use hittest and eval?

View 1 Replies

ActionScript 2.0 :: Using Eval For +/- Calculations ?

Apr 29, 2008

Basically I want to eval() a string like _level0.mc._x-=dist; where the "-" or "+" is a variable.You can paste this straight in and it should work.. only the last part (where it's doing the eval) doesn't.

Code:

this.createEmptyMovieClip("mc",this.getNextHighestDepth());
_level0.mc._x=200;
_level0.mc.createTextField("txt",_level0.mc.getNextHighestDepth(),0,0,200,200);[code]......

View 2 Replies

ActionScript 2.0 :: Eval LoadMovieNum Is Not Working?

Aug 16, 2011

i'm new to flash programming. the code below is not working.[code]

View 3 Replies

ActionScript 2.0 :: Using Eval To Check Through All The Objects?

Feb 25, 2003

I was reading another query on this board about NOT using eval, as it had become deprecated, for attaching a name to a new MC. I have been using eval to check through all the objects, and to add ones with a certain name to an array.

for (i in this) {if ((typeof (eval(i))) == "movieclip" && substring(i, 1, 5)== "names") {

would there be another method of doing this using dot notation? sorry if this question seems a little muddled. I am new to flash, some things in it make a lot of sense and others are still confusing me.

View 3 Replies

ActionScript 2.0 :: Instance Name Not Eval'ing Correctly

Apr 28, 2003

I have a global map, when the user selects a continent it loads a seperat swf for that area. The continents grab variables from a database, and bring a bunch of variables into the movie.

One group is for the names of countries. It grabs the country name and it's 2 letter code. Then passes the country name to the local movieclip with that same instance name.

This works well for the most part. A couple countries don't load. Right now I'm looking at Asia. The country od Malaysia with it's code of "MY" produces errors half the time. Well most of the time.[code]...

View 1 Replies

ActionScript 2.0 :: Eval And [] Differences (looping Fct)

Jul 25, 2008

I'm not really good at figuring out how to do some things in Actionscript and I'm confused about looping throught functions with thins like eval. Here's my code :

[Code]...

I'm trying to loop to dynamically create functions. I have 5 boutons and I don't want to duplicate 5 times the same code. This code works but I don't seem to be able to use the same eval trick on the variable "blnBtn05". Anyone knows why and how can I be make it work?

View 4 Replies

Javascript :: Eval Throwing Error With Try / Catch

Nov 29, 2011

I have an air application, in which the user types javascript in a textarea, and it is eval'd in an mx:HTML component, but even with try/catch around the eval, and around the code in the eval, and an HTMLUncaughtScriptExceptionEvent handler, it still throws an error. htmlWindow is html.htmlLoader.window.

[Code]...

View 1 Replies

ActionScript 2.0 :: Using Set And Eval Functions Setting Variables?

May 12, 2006

I'm having problems in setting three variables using a for loop and then passing these variables to my function. I think it's something to do with the set function I'm using, because my colorFadeTo function claims it's being passed an undefined variable.

Code:
for (var i=0; i<circles.length; i++) {
var current = circles[i];

[code].....

View 1 Replies

ActionScript 2.0 :: Eval Usage On The Left Of Equals?

Apr 1, 2007

I'm sick of writing long scripts or being locked in certain cases to not being able to use dynamic features because I don't know how to use things like eval on the left side of the equalsHere's an example

Code:
base.mitem1y = mitem1._y
base.mitem2y = mitem2._y

[code]....

View 3 Replies

ActionScript 2.0 :: Eval() Versus [] Use In Nested Loops?

Jan 23, 2008

why code snippet #1 works, but code snippet #2 doesn't? i thought the array operator would work in this case...

CODE SNIPPET #1:

Code:
for (i=0;i<products.length;i++)
{
// XML data code
for (j=0;j<prodItems.length;j++)

[code]....

View 3 Replies

ActionScript 2.0 :: EVAL To Apply Text Variables?

Jul 19, 2003

I have a clip containing 8 MCs, named id1, id2 etc, each of which contain a dynamic text field with the variable thisNo. I want to run a loop that inserts each digit from a randomly generated number into each of these MCsPatID is the random number, IDLength is it's character length.

for (i=1; i<(IDLength+1); i++) {
thisNo = PatID.substr(-i,1);
eval("id"+i).iconNo = thisNo;

[code].....

View 6 Replies

ActionScript 2.0 :: Convert Eval() Flash 5 Code To It?

Jul 27, 2010

I'm trying to update an old flash 5 site I made years ago so that I can put video clips in it. I opened the file is flash cs3 and compiled just to see if it would work as is before modifying. It's hanging on a bunch of code, all which have eval() in them. It's been a loooong time since I coded actionscript so while I know that the bracket syntax is what I should be using, after trying various ways of writing it I just can't figure it out. Can someone tell me how the following should be written in Actionscript 2.0 and I can extrapolate from there?[code]...

View 1 Replies

ActionScript 2.0 :: Eval Methods - Dynamic Object Name Creation

Mar 9, 2009

I'm having problems with my usual eval methods of creating objects to read off dynamic values programmatically using concatenation. I've found the set command doesn't seem to work with objects that are dynamic....

Code:
function createobject(item){
//create it and store something in it
set ("_root.item"+item.stored, "data storage test for item "+item);
}function checkobjects(){
for (i=1;i<5;i++){
checkit=eval("_root.item"+i);
trace("_root.item"+i+".stored="+checkit);
[Code] .....

Running this produces the output of...
Code:
_root.item1.stored=undefined
_root.item2.stored=undefined
_root.item3.stored=undefined
_root.item4.stored=undefined

How to do this - basically I'm trying to load data, then use that to create dynamic objects and values within it, then I'm trying to work with those values by again using loops to read off the dynamic values during runtime. Obviously if these were "fixed" variables, then it would be easy, problem is that its impossible to use the new Object() command with dynamic names!

Previously I've used this:
Code:
checkit=eval("_root.item"+i+".stored);
trace("value is "+checkit);
Is it my imagination, or was this stuff a lot easier to do in AS1?

View 2 Replies

JavaScript :: How To Dynamically Call Function At Runtime Without Using Eval

Nov 11, 2011

I'm trying to build an API in JS that will perform some operations and then execute the callback that's registered in AS when it's done. Because it's an API, I am just providing a JS method signature for another developer to call in Flash. Thus, the callback name that's registered in the AS part of the code should be a parameter that's passed in to the JS API in order for JS to communicate back to Flash.

For example:
[AS3 code]
ExternalInterface.addCallback("flashCallbackName", processRequest);
ExternalInterface.call("namespace.jsFnToCall", flashCallbackName);
function processRequest(data:String):void {
//do stuff
[Code] .....

Because the definition of the function is in AS, I can't use the window [function name] approach. The only way I can think of is to build the callback in a string and then use the eval() to execute it.

View 2 Replies

Flex :: Add Array To URL String?

Oct 5, 2011

I know this questions is going to have an easy obvious answer but i have spent over two days now trying to do it with no luck (I am a Flex newbie)Basically i am trying to open a webView that will open google maps to the location in an array

The location comes from data in an array taken from facebook events (that works fine and will display the data) but i am struggling with passing this information to the webView.loadURL string

The data i want in the array is 'data.location' (the code i am having issues with is in the itemrenderer towards the bottom of the code snippet)[code]...

View 1 Replies

ActionScript 2.0 :: Get A New Array From Such A String?

May 30, 2010

i am a new learner of as and wanna to parse the str:String="tom||boy||16**suan||girl||18**" for a new array to be put into a datagrid, like a table. it is supposed to split "**" firstly to array, then to split array's item by "||". but i am stuck here. do not know how to do that.my code is below, but not does not work.

var str:String="tom||boy||16**suan||girl||18**"
arr1=str.split("**")
trace(arr1[0])

[code]......

View 2 Replies

ActionScript 2.0 :: [FMX] String To Array?

Feb 13, 2004

I'm using the loadVars object to import variables from a text file that I'd like to import to flash as an array.For example if the variable I import from the text file looks like this:&myVar=charlie,dog,cat,test&I'd like to get it into an array in Flash like thismyArray = new Array["charlie","dog","cat","test"];

View 14 Replies

Actionscript 3 :: Execute Arbitrary Code In Flash Like Javascript's Eval()?

Apr 1, 2010

Is there any way to execute arbitrary code in Flash, like javascript's eval()? I'd like to take some code as a string and execute it, if possible

View 2 Replies

Actionscript 3 :: Flash Eval() - Receive The Number And Then Play The Sound

Aug 13, 2011

I have 15 sounds in my fla; I imported them to the library and exported all sounds with the name s1, s2, s3, ... s15 I created a function that recieve the number and then play the sound. In AS2 I could use eval like eval("s" + n), but in AS3 I can't!

[Code]....

View 2 Replies







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