ActionScript 2.0 :: How To Remember Iteration Numbers

Oct 25, 2008

I have this code.
for (i=1; i<6; i++) {
this.attachMovie("myMovie","unit"+i,i);
this["unit"+i]._x = i*100;
this["unit"+i].onRelease = function() {
trace("Unit number " + i + " was pressed");
};}
I want to trace the number (i) of the button that is pressed. But no matter what button I press, I always get the value '6' on my trace. Isn't there a way to store the a value for i in each movie clip attached?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Show Steps Of An Iteration In It?

May 28, 2009

I did an ActionScript 3 version of my old algorithm made in c language to solve the �Tower of Hanoi� puzzle.

The problem is that I knew how to show the intermediary steps in c language but I don�t know how to do that in ActionScript 3.

The below .as file code uses just three disks of successive bigger diameters ( and different colors ) created as MovieClips in Flash which must move from the first peg to the third one, through appropriate moves, in such way that they end up piled up in the same crescent order as they were in the first peg.

The way the code is written just shows the beginning disks position and the end result but not the intermediary steps.

I want this code being capable to show the successive disks positions on the pegs in each step of the process, each time I right-click the mouse.[code]...

View 2 Replies

ActionScript 3.0 :: Pausing A Loop At Each Iteration?

Nov 30, 2009

I'm working on a script and I've run into a coder's writing block so-to-speak. I have an array of twenty object (with attributes). I want to loop through the array and for each object, update some text fields, create a tween, pause, and create another tween (i.e. fade in / fade out). I tried working with the timer class but the for loop, as expected, keeps on rollin' after the function has been called by the listener.

View 10 Replies

Actionscript :: Use For Variable As Parameter And Keep It Different For Each Iteration

Mar 25, 2010

I have a basic for loop to loop through buttons and set some stuff and onPress handlers:[code]However, as I noticed, all buttonsthen link to one and same frame - all point to last i + 1 - Is there any possibility to call gotoAndStop with "static" Number, so in next iteration, it won't change?[code]

View 1 Replies

ActionScript 3.0 :: Last Iteration Of A Loop - Buttons

Jul 30, 2009

i have this from as2, where i can create many buttons on stage and loop. then create a function that applys to all the buttons

