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


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 :: 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

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 :: 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 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

Actionscript 3 :: Array Syntax To Populate Flash Combobox

Jul 31, 2011

I've got an array that looks like this, iterating through:

(languageArray[i].languageName); //e.g. "French"
(languageArray[i].languageCode); //e.g. "fre"

I'm trying to populate a fl.controls.ComboBox dataProvider with this array. What I want to do is set the labelfield, as shown in the documentation:

[Code]...

In other words I want the name to be displayed, and the 'data' to be the code, which will be called when I click on the item. But the labelField is not the same as "French". How do I create the two fields in the array such that I can designate the first as labelField and the second as data?

View 2 Replies

Flash :: Dynamic MC's Path With LocalToGlobal?

Sep 27, 2010

I'm adding several instances of an MC (bread_mc) into a container MC (wall_mc). wall_mc has been added to a shop class and that is where i'm called the rest of my functions from. Also the wall_mc is scrolled left and right with mouseX & mouseY values. I've set up a function to add the bread_mc to the wall at different x/y positions.

[Code]...

I really don't even know if i'm using it right, But I think my problem lies in the fact that I need the currMC path to travel up the display list tree and get the global stage X/Y position. I'm not too sure how to implement a dynamic path with the localToGlobal method.

View 1 Replies

ActionScript 3.0 :: Eval - Making Dynamic Post Values To Post To A URL

Jul 15, 2010

I am making dynamic post values to post to a URL.

[Code]...

Maybe I am doing this the hard way with eval, is there an easier way, such as passing an array of post variables?

View 3 Replies

ActionScript 2.0 :: Loop Through Array Syntax?

Sep 15, 2009

I have an array like this:

Code:

var myData = new Array();
myData["name"] = "John";
myData["Age"] = 35;

What is the syntax to loop through and get the key and value? I have tried for each and for in but they just give me the value of "John" or "35", how can I get the key e.g. "Name" and "Age"?

View 2 Replies

ActionScript 2.0 :: How To Loop & Array Syntax

Sep 7, 2006

I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.

