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


Similar Posts:


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 2.0 :: Correct Syntax For Passing 2 Values?

Apr 3, 2006

is this correct:

getURL("webform1.aspx?id=0&status=I",0,"Get");

I need to pass 2 values

value 1 is id
value 2 is status

View 2 Replies

Flex :: MXML Class Referencing Syntax?

Mar 17, 2011

I'm having a problem that has been really getting to me for the last 12 hours or so and I can't seem to find the answer anywhere. I know it's something simple, but I just don't know the correct syntax.

I've got a Flex Application in Flash Builder 4 with a file called "Test.mxml" which looks like this (simplified):

[Code]...

View 1 Replies

ActionScript 2.0 :: Correct Syntax For Declaring A Variable Within A Loop?

Mar 25, 2007

Whats the correct syntax for declaring a variable within a loop? Something like this:[code]

View 1 Replies

ActionScript 2.0 :: Whats The Correct Syntax For Declaring A Variable Thats Name Changes According To A Different Variable

Dec 21, 2007

I'm trying to do something like this:

[Code]....

whats the correct syntax for declaring a variable thats name changes according to a different variable.

View 2 Replies

Actionscript 3 :: After Shuffling Array - Variable = Array[index] Gives 0, Trace(array[index]) Gives Correct Number

Aug 16, 2011

I think it would be simplest to explain it like this:

[Code]...

View 1 Replies

Flash :: Referencing Mc's From An Array To Then Assign Further Array Properties?

Oct 15, 2010

