ActionScript 3.0 :: Arrays And Variable Names?

Jun 15, 2009

How/can you pass a array into a variables name?

var urlRequestArray:Array = ["home.txt", "contact.txt", "about.txt"]
var reqNameArray:Array = new Array("homeReq","contactReq", "aboutReq")
for (var i:uint; i < buttons.length; i++){

[code].....

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Dynamically Create Arrays With Variable Array Names?

Jun 17, 2010

i need to dynamically create arrays with variable array names.
 
for example, something like this:
  
for (var n=0 ; n < nodeContainer.length ; n++) {
nodeObj = nodeContainer[n];
var name:String = nodeObj.nodeID;

[Code]....

View 16 Replies

ActionScript 2.0 :: Load Variable Data From An External XML File And Dynamically Displays The Item Names In A Menu - Arrays - Functions

May 18, 2005

I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.

I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]

View 2 Replies

ActionScript 3.0 :: Instance Names And Variable Names: It Goes Deeper

Mar 20, 2011

I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.

Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by

trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);

the output window gives me

drawer
instance2

Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:

drawer.x can be set;
instance2.x can (as we know) not be set.

But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?

I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?

View 8 Replies

Arrays :: Get The Key Names Of An Array?

Mar 14, 2011

I've been seaching on how to get the key names of a flex Array as there is no such function in the Array class. Here is my answer that may be usueful to any of you.

View 2 Replies

ActionScript 3.0 :: Arrays - Dynamic Field Names?

Mar 3, 2010

I need to create dynamic arrays with field names loaded from a database. So, the names for the fields will be always different.Then, suppose I have the names "product" and "color" to create the following array structure dynamically:var myarray:Array = new Array;myarray[0] = ({product:undefined,color:undefined});But in other ocasion, the names may be say "brand" and "model", so the array will be:myarray[0] = ({brand:undefined,model:undefined});

View 1 Replies

Actionscript 3.0 :: Dynamic Building Arrays With MovieClip Names?

Apr 30, 2009

In the AS2 days you could create an array and add a bunch of Mc names to it like so

Code: Select allarray("clipA","clipB","clipC", etc..)

Then you could use this array to reference clips dynamicly or on stage to do stuff.I was trying to do the same with AS3 but came across a problem I've not found an answer to yet. I created the following code:

Code: Select allvar letterArray:Array=new Array("A","B");
var buttonArray:Array = new Array();
//

[code]....

Now with the line:

Code: Select allvar currentButton:MovieClip = buttonArray[i];

I get: Type Coercion failed: cannot convert []@369e8581 to flash.display.MovieClip.but if I remove that line, it works. My problem is that I need to make it a "var" of type movieclip before I can assign a listener to it. Why can't I build an array of movieclip names using:

Code: Select allbuttonArray.push(["button"+letterArray[i]]);

I have seen arrays in the past that contain:

Code: Select allarray(mc1,mc2,cm3, etc...)

but notice that it's just using the name of the clip and not array("mc1","mc2","mc3", etc..)

View 6 Replies

ActionScript 3.0 :: Call A Button Inside A MovieClip, With Names Stored In Arrays

Mar 10, 2012

I have an Arrays that contains the names of MovieClips:

Code:
var MyMCs:Array = ["A","B","C","D","E"];

The actual MovieClips names are "MC_A", "MC_B", etc..., I use this method so I reuse the same Array for multiple tasks, I simply add what ever it's needed to the name to match the task at hand. On this case I add "MC_".

Then I have multiple Arrays, with the same names of the values of MyMCs. The values of each these Arrays are the names of buttons that are inside the movieclips of MyMCs:

Code:
var A:Array = ["RR","TT"];
var B:Array = ["YY","UU"];
etc...

I could add a listener to a button this way:

Code:
MC_A.YY.addEventListener(MouseEvent.CLICK, DoSomething)

My problem is that i want it to be done dynamically, using the Arrays values in a loop to add Listeners to the all buttons. The loop system is not a problem for me... my real problem is in the dynamic attribution itself.
Here is what I have:

Code:
//'i' and 'j' have previously been created
for(i=0; i<MyMCs.length; i++){
for(j=0; j<this[MyMCs[i]].length; j++){

[Code]....

I know that this is correct since I tried them separately and I can trace the proper values.

I know that my problem is in the "this" since I get an error message stating:
1084: Syntax error: expecting identifier before this.

I suppose it should state something else... I tryed with "root", "parent", "child", "MovieClip"... with no luck...

View 2 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable?

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)

I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.

Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)[code]...

