ActionScript 2.0 :: Create Function In For Loop?

Apr 6, 2011

How would one go about creating a function inside a for loop that does not have a button action attached to it while still having access to the current index number.

This code was found on senocular:

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

[Code]....

This is all great however i would like the functions to just be regular old functions, not button actions (onPress), is this possible?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Create Multiple Variables With A Function Or A Loop?

Mar 17, 2010

I want to dynamically create variables that will create and place instances of a movie clip on the stage at runtime.[code]

View 5 Replies

ActionScript 2.0 :: Place A For Loop In A Recursive Function With The Function Call Within The Loop

Nov 4, 2005

If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?

View 2 Replies

ActionScript 3.0 :: Create A Loop So Icons In Menu Continually Loop Indefinitely

Apr 16, 2010

I would like to create a loop so the icons in the menu continually loop indefinitly.[code]

View 2 Replies

ActionScript 3.0 :: Use A Loop To Create Text Field With The Loop's Current Value

Dec 11, 2010

I am attempting to use a loop to create text field with the loop's current value. The code looks like this:

ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}

So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".

View 7 Replies

ActionScript 2.0 :: Using Var From For Loop In Function Outside Of Loop?

Nov 2, 2009

I have a variable in a loop that i want to access in a function outside of the loop. However the variable gets deleted when the loop is closed so no longer exists when i call in the function.here is the code; i'm trying to access the variable picHeight from within the scroll function

Code:
pauseTime = 3000;
xmlImages = new XML();

[code].....

View 3 Replies

ActionScript 2.0 :: Create Base Url Function And Button Link To Call That Function?

Jun 16, 2010

How create baseurl function in flash and how i call that function in button script

View 1 Replies

Flash - Calling The Function Within That Function And Later Stopping The Loop - Starting And Stopping Functions?

Jan 7, 2012

I am making a character walk. This code will make him wobble to the right and when thats done it will trigger him to wobble to the left and then call the function again to continue the loop.I can get the loop to work fine by calling the function but how do I STOP the function? Also I want to call it later on. Is there a way to start and stop a function?