var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {

[code].....

View 2 Replies

ActionScript 3.0 :: Correct Syntax For Referencing Array?

Sep 6, 2011

I have a number of XMLList objects:
 
_xml.group1..image[i]
_xml.group2..image[i]
_xml.group3..image[i]
_xml.group4..image[i]
_xml.group5..image[i]
 Im trying to reference each object thus:
_xml.group[myVariable]..image[i]
 
But it doesnt work. What's the correct syntax?

View 3 Replies

ActionScript 2.0 :: Dynamic Rollover Syntax?

Jan 14, 2011

This works fine

ActionScript Code:
mc1.onRollOver=function(){mc1._alpha=50}
mc2.onRollOver=function(){mc2._alpha=50}

[code]......

View 7 Replies

ActionScript 2.0 :: Dynamic Pathnames, Dot Syntax?

May 10, 2006

I'm using Flash 8, and creating a dynamic XML driven menu.I can't for the life of me figure out the syntax to make a 2 dimensional path to a movieclip.I can reference a movieclip dynamically with: _root["main"+i].label.text but how can I reference a movieclip like this:

_root.main1.subBut1_1.label.text

Where "main1" AND "subBut1_1" are dynamically written.I've tried _root["main"+i]["subBut"+i+"_"+t] and _root["main"+i]["subBut"+i+"_"+t], no dice.

Code:
function loadXML(loaded) {
if (loaded) {[code].....

View 5 Replies

Arrays :: Flex Differences Between Array Collection Syntax

Dec 15, 2011

I was wondering what's the difference between doing [code]However type 2 seems to work, but more people seem to reference type 1

View 1 Replies

ActionScript 2.0 :: Refer From Array In A Function Gets Syntax Error?

Mar 12, 2012

I don't know what basic knowlege i missing here.I have two compiler error and don't know what to do about it.First says ") or , expected"Secondly "The class or interface 'BitmapData' could not be loaded."

Code:
listener.onLoadInit = function(mcTemp[i]:MovieClip) { // ") or ," expected
mcTemp[i]._visible = false;

[code].....

View 3 Replies

ActionScript 2.0 :: Code Breakdown In For Loop - Array Syntax?

Aug 29, 2006

I've got this loop and can't get it to work. It won't read the trace so I know the array call in my function statement is wrong but I can't see it at the moment. What am I doing wrong here? The rollover works when I write it out repetitively for the four buttons.

var btnAction:Array = new Array (oneBut, twoBut, threeBut, fourBut);
for (var i=0; i<btnAction.length; i++) {
this.menuMC.btnAction[i].onRollOver = this.menuMC.btnAction[i].onDragOver = function() {
trace("anything");
}
};

View 1 Replies

ActionScript 2.0 :: Array Syntax Error Or Sheer Impossibility?

May 31, 2008

ok, I got this doubt wich is kinda making me wonder for a while. scenario:_I've got a movieclip with a bunch of buttons inside that invoke a function and send parameters to it.no sweat so far._those buttons are named with a specific word followed by "_btn". that word is the same as the one that goes in the parameter. for example:ode:gobbledigook_btn.onRelease = function() {_root.myFunction(gobbledigook)}question:I'd like to be this work with a for loop, so I don't have to repeat the code for every button. so this is what I did:

Code:
_root.wordsList = ["bafflegab", "esculent", "kakistocracy", "palimpsest", "quincux"]
for(i=0;i<_root.wordsList.length;i++){

[code].....

View 2 Replies

ActionScript 3.0 :: Correct Syntax To AddChild() Using Array Index

Jul 27, 2009

I'm using addChild(new nmonster()) to populate an on stage MC from my Library.

Instead of specifying the Symbol, I want to add it using an Array reference, like addChild(new monsterArray[0]()). I've tried a number of variations, but AS3.0 is unforgiving.

View 4 Replies

ActionScript 1/2 :: Dynamic Layered MC Syntax For FOR Loop?

Sep 18, 2009

what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips: MC1.insideMC._visible=false   (which works, but isn't dynamic) but dynamically with a FOR loop. I've tried: For(bullet=1; bullet<5; bullet++){ "MC"+bullet.insideMC1._visible=false   (this does not work) } Does anyone know the dot notation or another way to do this? 

View 13 Replies

ActionScript 3.0 :: Syntax To Load From Library With Dynamic Name?

Jan 6, 2010

I have some movie clips in the library I am loading but I can't figure out the right syntax to get the librabry item dynamicaly so I had to resort to a chain of "if" statements. I left off all the extra stuff like position and addChild etc just to make the code more clear.

for(var i:int=1; i>4; i++){
addChip(i)
} function addChip(id:number) {
if(id == 1){
this["chip"+i] = new twoXchip1()
} if(id == 2){
this["chip"+i] = new twoXchip2()
} if(id == 3){
this["chip"+i] = new twoXchip3()
}}

So what I want to do, is instead of having 3 "if" statements - to just use the "id" value I passed in to identify the right chip in the library to load. My real if chain is actually much longer than three and it's difficult to update ..I know there's a better way to do it...but every way I try throws errors!

View 5 Replies

ActionScript 3.0 :: Syntax For Movieclip With Dynamic Child Name

Jan 12, 2012

How can I call the property of a dynamic child mc within a static parent mc? For example: a parent movie clip with instance name "parentMC" has four child movie clips with instance names "mc1", "mc2", "mc3", "mc4"

[Code]...

View 5 Replies

ActionScript 3.0 :: Loading External Data To An Array Syntax Error?

Jan 25, 2009

I'm trying to load data from an external text file into an array. I created an array and am able to load the data into an array if I explicitly say something like

ActionScript Code:
array[0] = event.target.data.uid1_name;

I can then do a trace statement on array[0] and it will output the correct name from the file. My problem is I'm trying to iterate through the variable names in the text file in the file by using an index variable. This is the code I'm using after doing all the URLloader, URLRequest, and so forth stuff:

ActionScript Code:
for(var i = 0; i<20;i++){
fArray
= event.target.data.uid_name;
}

This produces a syntax error. I've tried several other syntax variations but haven't been able to figure it out. I've also tried the following:

fArray
= event.target.data["uid"+i+"_name"];
fArray = event.target.data.["uid"+i+"_name"];
fArray
= event.target.data."uid"+i+"_name";

All three of those also give me errors. For the first one the trace statement outputs "undefinded" instead of "Doug". For the second I get "syntax error. Expecting identifier before left bracket". And for the third I get "syntax error, expecting identifer before uid.":

syntax to iterate the number after uid(uid1_name, uid2_name, uid3_name, etc)?

View 3 Replies

ActionScript 3.0 :: Loading External Data To Array (Syntax Error)

Jan 24, 2009

I'm trying to load data from an external text file into an array. I created an array and am able to load the data into an array if I explicitly say something like:
ActionScript Code:
array[0] = event.target.data.uid1_name;

I can then do a trace statement on array[0] and it will output the correct name from the file. My problem is I'm trying to iterate through the variable names in the text file in the file by using an index variable. This is the code I'm using after doing all the URLloader, URLRequest, and so forth stuff:
ActionScript Code:
for(var i = 0; i<20;i++){
fArray[i] = event.target.data.uid[i]_name;
}

This produces a syntax error. I've tried several other syntax variations but haven't been able to figure it out. Why syntax iterate the number after uid (uid1_name, uid2_name, uid3_name, etc)?

View 3 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 3.0 :: Array Syntax Object Reference In Loop Takes 4 Seconds To Run?

Nov 9, 2010

Can anyone tell me why the following is taking 4 seconds for Flash to execute:
 
_moleHoles = new Array();
var countingMoleHoles:Boolean   = true;
var holeCount:int               = 0;

[Code].....

There are 9 object on the stage (but this number could go up or down, that is why I'm dynamically grabbing these this way). So in my test case, this loop runs 10 times.
 
I have narrowed it down to something to do with the following line:
 
if (this['moleHole' + holeCount])
 
Is using dynamic (array syntax) object lookup that much of a performance hit?

View 2 Replies

ActionScript 3.0 :: Movie Looping After Starting Syntax With Stop Command, No Compiler And Syntax Errors?

Jul 14, 2011

using action script...
 
stop();btn001_btn.addEventListener(MouseEvent.CLICK,showimage1);function showimage1(event:MouseEvent):void { gotoAndPlay(10);}btn002_btn.addEventListener(MouseEvent.CLICK,showimage2);function showimage2(event:MouseEvent):void { gotoAndPlay(20);}
 
however movie is playing without stopping to "Listen" for a Mouse CLICK. Images placed at frame 10 and 20 should appear only when CLICK'd.
 
This code is straight out of Classroom in a Book CS4.

View 5 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