ActionScript 3.0 :: Make A Variable With For Loop?

Jun 8, 2009

Trying to pick up a movieClip  instance from my library and set it on stage and make it clickable, (dropdown/dropup) menu).

var MenuItem1:Array = new Array("text1", "text2", "text3","text4");CreateM(MenuItem1.length);function CreateM(Menu1:Number):void{
for(var i:Number=0;i<MenuItem1.length; i++){

[code]......

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Make A Loop That Can Create (and Use) Incremented Variable Names

Jul 28, 2010

I need to make a loop that can create (and use) incremented variable names. Basically I need to dynamically create a certain number of sprites and datagrids then I need to add these dynamically created datagrids and sprites to the stage. So the static code (which works, but I think is NOT the right way to go) would look something like this (I'm leaving out a bunch of stuff but this should give you the right idea):

[Code]....

But I can't figure out the syntax and how to make it work... This MUST be possible! My knowledge is pretty thin in actionscript,

View 5 Replies

Actionscript 3 :: Declaring Variable In Loop Or Before Loop?

Nov 9, 2010

Should I declare the _mcContainer var before the loop or no? (performance increase?)

for(var i:uint = _startIndex; i <= _endIndex; ++i){
var _mcContainer:MovieClip = _mcParent["i_" + _position];
}

[Code]....

View 1 Replies

ActionScript 2.0 :: Pass The X Variable From One Loop To Within Another Loop?

Mar 2, 2007

I have some code that seems to have a problem. I can't seem to pass the x variable from one loop to within another loop.

Code:
var myLv = new LoadVars();
var myNv = new LoadVars();[code]....

View 2 Replies

ActionScript 3.0 :: Make Application Variable Or Static Variable?

Oct 16, 2010

The Idea is i want to make avariable that stores his value after i close the swf and open ti again,

an example:

i make acounter

var i:int = 0;
var timer:Timer = new Timer(1000);
timer.start();

[Code]....

the value of i will increase but after i close the application and open it again the value will return to 0 , keep the variable stores his value after closing the application ?

View 3 Replies

ActionScript 2.0 :: Concatenate - Make The Variable Change With The Variable?

Jul 19, 2006

I'm trying to achieve something i thought would be extremely easy, but i can't get it to work!

[Code]...

View 1 Replies

ActionScript 2.0 :: Variable Name In For Loop?

Jun 25, 2009

I want to create several variables (actually tween objects) in a for loop. I want the variables to get names like "variable1" when i =1, "variable2" when i = 2 etc.

for(i=0; i<10; i++) {
}

How do i do this?

View 5 Replies

ActionScript 3.0 :: Using Variable In A Loop?

Sep 26, 2009

I am trying to pass the text from an input text box to a sender variable called variables. The first line of code works fine, but how do I make it dynamic so I can use a loop to load the "first" names into variables.first1, variables.first2, etc.This works great...

variables.first1 = this["first"+i+"_txt"].text;

But when I try to make the left side of the statement dynamic, it does not work.

this["variables.first"+i] = this["first"+i+"_txt"].text;

View 2 Replies

ActionScript 3.0 :: How To Get The 'i' Variable Out Of A For Loop

May 13, 2011

I have this code:

Code:
function playbackClick(e:MouseEvent):void
{

[code]......

View 4 Replies

ActionScript 3.0 :: Variable Definitions Using For Loop?

Apr 1, 2008

i need to create an arbitrary number of display objects using a for loop because the number of objects will depend on the number of items in an xml file.

so i want to control the objects using actionscript. in as 2 i could create a temp variable in the for loop and use attachMovie() and assign an instance name. i know in as 3 you can use the .name property, but i heard you had to use the variable handler to control the object.

so i can't do this because it generates an error:

var numOfItems:uint = 5;
for(var i:uint = 0; i < numOfItems; i++)
{
var mc[i]:MovieClip = new MovieClip();
}

View 21 Replies

ActionScript 2.0 :: Sending Variable To Php In Loop?

Oct 23, 2009

Code:
save_all.onRelease = function(){
for(var n=0;n!=cArr.length;n++){
///some other stuff

[Code].....

I want the php file to be sent the variable and loaded as many times as the length of the array cArr... lets say cArr is 16 pockets long... only the 16n from textsave array gets sent to flash via the lv5.specialVariable... I'd like the script to run 16 times, each time with the value of n getting sent as the specialVariable..

View 2 Replies

ActionScript 3.0 :: Accessing Variable With For Loop?

Oct 12, 2011

here is the wrong script:
 
var Var1:int=1;
var Var2:int=2;
var Var3:int=3;

[Code]....

View 2 Replies

ActionScript 3.0 :: Increment Variable In A Loop

Sep 12, 2009

I have an actionscript Tween that travels from the top of the stage to the bottom.I want to have a variable that displays the Y coordinate. To do this i have tried an if statement and a for loop, but none seem to work.[code]

View 5 Replies

ActionScript 3.0 :: Return Variable From Loop?

Sep 15, 2009

I am trying to make a hangman game and have made an array with words and picked one at random each time the movie is run and then taken that word and broken it apart into each letter. I then made a loop to create a new TextField for each letter. Then I set them all to "visible = false"I want to get to the point where if the user selects a letter that is in the word that that TextField with said letter will become visible. Only I cannot figure how to get a function outside of the loop to see the variables (i.e. instance names of the TextFields) inside the loop.Here is my code:

ActionScript Code:
var words:Array = new Array("HELLO","WORLD","JOE MAMA","ALIENS","ATTILA");
var letterArray:Array = new Array();

[code].....

View 3 Replies

ActionScript 3.0 :: Increment A Variable In A For Loop?

Nov 2, 2009

this is what I have:

[Code]....

In other words, I want the variable to increase by one each iteration of the loop. I'm sure there is a simple solution to this and I am currently banging my head against my desk

View 5 Replies

ActionScript 2.0 :: Dynamic Variable Value In For Loop?

Jul 7, 2010

I'm attempting to use a for loop to set the onPress functions of all the buttons on a keyboard. Here is what i'm using so far:

Code:
Target.text = ""
Letters = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_")

[Code].....

View 2 Replies

ActionScript 3.0 :: Variable Making Loop

Sep 7, 2010

[Code]...

so what i want it to do is making 10 varibles named Name1 - 10

View 9 Replies

ActionScript 2.0 :: Using The For Loop Variable In Function?

Mar 19, 2011

How would I use the for loop variable within a function contained in the loop?

ActionScript Code:
for (var i = 0; i<arrowNumber; i++) {
myVar=i;
tempHolder.onRelease = function() {

[Code]....

View 7 Replies

Actionscript 2.0 :: A Loop To Set Variable Attributes?

Feb 23, 2009

I need to set the false attribute to several variables but can't remember how to do it.

for (i=0;i<15;i++){
showPlayerCard+ i = false;
}

[code].....

View 1 Replies

ActionScript 2.0 :: Set A Variable And Create A Loop?

Jun 13, 2008

I need to set a variable and create a loop with this to optimize.I can get it to trace what I want, but the code isn't working properly.

mainAccordion.s1.menu_btn1._alpha = 90;
mainAccordion.s1.menu_btn2._alpha = 90;
mainAccordion.s1.menu_btn3._alpha = 90;[code]....

View 3 Replies

ActionScript 3.0 :: Declare Variable In A For Loop?

Jun 28, 2010

I am trying to replace all of the code below with a for loop.I also want to do the same thing with number variables as apposed to sprites.I have tried a bunch of things but nothing works yet.

Code:
var lineDrawing1:Sprite = new Sprite();
var lineDrawing2:Sprite = new Sprite();
var lineDrawing3:Sprite = new Sprite();[code].....

View 3 Replies

ActionScript 2.0 :: 'For' Loop Not Changing ._y Variable?

Jul 7, 2004

I have the following code:

PHP Code:

on (release) {
cNum = cNum+1;
for (b=1; b<8; b++) {
trace(["box"+b]);
["btn"+b]._y = ["btn"+b]._y+25;

[code]....

on release, the objects labeled btn1, txt1, box1, btn2..... should all be shifting 25pxs. It doesnt do anything.

View 5 Replies

ActionScript 2.0 :: Variable Button Values In Loop?

Mar 15, 2010

I have a query regarding assigning values to buttons in a for loop, I will explain:This is a string which I want to assign to a button value via getURL:

var myURL = "http://www.mywebsite.co.uk" + "/?Group=" + mySharedObject.data["destination"+i] + "&" + "SearchType=654&" + "Target=offers&" + "Paging=on&" + "HotelName=" + mySharedObject.data["hotel"+i];

[code].....

View 1 Replies

ActionScript 3.0 :: Setting Loop Variable For XMl Btns

Jul 8, 2009

I'm trying to set up a loop for a movieclip btn with the instance name "btnEnter". btnEnter is loading XML content from a file called menuDef.xml
 
Here is the code I have inplace so far,
 
//CODE//
var link: URLRequest = new URLRequest("menuDef.xml");var loader:URLLoader = new URLLoader(link);var i:intvar myXML:XML = new XML();//call the loaders load function to load the specified URL

[Code]....

Right now I have only the  item_spacing  and item_count variables in place, but I'm not sure of my next step?

View 5 Replies

ActionScript 1/2 :: Variable Inside 'for' Loop With Parenthesis

Sep 5, 2009

how Im going to put the i variable inside the [[[[ ]]]]] because I cant make it work for(var i:Number=0;i<products;i++){  _root.menu["product"+i]._x += (product[[[[[+i]]]]]x-_root.menu.product["product"+i]._x)/speed; }

View 5 Replies

ActionScript 3.0 :: Write A For Loop For These Variable Declarations?

Mar 28, 2010

I want to simplify my coding of the below code: 
 
var printImage1:MovieClip = new PrintImage1();var printImage2:MovieClip = new PrintImage2();var printImage3:MovieClip = new PrintImage3();var printImage4:MovieClip = new PrintImage4();var printImage5:MovieClip = new PrintImage5();var printImage6:MovieClip = new PrintImage6();
  
I tried everything I could think of but it still gives me compiling errors.

View 5 Replies

ActionScript 3.0 :: Keeping A Static Variable Within A Loop?

Feb 7, 2011

I need to keep my "grid" + [o] value from 1-9 but add to the to the gridArray number (hence currentNo) within this double loop.

[Code].....

View 10 Replies

ActionScript 2.0 :: Making A For-loop With Button Variable?

Jul 31, 2002

The situation is like this:I have Five buttons named button1 to Button5.What I want is to make one button invisible.To to this I have a for 1 to 5 -loop and I want to make one button invisible if it meets certain criteria.Is this possible without make an if-line for each button or not??

View 4 Replies

ActionScript 3.0 :: Get The Value Of The Variable Constantly Outside The Loop Function

Aug 11, 2010

What i want to do this time is to make a function that calculates the speed of a moving object and then assign this value to a variable, for global use (or just make an .as class and place the function there for general use. I made the loop function that calculates the speed of the object ("ball" is it's instance name), but i cannot find a way to assign the calculation's value as the result of the function "speed" that calls the loop. Or, a way to get the value of the "v" variable constantly outside the loop function. Here's my code:

[Code]...

View 3 Replies

ActionScript 2.0 :: Make Variable Within Variable?

Jan 10, 2008

I've searched around and wasn't able to find any solutions to my problem, which probably just means I'm going about this wrong way, but here it goes...I have a bunch of variables named like so:box0Wbox1Wbox2W

View 3 Replies







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