function wobble()
{
var ws = .1;
var dis = 1;

[code]....

View 2 Replies

ActionScript 2.0 :: How To Create A Loop

May 24, 2007

I am trying to create a loop, that will lop through the following XML:

<pages>
<page pageName="Front Cover" pageID="0">pages/page00.swf</page>
<page pageID="1">pages/page01.swf</page>
<page pageName="Page 2-3" pageID="2">pages/page02.swf</page>

[code].....

And when i then trace this loop statement I want to only have the pageName attribute trace out?

View 1 Replies

Using A 'for' Loop To Create Similar Varibales?

Jun 19, 2009

I'm trying to create a number of similar variables using a for loop, rather than having to explicitly write out each variable. For instance, I need 9 variables called zone1, zone2, zone3 etc. So rather than writing it out like so...ActionScript Code:public var zone0:Zone = new Zone(); public var zone1:Zone = new Zone();  public var zone2:Zone = new Zone();// etc. etc. After a look around on the internet, I came up with this, however, it doesn't work...ActionScript Code:for (var i:uint = 0; i<=8; i++)public var this["zone" + i]:Zone = new Zone

View 3 Replies

ActionScript 3.0 :: Create Tweens Within A Loop?

Aug 13, 2009

I'm pulling data from xml and using a for loop to have each line of text appear on screen. I want to have each of these ease in. I don't know the number or size in advance, so each textfield is created dynamically.What I've tried to do is dynamically create a tween for each dynamically created textfield, but I just can't seem to get the syntax right. This is a snippet from what I've got at the moment, inside of the function that's called once the xml is successfully loaded:

var bl:XMLList = fsXML.content.point;  var points:Array = new Array();  var Btween:Array = new Array(); for (var n:int; n<bl.length(); n++) {  var p:TextField = new TextField(); p.name = "points" +

[code]......

View 3 Replies

ActionScript 3.0 :: Create Movieclips Using A Loop?

Mar 8, 2011

Is there a way I can create these clips and add them to an array in a loop ? It doesn't seem to want to work for me.. ?
 
                var p1 = new P1;                var p2 = new P2;                var p3 = new P3;                var p4 = new P4;             var p5 = new P5;                var p6 = new P6;                var p7 = new P7;                var p8 = new P8;             var p9 = new P9;                var p10 = new P10;                var p11 = new P11;                var p12 = new P12;            var p13 = new P13;                var p14 = new P14;                var p15 = new P15;                var p16 = new P16;            var p17 = new P17;                var p18 = new P18;                var p19 = new P19;                var p20 = new P20;

View 2 Replies

Flash :: Create An Intro Followed By A Loop?

Apr 3, 2010

I just recorded some song and cut it into two parts. The first part contains an intro and the second is supposed to loop. What I want to do now, is to have a simple graphical animation (5 keyframes or so) that loops as well, while the music plays along.

View 1 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 :: Create Multiple MC's In A Loop?

Oct 26, 2009

I want to make multiple empty MCs and fill each one with a thumbnail for a menu. I want to do this using for loops so I can control as many as I need.

What's the most efficient way of doing this?

I'm used to creating empty MCs in AS2, but I'm not familiar with the new display object way of handling this method.

So far I have this:

Code:
for (i=0; i<numImages; i++) {
thmb.push(gallery.features.image[i].@thmb.toString());
var imageLoader:Loader;

[Code]....

View 6 Replies

ActionScript 3.0 :: Create An Increment Within A Loop?

Oct 11, 2010

I am trying to create an increment within a loop, that gradually increases and then decreases. The total of all increments should equal the total change.

I am using the following equation:

PHP Code:

private var _totalInc:Number = 0;
private var _time:int = 0;
private var _duration:int = 60;

[Code].....

The problem is, when the trace output at frame 60 should be _totalInc == _change. why it's a few degrees short?

By the way, totalInc is purely used to debug and is not needed in the final program. I am interested in inc.

View 4 Replies

ActionScript 3.0 :: Create A Loop With A Delay?

Nov 10, 2011

Im new to action script and am just starting to understand it. Im trying to create a loop with a delay in it but am not having much luck passing growing variables to the new function.

[Code]...

View 2 Replies

Actionscript 3.0 :: Create A Map From An Array Using A For Loop?

May 18, 2009

i have created a map from an array using a for loop via this code:

for (var k in map1[0]) {
for (var i in map1[k]) {
if (map1[k][i] == ground) {[code]..........

my question is how do i set a delay timer thing so i can watch it put down each tile ie. there is a half second delay between each tile being put down

View 1 Replies

ActionScript 2.0 :: Create A Grid With A For Loop?

Feb 8, 2006

Let's say I have a movie clip of a square in my library and I want to use a for loop to create a 10x10 grid of those squares. How do I approach that?

Spacing each square horizontally or vertically isn't a problem for me but I'm hung up on how to add 10 squares and then start a new line.

View 7 Replies

ActionScript 2.0 :: Use A For Loop To Create Instances?

Aug 27, 2006

I'm trying to parse an XML file, and use it to create instances of a custom class the fly in actionscript 2. (can't migrate to 3 for this project).I'm trying to make something happen like:

Code:
for (var i:Number=0; var<n; var++) {
instanceName="MyObject"+i;[code].....

Which doesn't work.When it's all done, I need to have n objects named MyObject1, MyObject2, ..., MyObject(n).

View 2 Replies

ActionScript 2.0 :: Using For Loop To Create MCs And Assigning Value

Jun 14, 2007

I'm trying to use a for loop to create 219 movie clips and have it assign the value i to each one. This is how the movie clips are named on the stage
rollover1_mc, rollover2_mc, rollover3_mc and so on.

Heres the for loop I was trying:
Code:
for(i=0; i<220; i++){
rollover + i + _mc.onRollOver = displayContent;
}
doesn't seem to be working.

Basically I need it to repeat so i creates the following lines of code:
rollover1_mc.onRollOver = displayContent;
rollover2_mc.onRollOver = displayContent;
rollover3_mc.onRollOver = displayContent;
etc, etc.

View 2 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 2.0 :: Create Arrays In Loop?

Nov 15, 2008

Is it possible to have a for loop and create a new array for every loop
for

(i=0; i<5; i++){
myArray+i:array=new Array;
}

I know this doesen't work it just illustrates what im after.

View 6 Replies

ActionScript 3.0 :: How To Create Sprite In While Loop

Jul 31, 2009

what I'm doing wrong.i'm trying to create sprites in a for loop.

Code:
while( i < linkNumber )
{

[code].....

View 2 Replies

ActionScript 3.0 :: While Loop To Create 'tiled Bg'?

Oct 8, 2009

I am attempting to create a loop that will (as long as 'i' less than or equal to 'howManyX') create an instance variable of 'BgLogo' and add it to the stage...in essence I am trying to tile the instances.Is this even the best approach?If yes, or no, what am I overlooking in my code below.If this isn't the best approach, what would be?

Code:
function a ():void
{

[code]....

View 2 Replies

Actionscript 3 :: Loop A Function Name?

Jul 24, 2011

How would I create a simple loop to create these functions:

function hello1(e:Event):void
{
trace("hi");
}

[code]....

The function name goes in order until it stops at

function hello10(e:Event):void
{
trace("hi");
}

I know I can just use one function but I am using this as an example for a larger project.

View 2 Replies

ActionScript 2.0 :: Function In A Loop?

Oct 5, 2005

Have 5 movieclips named mc_resto1, mc_resto2, etc... and have this code

PHP Code:

for(i = 0; i < 2; i++){
eval("mc_resto"+i).onRollover = function() {
trace(i);
}


The thing is when i'm doing my rollover on all the mc_resto it's tracing 3 and not 0 then 1 then 2.

have also tried something like

PHP Code:

for(i = 0; i < 2; i++){
eval("var"+i) = i;
eval("mc_resto"+i).onRollover = function() {
trace(eval("var"+i));
}


but it doesnt work

View 1 Replies

ActionScript 3.0 :: Using Loop To Create Object Instances?

Oct 21, 2010

Here's a piece of script I would like to condense into a single loop where the number of instances created would be dynamic:

Actionscript Code:
//create instances of Door objectvar door_1:Door = new Door();var door_2:Door = new Door();var door_3:Door = new Door();var door_4:Door = new Door();var door_5:Door = new

[code]....

View 5 Replies

Actionscript 2 :: Create Dynamic Textfields In A Loop?

Aug 12, 2010

I want to populate the stage with a list of dynamic text fields with individual names, something like pg4_txt1, pg4_txt2, pg4_txt3. I'm a novice at flash, I tried creating variables with a while loop, but I just haven't got the grasp of it.

Here's some kind of weird pseudo code to explain what I want to do:

var leading:Number = 15;
var i:Number = 0;
while (i<14) {

[Code].....

View 1 Replies

ActionScript 3.0 :: Using A 'for' Loop To Create Similar Varibales

Jun 19, 2009

I'm trying to create a number of similar variables using a for loop, rather than having to explicitly write out each variable.For instance, I need 9 variables called zone1, zone2, zone3 etc.[code] After a look around on the internet, I came up with this, however, it doesn't work..[code]

View 2 Replies







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