ActionScript 2.0 :: For Loop And Buttons On Stage

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


Similar Posts:


ActionScript 3.0 :: Loop Through The Buttons(movieclips) On The Stage

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

ActionScript 2.0 :: External MC Loaded On Stage - Can Press Buttons That Are On The Stage Through It

Sep 26, 2008

An external swf is loaded using this code...

[Code]...

The problem is that even though this external movie covers the whole stage, My mouse can still "see" buttons that are on the stage, and I can click them. I don't want to be able to click the buttons through my external movie.

View 2 Replies

ActionScript 2.0 :: Create A Loop For 20 Buttons?

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

ActionScript 3.0 :: Buttons From A Library Mc And A Loop

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

ActionScript 2.0 :: Putting Buttons Through For Loop?

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

ActionScript 3.0 :: Distribute Buttons With Loop?

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

ActionScript 3.0 :: Distribute Buttons With A Loop?

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

ActionScript 2.0 :: Disable Buttons Outside For Loop?

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

ActionScript 3.0 :: Loop Of Buttons And Loading Swf/img/txt From Xml?

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

Actionscript 3.0 :: Loop Of Buttons And Loading Swf/img/txt From Xml

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

ActionScript 2.0 :: Targeting Buttons In A For Loop?

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

ActionScript 3.0 :: For Loop To Control Buttons?

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

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

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

ActionScript 3.0 :: FOR Loop To Program Sequential Buttons?

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

ActionScript 3.0 :: Multiple Radio Buttons In For Loop?

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

ActionScript 2.0 :: Mass Update Buttons With Loop?

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

ActionScript 1/2 :: Loop Through Un-sequential Named Buttons In An MC?

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

Flex :: How To Generate Buttons With Loop Of Array

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

ActionScript 2.0 :: OnPress - Four Buttons Inside For Loop

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

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop?

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

ActionScript 2.0 :: 4 Buttons Move Down OnPress Using The For Loop?

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

ActionScript 2.0 :: Output Values For Buttons In Loop?

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

ActionScript 3.0 :: Using A Loop To Create Buttons That Play MC

Sep 23, 2009

I am trying to basically have a loop that is based on a string length. It adds a movie clip for every letter and a hidden rollover button. All this seems to be working fine but I am having trouble wrapping my head around how to code the event listeners or it might be how I'm telling it which movie to play. As of now all the buttons play the last mc which is block6. What do I need to do differently?

[Code].....

View 8 Replies

ActionScript 2.0 :: Assigning Actions To Buttons In A Loop

Sep 17, 2004

i'm pulling my hair out over this one. 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]...

View 2 Replies

ActionScript 1/2 :: Access Multiple Buttons In A Loop?

Sep 20, 2010

I have 29 buttons, named img1, img2 ....till img29...I need to access them all in a loop. I had asked this question earlier, but at that time the buttons had to be accessed via their holding movieclip, but this time the code is within the clip, so I need to directly access the button.
 
So originally the code I was using to access them was
 
_root.folioholdermc["img"+i]._alpha   //thanks to Ned Murphy
 
now I need to access them as
 
this.img2._alpha                          //due to a path change
 
I tried using
 
this.img[i]._alpha           but this is not working.
 
I want to put this in a loop where I moves from 1 to 29.

View 3 Replies

ActionScript 3.0 :: How To Loop Through MovieClips On Stage

Jul 20, 2011

i want to loop through movieClips like in AS2; i have some movieClips and Components on the stage.i want loop through them to check their properties. i had used [ getChildName ] method to get the movie clips ,but i can't access their properities.

here's my code

Quote:

for(var i=1;i<=4;i++) {
var tempisplayObject = getChildByName("my_mc"+i);
trace(temp.currentLabel);
}

when i run this code i am getting error like this

Scene 1, Layer 'Layer 2', Frame 1, Line 251119: Access of possibly undefined property currentLabel through a reference with static type flash.displayisplayObject. i am getting the same error also when i access to components.

View 3 Replies

ActionScript 3.0 :: Loop FLV Component On Stage

Jun 26, 2009

I have a flv component on my stage and i have buttons load different flvs into that component. However, I need to have it loop when its over. How do I do this??

View 3 Replies

ActionScript 3.0 :: Add Text To Stage Through A Loop?

Oct 28, 2009

I have added text to my stage through a loop. There are 3 different words that are added to the stage. I put the text in a mc and then used the mc for the reflection. but for some reason the whole word does not reflect. Just the last 4 and 5 letters. All of the words are 6 and 7 letters long.Heres my code:

Code:
public function placeletters():void {
for (var i:Number=0; i<numButtons; i++) {
textfield = new TextField();[code].....

View 1 Replies







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