View 2 Replies

Actionscript 3 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).

My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)

So my buttons as well as loading the image have the event listener:

image1_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
image2_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
(and so on..)
function setCurrentSelection(e:MouseEvent):void {

[Code]...

So within the rotateClockwise and rotateAntiClockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_loader - it needs to be image1_content, if 4 - image4_content... I had tried to do it as this but it doesn't like it being a string:

rotateAroundCenter((activeLoader+'_content'), 10, ptR);

View 3 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.)I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)So my buttons as well as loading the image have the event listener:[code]So within the rotateClockwise and rotate Anti Clockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_ loader - it needs to be image1_content, if 4 - image4_content.I had tried to do it as this but it doesn't like it being a string:[code]

View 3 Replies

ActionScript 2.0 :: Create A Loop That Will Put A List Of Names From External Sources Into A Number Of Arrays?

Jul 3, 2006

i am trying to create a loop that will put a list of names from external sources into a number of Arrays .so what i did is :

Code:
for (i=0; i<4; i++) {
this["loadVarsText"+i] = new LoadVars();
this["loadVarsText"+i].onLoad = function(success) {

[code].....

and i dont understand why it is not working, and how can i fix it?

View 3 Replies

ActionScript 2.0 :: Create Variable Names Using My Percentage Variable?

Dec 4, 2005

I'm currently working on an advanced preloader and i'm creating loads of different variables etc. based on the percentage loaded. I need the variables to be named Number + percentage, so in the end I will have Number1, Number2, Number3, Number4 etc. How can I create variable names using my percentage variable? Can't seem to find anything that answers my question.

View 2 Replies

ActionScript 2.0 :: Using XML For Variable Names?

Jun 19, 2007

I'm attempting to build a menu using a XML. I have read the tutorial on the site and I am attempt to do it in a slightly different manner. Anyways, I am trying to make dynamic variable names for my text fields. And because of the way I am doing this I found it easier to try to use XML to hold the field name. But when I try to use the name from the XML file it won't work. I can trace it and get the proper word but when used in the script it breaks.Below I want to replace 'popMenu' with the fieldName variable.

Code:
mainMenu.menu1.onRollOver = function(){
listLength = menu_xml.childNodes[0].childNodes;

[code].....

View 1 Replies

AS3 :: IDE - How To Concatenate Variable Names

Nov 24, 2007

How do I concatenate variable names in AS3?Something like this:

for(var i:int=0 ; i<5 ; i++) {
var "myVar"+i:Array = new Array();
}

View 5 Replies

CS3 : Automatically Assign Variable Names?

Jan 27, 2010

I'm working on a project using google maps. For part of it the user must enter coordinates and click a button in order to add a marker to a map. The code I have written so far allows this to be done once:

play_btn2.addEventListener(MouseEvent.MOUSE_DOWN, submitdata);
function submitdata(e:Event){
var marker9:Marker = new Marker(

[code]....

As it is the only one marker can be added as it keeps getting replaced. I want to make it so that the variable name changes each time a marker is to be added.

View 2 Replies

Flash :: Use Variable Names In Actionscript 2?

Feb 19, 2011

I'm looping over an array named shopData and need to use values within that array to create new variables. Inside the loop, I'm trying something like this: shop_(shopData[i].shopName).keyword = shopData[i].keyword; but I'm having trouble with the portion in () and can't seem to find the right syntax for this. Assuming shopData[i].shopName = "foo" I need to create a variable named:

[Code]...

View 1 Replies

Flash :: How To Concatinate Variable Names In AS2

Jan 27, 2012

I'm trying to loop through a set of textFields that I created in the Flash IDE, and named them through the property panel with name called "dot_text1, dot_text2, etc...). These textfield elements are nested in another movieclip called "bouquet".

My issue is that I'm trying to loop through all of them and store them into an Array for later use, but I keep getting undefined when I trace it out. I'm writing the script in the root of the file.

[Code]...

View 1 Replies

ActionScript 2.0 :: LoadVars Variable Names?

Jun 18, 2009

I am using loadVars to get strings from a text file and then I loop it to put them all in an array. But as indicated in the code, I want to check the variable name so a certain named variable will be put into a different variable, not the array. I have not been able to find how to check this...everything I try gives me undefined.

ActionScript Code:
myVars.onLoad = function(success) {
if (success) {

[code].....

View 0 Replies

ActionScript 2.0 :: Variable Names Sent Via POST?

Nov 14, 2009

I'm working on a simple form in AS2 that will send some variables via POST. These are being sent to a CMS in the background. Unfortunately, the CMS mandates that the variables must be named a certain way. They must be named fields[thefieldname] which really messes up the Actionscript involved. Does anyone have any thoughts about how I could escape these [ ] characters so they don't get interpreted wrongly as an Array by actionscript?

Code:
on (release) {
var msg:LoadVars = new LoadVars();

[code]......

View 1 Replies

ActionScript 2.0 :: Using The # Sign In Variable Names?

Apr 11, 2011

Can I use the # sign in AS2 variable names?

like ->> var item_#_productName = "test"

I must use a list of preset varilable names but I am getting a syntax error when I use the # sign.

View 2 Replies

ActionScript 2.0 :: Incremental Variable Names?

Jul 20, 2011

I'm having a few issues with incrementing numbers in variable names, was wondering if I could getThe below code is what I'm trying to implement, but I keep getting errors.

Code:
for( var i = 0; i < __values.length-1; i++)
{

[code]......

View 6 Replies

ActionScript 3.0 :: Incrementin Variable Names And FlashVars?

May 28, 2009

I send flashvars to flash. Those variables are one user id variable and unknown number of corresponding friend and relation vars (friend1, friend2, relation1, relation and so on, all the items from DB).I get the of course from an object:Code:var flashVars=this.root.loaderInfo.parameters;and check how many friends did the php send to me . There is one user id variable and an even number of friends and relations so the way i check how many mates do i have is:

View 1 Replies

ActionScript 3.0 :: Dynamic Names For Class And Variable?

Sep 20, 2009

How do you make a new instance of a class with a dynamic name.

var dynamicname = new dynamicname()

i try something

var this["test"]:Class = new ["Test"]()
 
but offcourse its not this...

I need this couse i have a librairy with SWC fonts they are only reference.. I get the font name from a CSS file and after i need to make a instance of the SWC file so the font is embedded.

View 3 Replies

ActionScript 3.0 :: Dynamically Created Variable Names?

Jan 22, 2009

After some further testing, I found out that under Actionscript 3 XML (E4X) I'm unable to use dynamicaly created variable names...

The famous:

Code:
var i:number = 111
this["someVarName" + i] = "actual_value"
trace(someVarName111) // = actual_value

does not work for me with E4X lingo...

Code:
var myXML:XML
myXML = "...." //asume valid XML content here
trace(myXML.XMLData.@Memo_EN)

[code]....

View 0 Replies

ActionScript 2.0 :: Dynamic Variable Names When Out Of Root?

Jan 11, 2010

This is an example of the kind of issue I'm trying to solve. Say I'm looking to set 10 text fields (text_field_1 to text_field_10) within my movie clip 'myMovieClip' to the value of i. Now if the for loop and the text fields are in the place (_root) all I would have to do is:

ActionScript Code:
for (i=1; i<10; i++)
{

[code]....

View 3 Replies

ActionScript 2.0 :: Variable Name Be To Get To Start Of Image Names?

Feb 18, 2005

I want to parse the image names in the following XML into an array:[code]What would the variable name be to get to the start of the image names?[code]

View 1 Replies

ActionScript 2.0 :: ASP And Dynamic Variable Text Box Names

Nov 23, 2005

Having a problem with a Flash/ASP/Database project.I've seen tutorials that pulls address book listings dynamically from the DB. When you hit "next" button it just populates dynamic text fields with variable names like "name" "address" with the appropriate info. Problem I'm having is.. what if you want to display all the entries on the same screen.If the variable names on the dynamic text fields are hard coded named "name" "address" "phone number" etc. , how can the second set of info display underneath the first one properly and not just pull the same text from the first record into the text fields? (name2, address2, etc.)

Is there a way to dynamically change the variable name of a dynamic text field? I'm thinking you should be able to have it note how many records there are, then loop until it reaches the end of the record set. So, can the variable names be dynamic so it will populate the text fields with the appropriate info?

View 1 Replies

ActionScript 2.0 :: Dynamically Assigning Variable Names?

Mar 29, 2007

dynamically assign variable names from XML? For instance, if I have an XML file with a list of variable names and their respective values, can I make my Flash movie create these variables?

View 5 Replies

ActionScript 3.0 :: Dynamically Creating Variable NAMES?

May 8, 2009

use a loop to create a set of variable names. The forums have figured out how to do this in AS2. This works in AS2...

PHP Code:

for(var x=0; x<3; x++) {    this["var"+x] = x;}trace(var1); // 1trace(var2); // 2 

View 4 Replies







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