ActionScript 2.0 :: Multi Buttons In For Loop
Jul 28, 2011
If I have 16 buttons inside a for loop, how would I trace back the number that was pressed.
NumPageButtons = 16
for(i=1; i<=NumPageButtons; i++){
tempMC = eval("page"+i+"_mc")
[Code]......
when I do a trace it gives me 16 not the number (current button ) that was pressed
View 1 Replies
Similar Posts:
Apr 27, 2003
man this site is awsome, i have learned so much. but unfortunantly i have run into a new problem. i have
for (f=0; f<10; f++) {
duplicateMovieClip(_root.guy, "guy"+f, f);
}
for (s=0; s<50; s++) {
[Code]...
only problem is, is that when the movies get duplicated, the numbers aren't right (ive done some testing and found that it is almost as if it is keeping the same variable in all the loops as the same, and is running the loops backwards (wierd)) anyways, apparently i dont know the for loop as good as i thought. i have tried rereading the for explenation, but nothin is clicking as to what i am doing wrong. any help or explenation would be great. (also, as a side question/statement-when i duplicate movieclips, they dont keep thier instante name in the duplicated ones, which is bad becuase i need to do hitTest and other things with the duplicated movieclips. any help with this would be great)
View 3 Replies
Aug 21, 2007
i want to do is loop through an array of items, Each item has an image attached to it. But i only want it to go onto the next item once the image has been loaded fully.I have this wicked code that was kindly donated of someone off this forum.Now i know that this is possible as i've seen it but i'm not sure how to do it.Is it possible to adapt the exsiting codes below to perform this task? this is the code i have at the mo:
step loader:
PHP Code:
function createList(array, i, line, width, count, row) {
//
if (i == array.length) {[code].......
View 1 Replies
Jan 5, 2009
if i wanted to modify the xy size properties of several pieces of media through a looping function and an incrementing variable how could i do it? resize multi objects through loop & incrementing variable
View 1 Replies
Jul 7, 2011
This is part of a large quiz I am building. The three choices here are part of a group of three from which you should only choose one. If so the other two are enabled=false.I can't change the method only modify since it is part of a much larger app that is runnung fine. So no radio buttons or codeing on maintimeline.
If you run the attached simple FLA and select the first choice you can see the enabled=false that is on the voted and pass framesworks fine, however if you choose the second the first is only disabled and the third is enabled and as logic would have it if you choose the third the first and second are enabled.The idea is to make it so the user can only choose one the other two are disabled while still having the choice to deselect.
View 0 Replies
Feb 6, 2011
This is part of a large quiz I am building. The three choices here are part of a group of three from which you should only choose one. If so the other two are enabled=false. I can't change the method only modify since it is part of a much larger app that is runnung fine. So no radio buttons or codeing on maintimeline. If you run the attached simple FLA and select the first choice you can see the enabled=false that is on the voted and pass framesworks fine, however if you choose the second the first is only disabled and the third is enabled and as logic would have it if you choose the third the first and second are enabled. The idea is to make it so the user can only choose one the other two are disabled while still having the choice to deselect.
View 1 Replies
Aug 25, 2009
I am building a photo gallery in which the images are loaded into a frame_mc and the thumbs are loaded into a movieclip called thumbLoader. The gallery is going to have several categories, every category has its own button and is found on a separate keyframe on the main timeline. When I click the button of a specific category it goes to the appropriate category/gallery. I have a questions:I want to create a horizontal scroll pane for the category buttons but I really do not know the code. For a start, I know I'm going to make the buttons as movie clips, and the scroll pane has to scroll those movie clips. I want to have 2 direction buttons, one that scrolls the category buttons to the right, and the other one to the left.
View 2 Replies
Jan 6, 2010
what I'm trying to do is make a preloader that will preload about 20 external SWF files before it lets you get to my main file. I want to do this because my main file needs the SWFs to be ready to go once its done loading. I have looked around and i found a few ways to do this with the "if (loadedBytes>=totalBytes)" and the code loops back till the files are done loading... this would be just what i need but i cant seem to get it to work. the file just seems to start loading my files but does not loop and just runs the time-line even once i state what frames i want it to loop.
View 6 Replies
Feb 19, 2009
I want to create a loop for 20 buttons:
[code]....
the code within the rollover/rollout function doesn't work. It does work when outside of the function or when the code doesnt use "g".Is this because once inside the rollover/out function it always brings back the last value of "g" ... in this case 20?[URL]
View 6 Replies
Jul 6, 2009
I created a menu of invisible movieclips (from a library item with the class name Invis) with buttonmode set to true so that I can have them send the playhead to different labels on the main timeline.I could use some help with determining which button is clicked and then placing code that executes depending on which button is clicked.Here is what I have so far on frame 1 of my timeline:[code]
View 1 Replies
Jul 23, 2009
I don't have an incredible amount of experience with flash, but I feel like I'm missing something really obvious here. I have about 10 buttons here (although I only show two in my code), and rather than listing out long lines of code, I figured it should be relatively straightforward to put it in a for loop...but its not working for whatever reason.
Rather than do
ActionScript Code:
hide = function () {
account_btn.enabled=false;
account_btn._alpha = 0;
[code]...
View 0 Replies
Nov 11, 2009
this loop business is giving me a headache, i can't seem to get flash to recognize functions with a variable in itHere is me doing it the long way and i'm trying to figure out how to do it with a loop.I have 4 buttons going across and i'm trying to create another row of buttons under it, a total of 8 buttons.I also created a sprite called squareBtn
ActionScript Code:
//displaying buttons
//the difference in X is 34
[code]......
View 6 Replies
Nov 12, 2009
I have been trying to figure out how to distribute buttons with a loop and I did it but now I don't know what the instance name is to target it.i tried using dog and that doesn't work I tried to set the instances names as _1 _2 _3 _4 but its registered as undefined.
ActionScript Code:
var dog:squareBtn;
for(var i:int = 1; i < 3; i++)
{
[code]....
View 2 Replies
Jan 27, 2011
i call my disable button function that is inside a for loop? it only ever disabled the last button but i want it to disable them all. Below is my code:
PHP Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
[code].......
View 1 Replies
Sep 17, 2011
create a multidimensional array which will pull text, swfs, and/or images from an xml file based on which button is clicked.What I don't understand is how to pull the swf or image file from the file like I have with the text. Truth be told, I'm completely lost and could really use some help fixing this. I need to pull text and images or the swf file from the xml depending on which button is clicked and I tried to put this together, but I've given myself a headache trying to understand where I went wrong.
ActionScript Code:
var pageXML:XML;
//Load the XML file.
var pageXMLLoader = new URLLoader();
[code]...
View 0 Replies
Sep 17, 2011
What I'm trying to do is create a multidimensional array which will pull text, swfs, and/or images from an xml file based on which button is clicked.
What I don't understand is how to pull the swf or image file from the file like I have with the text. I need to pull text and images or the swf file from the xml depending on which button is clicked and I tried to put this together, but I've given myself a headache trying to understand where I went wrong.
Code: Select allvar pageXML:XML;
//Load the XML file.
var pageXMLLoader = new URLLoader();
pageXMLLoader.load(new URLRequest("scripts/xml/content.xml"));
pageXMLLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlIOErrorHandler);
[Code].....
View 2 Replies
Feb 21, 2006
I have several buttons on stage (8), and I want to add a slighty different action for everyone of them. How do I do that, All the buttons always get the last past of the "FOR"..
Code:
function loadThumbs(eventoUrl:String) {
for(i=1; i<=9; i++) {
temp = this["thumb_"+i];
with (temp) {
image = "fotos/"+eventoUrl+"/thumbs/"+i+".jpg";
loadImages(image, temp);
temp.onRollOver = function() {
this.play();};
temp.onPress = function() {
this.loadImages(image, image_big);
};};};};
loadImages() is a LoadMovieClip type function I created.
View 3 Replies
Aug 5, 2007
I had the following script which worked fine for my buttons which were sitting on the stage and are called 'btn1', 'btn2', etc... However I wanted to animate all the buttons so have put them all into a movie clip called buttons, but now my script doesn't work, I have tried changing all the this targets to _root.buttons.this,
Code:
numOfBtn = 5;
stop();
[code]......
View 1 Replies
May 31, 2009
i tried to use for to control all the buttons i have but i get this error:1083: Syntax error: dot is unexpected.
Code:
var btnNum:Number = 6;
for (var i:Number = 1; i <= btnNum; i++) {
["L" + i + "_mc"].buttonMode = true;
["L" + i + "_mc"].addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
[code]....
View 3 Replies
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
Feb 19, 2009
In AS2 I used to be able to set up a FOR loop that would program sequential buttons. Now, I'm trying to do it with AS3 and I can't seem to get the function-part right. The last function is the only one that works. Here's some sample code...
PHP Code:
for (var i:Number = 0; i<3; i++) {
this["quiz"+i+"_mc"].go_btn.addEventListener(MouseEvent.CLICK, goButtonEvent);
[code].....
View 5 Replies
May 15, 2009
I have this for loop that is basically pulling some info from an xml file and putting it in a list box. And for each item in the xml, it also adds 2 radio buttons.Everything is working properly except all the radio buttons have the same y location, and i want them to be spaced apart, not on top of each other.I have tried messing around with the y location (rb1.y+105, etc) but I'm not having any luck.
for (var i:uint=0; i<il.length(); i++) {
lb.addItem({data:il.description.text()[i],
label:il.title.text()[i]});
[code].....
View 2 Replies
Oct 9, 2009
I'm trying to update a series of buttons with a for loop automatically. These buttons will have a somewhat fixed instance names like btn1,btn2,btn3,btn4.My problem is i don't know how to reference the button names with a dynamic variable appended..I have something simple like this, but can someone point me in the correct direction for the syntax please?[code]
View 2 Replies
Sep 8, 2009
It is possible to loop through buttons in a movie clip that do not have sequential names.For instance, they are all named by the date they are for reference to a database.
View 1 Replies
Mar 28, 2011
I'm trying to generate a button with the loop of an array, But I can't make the icon style and the stylename work.
for (var x:int = 0; x < smileys.length; x++ ) {
var emoticon:Button = new Button();
var label:String = smileys[x][0];
emoticon.width = 24; emoticon.height = 24;
emoticon.x = positionX; emoticon.y = 0;
[Code] .....
View 1 Replies
Jun 14, 2010
I was trying to loop through the buttons(movieclips) on the stage so I can just write one functions for all of them.
[Code]...
View 3 Replies
Jun 22, 2010
I'm trying to write onPress for 4 buttons inside a for loop.
This lines traces undefined:
Code:
trace(_root.TeachMethodArr1[count]) // undefined.
This is because count is no more starting from 0 when I click the buttons.
Code:
var TeachMethodArr1:Array=new Array()
var TeachMethodArr2:Array=new Array()
TeachMethodArr1 = ["a","b","c","b","e"]
TeachMethodArr2 = ["a","b","c","b","e"]
for(var count:Number=0;
[Code] .....
View 1 Replies
Sep 17, 2004
I have is a movie with a button in it called button.i've duplicated the movie (manually) several times on the stage.the movies have been given instance names of movie1, movie2 etc.i've then used actionscript to assign actions to the buttons.i have the following code:
Code:
for (i = 1; i < 6; i++)
{
[code].....
View 2 Replies
Mar 14, 2007
I using a for loop for a redundant action that I want to happen across 5 buttons. OnRollOver the button rotates. OnPress the button moves to a new position. It looks like this:
Code:
for(i=0;i<5;i++){
_root.swatch_mc['swatch'+i].onRollOver = function () {
this.onEnterFrame = function () {[code]....
My problem is this; onPress I want the button to move up (Ive achieved this already). I also want the other buttons to move down onPress (this is my problem). Is there a way have the other 4 buttons move down onPress using the for loop? Or is there another method of doing this?
View 2 Replies
Jan 13, 2009
I have this little loop that creates buttons. My aim is to change value of variable 'thevalue' on everytime button is pressed, first button should give value 0, second 1, third 2 and so on.
Code:
for (jo=0; jo<xmlData.firstChild.childNodes.length; jo++) {
value1= xmlData.firstChild.childNodes[jo].attributes.value;
_root.attachMovie("button", jo, (1000-jo), {_x:20, _y:20+(jo*20)});
[Code]....
View 2 Replies