I have a number of 'items' (mc's) contained in a scrolling mc that can be drag-dropped to other matching mc's. The items names are listed in an array and I wish to assign variables of suitability and feedback to each mc from the array also. I think this is called an associative array?

Having some trouble correctly referencing the items from the array. To explain, here's a working script with a simple array and an inefficient workaround:

[Code]...

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

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 :: 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 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 :: Referencing Loaders In An Array?

Jun 28, 2010

I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need toHowever, this doesn't work as I had expected. I.e. (using just two level for simplicity):

Code:
private var photo:Loader;
private var photoLarge:Loader;

[code].....

View 4 Replies

ActionScript 3.0 :: Referencing Array Element By Name?

Mar 9, 2009

I've got an array containing various sprites... I'm wanting to reference the sprite I want by its name rather than its index in the array, and was wondering if theres a simple way of doing this? I know I could do a for loop through all the array elements and see which one has a name that is equal to the name im looking for, but is something along the lines of myArray[elementName] possible?

View 5 Replies

ActionScript 3.0 :: Referencing Objects In Array?

Feb 25, 2010

I've created a for loop to do the following:add instances of button MovieClip from library to stagename the instances via name propertyadd instance names to array for later referenceadd event listenershese 4 steps are working peachy, however, I'm having troubles referencing these instances later on through my code. I'm pretty sure that the problem is in my data types not matching, but I'm not sure how to fix it.

var menuBtn:mc_menuBtn;var menuBtnList:Array = new Array();
for(var b:int = 0; b < numFiles; b++){  //add instances to stage  menuBtn = new mc_menuBtn();  testClip.addChild(menuBtn); //adding button instances to

[code].....

View 5 Replies

ActionScript 2.0 :: Referencing An Object In Array?

Nov 3, 2009

I was wondering if anyone could tell me how to access a certain object in an array. for example, I created an array of buttons displayed on the stage. Now I need to attach an onRelease command to each one to launch a new image on the stage.e going round in circles with this. I have attached the code below for reference:

thumArray = [];
function thumbs(){
for (i=0; i<totalImages; i++) {

[code].....

View 1 Replies

ActionScript 3.0 :: Referencing Movieclip In Array

Jun 13, 2011

Just learning as3. For testing purposes, I duplicated a movieclip 4 times on the stage and gave each mc a different instance name and put them in an array ("line1","line2","line3","line4"). Then I just want one movieclip to move 200 pixels based on the conditions of the array. Here is the code:

var stuff:Array = new Array("line1","line2","line3","line4");
for(var i:int=0;i<stuff.length;i++)
{
if ((stuff[i]) == "line4") {
trace(stuff[i]);
var duke = (stuff[i]);
[duke]y += 200;
}
}

It traces out the correct mc (line4) but ALL the movieclips move 200 pixels instead of the one (line4). Do you know why this is? I have a feeling that [duke]y is not the correct way to reference the movieclip.

View 2 Replies

ActionScript 2.0 :: Referencing Array Index?

Aug 25, 2011

I have three placeholder images, the contents of which are populated by an array ("galleryArray").These three placeholders are titled "placeholderLeft", "placeholderCentre" and "placeholderRight".

the contents of "placeholderLeft" will be: "galleryArray[n-1]"
the contents of "placeholderCentre" will be: "galleryArray[n]"
the contents of "placeholderRight" will be: "galleryArray[n+1]"

[code]...

View 6 Replies

ActionScript 2.0 :: Referencing To Array In Parent?

Jan 4, 2007

I have an array defined in the main timeline to store some values. At some point of time, I am dynamically adding a movieclip to stage using attachMovie and then using a movieClip.onEnterFrame event to set one of its values by referencing to one value from the main array.(Sorry if the following description sounds a bit confusing. I am attaching a part of the code below to help describe the situation) The problem is that it is not able to retrieve the value from the main array no matter what I try. I tried adding a "_root" befor the array name and the index array id but it did not work. Not only that but the trace shows that it is able to retrieve the index id as well as the full array but not any particular value from the array - as in, trace(arrayname) outputs all the values from that array but trace(arrayname[a][b][c]) gives an output 'undefined'.

I have managed to make it work by creating a temporary variable to store that particular value just before the onEnterFrame event kicks in, but I would love to know why it is not working the way I thought it should. Here is a part of the code. If someone needs more info about the code then please ask and I will give it in the next post (The full code is way too large to be posted here)

ActionScript Code:
//------In main timeline
var movesNum:Number = 0;

[code].....

View 3 Replies

ActionScript 2.0 :: Referencing An Array Value Globally XML?

Mar 2, 2007

I have been trying to get this right for a few days now, but I am stumped. This code runs on the first frame of my movie:

Code:
_global.headingText = new Array();
_global.captionText = new Array();
_global.contentText = new Array();

[Code].....

View 1 Replies

ActionScript 3.0 :: Referencing From An Object Within An Array?

Oct 16, 2011

I have a several objects nested within an array. I'm trying to reference a property of one specific object (intel).

function eventGenerator():void
{
var randomArea:Number;
randomArea = Math.ceil(Math.random()*5);

[Code].....

ainPlace names is the array's name. The random area variable contains the co ordinate on the array for the object. Each object on the array has a property called intel. The idea is I want to able to store the value of intel in a number and use in an equation. I would also like to be able to adjust the number. the trace function here returns an error saying it is undefined so eventArea.intel for some reason isn't referencing the intel property of the object.

View 3 Replies

ActionScript 2.0 :: Array Name Referencing With A Variable?

May 2, 2005

fairly simple question (with a long explaination). I have an array, created from the results of another array and it's position in that array. There are actually multiple arrays It can be created from.

Eg.
Array1: clientName1, clientName2, etc.
Array2: clientType1, clientType2, etc.
Second Array: [clientName1,0], [clientName2,1] OR [clientType1,0] etc.

[Code]...

My issue is, I would like to be able to dynamically adjust the array that it is generating from. This would mean changing the bold bit of the code above. I have tried declaring a variable (type = names+"[i]") and using it in the linkArray declaration, however it will not see this as an array reference, only as a variable. What I want to know is, how do I reference the name of the original array as a variable so I can update it dynamically?

View 5 Replies

ActionScript 2.0 :: Array To Check If The Question Was Correct

Dec 16, 2006

I've created a quiz with 50 questions that is linked to a score page that the user can access at anytime to see which questions they have right or wrong. this score page has 50 ticks for when the user gets the question correct. what is need help with is trying to get an array to check if the question was correct and if so turn to tick to _alpha = 100; once each question has been answer correctly a _global var is passed and the if statement picks it up

[Code]...

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







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