Code:
for (var i = 1; i <= 3; i++)
{
bt = this["button" + i];

[Code].....

View 3 Replies

Flex :: Recursive Iteration Through Every Component Instance?

Nov 17, 2009

I have various custom component instances in my flex app. I want to loop through them recursively and get their instance Ids. The recursive part is very important to me. I have tried doing this, but it didn't do recursive:

for each (var myItem:* in this.MasterContainer.childDescriptors)
{
trace(myItem.id);
}

View 3 Replies

Arrays - Make For Each Loop Dynamically Depth Of Iteration?

Mar 24, 2012

I hope I am clear enough. My data set is populated I have

comment:CommentVO;
comment.replies=[comment:CommentVO,comment:CommentVO,comment:CommentVO];
_comments:Array = [comment:CommentVO,comment:CommentVO,comment:CommentVO]

I've correctly populated my _comments Array and the replies array in my CommentVO Obj.

[Code]...

View 3 Replies

Xml :: Flex ListCollection Iteration Concatenating Collected Values?

Dec 29, 2010

I am working in flex builder 3 with an XMLListCollection and have run into this (should be simple) parsing snag...The XMLListCollection Data:

<data>
<term name="NUMBERS">
<alt_form name="1"/>

[code]......

View 3 Replies

ActionScript 2.0 :: Use Iteration To Reference Each Array Name To Pass It Into A Function

Nov 12, 2004

In AS2 I have several arrays constructed like this :

var myArray0:Array=new Array(value,value,value...)
var myArray1:Array=new Array(value,value,value...)
var myArray2:Array=new Array(value,value,value...)
var myArray4:Array=new Array(value,value,value...)
...

What I'm trying to do is use iteration to reference each array name to pass it into a function.

[Code]...

View 2 Replies

ActionScript 3.0 :: Iteration Through Array Of Complex Data Object On Different Properties?

Sep 27, 2011

I am not sure my title is correct.Is there any 3rd-party library on AS3.0( like STL in C++), can do this: I define my class and use its objects as associative array, for example:

class Company{
var public name;
var public logo;

[code].....

View 7 Replies

ActionScript 3.0 :: Displaying A For Loop Iteration Counter In A Dynamic Text Box?

Jan 26, 2012

I am just learning how to use Flash AS3. I have made a very basic animation that is a circle with a slice in it that grows larger over a couple of seconds until it is about a quarter of the size of the circle. It is designed for my research subjects to watch and follow for range of motion and speed as they complete a leg exercise task. I used a basic for loop in the animation to repeat it 10 times, then a frame appears that says "Set Complete." I would like to add a repetition counter to the screen so that subjects know which rep they are on throughout the animation. I know that I have to use a dynamic text box to do this, but I don't know where to put the script so that the new counter number will appear on the screen after each loop. Here is what I have so far for script:

Action Layer first frame of loop:

var count: Number=0;

Action Layer last frame of loop:
count++;
if(count<=9){

[code]....

View 6 Replies

ActionScript 2.0 :: [MX PRO 2004] For Loop Variable Not Showing Increase On Each Iteration

Feb 22, 2008

I am wondering if anyone has experience this problem before:

[Code]...

I was experiencing some other "strange" behavior so I'm wondering if my code is getting too long. Maybe I'm running into some kind of limit. Has this happened to anyone else? Anyone know of some fixes? The loop is in a _global function, could that be causing a problem? other than that, the code is on line 4420 of the actionscript coding interface.

View 1 Replies

Arrays :: Actionscript 3 - Creating A New Array For Eache Iteration Of The Function Call. AS3

Oct 5, 2011

so I have writing a function that returns objects on the stage and puts them into an array. and the function works fine until i call the function on more than one object name, meaning if im in the root class, and I call this function on object1 lets say it will add all the object one's from the stage, but if i call it on object2 it will throw an error, which makes some sense, i guess it means that it is not adding it to a unique array, but im not sure how to do that. would it be a good idea to maybe make a multidimensional array? if that is the case would it be too slow?

[Code]...

View 1 Replies

ActionScript 2.0 :: Generate A Variable Number Of Random Numbers Less Than 16 With No Duplicate Numbers

Nov 2, 2004

how to do this and not found much, so here goes:

I want to generate a variable number of random numbers less than 16 with no duplicate numbers

Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.

if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.

View 3 Replies

ActionScript 3.0 :: AIR Handling Large Numbers - Convert A String Having Numbers To An Integer

Feb 18, 2010

I am trying to convert a string having numbers to an integer.

//15 9's are there
var str:String="999999999999999"
var res:Number = new Number(str);

But it is not able to convert correctly as the the var res now has the value 100000000000000000. I know that the number has 52 bits of memory, then why is it not able to do the conversion?

View 6 Replies

ActionScript 3.0 :: Generate Four Random Numbers With Total Of 4 Numbers Equal To 100?

Feb 19, 2011

Generate four random numbers with the total of the four numbers equal to100?[code]...

View 8 Replies

ActionScript 3.0 :: Sharedobject To Remember For The Day?

Feb 16, 2009

i need to stop a flv from playing again until the next day ( needs to be AS3).

View 2 Replies

ActionScript 2.0 :: Remember Which Frame Was From?

Dec 3, 2010

I want to let the button remember the previous frame where I was from:

For example , btn.onPress = function (){go to the previous frame I was from}

View 5 Replies

ActionScript 3.0 :: Creating Function To Pick Out Numbers From A Set Of Numbers?

Nov 18, 2009

create a function that picks out X amount of numbers from a set of numbers? So if X=3, then i need this function to pick out 3 different numbers from say a set of numbers (1, 2, 3, 4, 5, 6, 7, 8) and then stored it into X number of variables.

In saying that, X will only =2, and =5. So in the first instance, i'll need 2 random numbers from the set above that are not the same numbers, and second instance 5 random numbers from the set above (also no repeats of numbers). Then i need to be able to store those 2 or 5 different random numbers from the set into variables to call them with other functions.

View 2 Replies

ActionScript 1/2 :: Button Can Remember Pressed

Apr 20, 2009

i have designed button which will  change position after press on it i have used the script :button1.onPress=function(){button1._y=-300;action1._y=110;}that is working but the problem is whenever i give a link to it like go to another frame or go for some url. it work but after comming back to its previous stage it shows no difference that means i need a button which will indicate that it have been pressed.

View 1 Replies

Flash - Getting Togglebutton Remember State?

Sep 26, 2011

In AIR, I'm create a nativewindow component that will generate a set of togglebutton, as each time the code below is run whether I open a nativewindow, the togglebutton will be reset to the default state. How do I make the state persistent?

for(var i:int=0;i<10;++)
toggbtn.label = "Power "+1;
stage.addElement(toggbtn);
}

View 1 Replies

Flash :: Sharedobject Don't Remember Data?

Sep 27, 2011

I have this code for sharedobject:

var mySharedObject = SharedObject.getLocal("republicofcode");
mySharedObject.data.clientID = my_vars.clientID;
mySharedObject.data.question = my_vars.question;

[code].....

View 1 Replies

ActionScript 3.0 :: How To Remember A Movieclip Color

May 15, 2010

I have some rectangulars movieclips each filled with different colors and a function that changes their color when the mouse is over them. How can i remember the initial color of the movieclip so that when the mouse is not hovering the movieclip it return to their initial color.

View 3 Replies

ActionScript 3.0 :: Using 3.0 To Remember User Actions?

Oct 3, 2010

I have seen similar threads, but I am trying to recreate something I saw on a similar site where the user can record actions such as clicking buttons to produce sounds and stop the recording and then replay what the notes that they played.

I realize that I will need an array of some sort, but I am trying to work it out and I can't seem to get my head around how do replay actions such as the site example above.

View 1 Replies

ActionScript 2.0 :: Map Pin System - Remember Where To Place

Oct 6, 2006

I have a map of my country (Greece) and i want to place pins on it to point out the places i have been, links to photos etc, files etc. how to make my programm to remember where i've placed those pins. Should i save the x,y location of the every pin to a table at a database for example and fetch them at loading?

View 3 Replies

ActionScript 2.0 :: Possible To Be Able To Remember Timeline Position

Oct 28, 2006

just wondering if it is possible to be able to remeber the timelines position:example:

- the user is say on frame 5 or whatever frame the user is up to (its a quiz senario);
- the user then clicks a link which takes them to frame 15
- when the user clicks on the back button this will take them back to the page which they were viewing whatever that may be for each user.

is this possible or is there any tutorials about it where i can learn this?i have seen one example of it being done where it remebers what level you where at but i ca't remeber where i saw that example/tutorial

View 11 Replies

ActionScript 3.0 :: Remember Previous Keyframes?

Oct 20, 2011

I am just trying to create a simple escape the room game. I have a main frame with all the objects and another layer with different views. What I want to accomplish is, e.g.If a panel with buttons is clicked you go to the next frame, which shows a zoomed in panel with buttons. Then you enter a code and if it is correct you go back to the main frame. As the code was correct a drawer, which was previously closed opens and a new item is added to your inventory.This is my code for the room with the drawer:

Code:
drawer3_mc.enabled = false;
drawer3_mc.addEventListener (MouseEvent.CLICK, foundObjectScrewd);

[code].....

View 3 Replies

Can Flash Remember Buttons Clicked For A Game

May 18, 2009

I am making a game for the university I attend.  I am having students choose between college and high school by two buttons to see if they choose the correct answer. Then I want it to display the number correct on a result page I will have them print out for the instructor of their freshman seminar class.Can flash remember if a specific button was clicked?  I have each button with a unique name and could it tell which one was clicked to help me figure out results?
 
Otherwise, I was wondering if there was a way I could have flash keep track of "points" so I can display the number correct.  Would it be possible if I gave each button a numeric value and somehow added up the numbers from each button to put over a total score of 12 (that's how many questions there are)?  Could it be done in a dynamic text field?

View 2 Replies

C++ :: IShockwaveFlash And Privacy: Allow & Remember + Context Menu?

Mar 15, 2011

IShockwaveFlash and cointerfaces have not any way to

1) programmicaly allow use camera and remember choice

2) disable context menu?

View 1 Replies

ActionScript 2.0 :: Remember Text Input Into A Field?

Nov 3, 2005

when a user inputs some text and if it comes back as an Undefined Error i want it to show what the user typed in so they can see if they misstyped,

Dynamic text feild is called = remember and the Text Input box is = vrm_ti

CODE:

remember.text = vrm_ti.text;

View 3 Replies







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