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


Similar Posts:


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 :: Infinate Loop For M.clip.the Looping Part Does Not Want To Loop?

Jun 13, 2004

i'm trying to do an infinate loop for my m.clip.the looping part does not want to loop...it loops back to my firrst frame even though there are two same picture in the movie clip.....here's a sample of what i use for the infinate loop script..

[Code]...

View 2 Replies

ActionScript 3.0 :: Loop With Varying Values Depending On Where Are In The Loop?

Jul 20, 2009

I have need of loops / nested loops that pick different figures depending on where you are in the loop. The whole function needs to run through 'ml' times. 'ml' is a dynamic figure. Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.

Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly. My main issue is this - how do I get the loops to run through as this: While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc. How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.

[Code]...

View 6 Replies

ActionScript 3.0 :: Accessing Loop Variables Outwith Loop

May 5, 2011

Say, I had a loop in a function...

[Code]....

How would I refer to a in another function

View 8 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 3 :: Defining For Loop Iterator Before The For Loop?

Jun 2, 2011

Recently I'd been criticized for structuring my for loops like so:

var i:MovieClip;
for each(i in array)
{

[Code]....

This reads better for me personally, yet I'm being attacked for it. Is there any difference?

View 2 Replies

Actionscript 3 :: Compare Two Different Arrays Using For Loop Within A For Loop

Nov 29, 2011

basically I need a loop within a loop to compare two different arrays in my actionscript3 lottery game. I have attempted the loop but I cannot seem to get it to work ...

[Code]....

So basically within this code check_win is a button. Once the button is clicked it runs the loop. It is meant to take an instance of matches which contains 6 properties and loop until index is greater than matches. According to my output this is happening but the second loop doesn't appear to do anything.

View 1 Replies

ActionScript 2.0 :: 1 For Loop To Loop Multiple Arrays?

Aug 25, 2010

How do i word a for loop to make it loop through multiple arrays?I want 1 for loop to loop through multiple arrays in order to move/alter objects.I want to keep the arrays separate.

ActionScript Code:
characters = new Array();
characters[0] = male;

[code]........

View 3 Replies

ActionScript 3.0 :: Get The ID Of An Item In A Loop Inside A Loop?

May 15, 2011

I'm trying to make a matching pairs game. First of all I'm making all the tiles, using a loop inside a loop. How do I get the ID of an item inside that loop? My code looks like follow:

Code:
var matches:Array=new Array(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8);
makeTiles();
function makeTiles() {

[Code].....

View 3 Replies

ActionScript 2.0 :: Loop Starts At 0 And Not 1 So The Loop Ends At 6?

Aug 27, 2005

dayVal = day.value;

for(dayVal = 1; dayVal/7 != 1; dayVal++)
{trace (dayVal);
}

the loop starts at 0 and not 1 so the loop ends at 6 does any one know how to resolve this issue?? its so that what ever number dayVal is it will be rounded up to a number that is Divisble by 7 .

View 4 Replies

ActionScript 2.0 :: XML Nested Loop - Access The Loop Later?

Feb 19, 2007

Basically, I have data organized by date in an XML file. I'm trying to make a website application that will allow the user to click on a date (in a text field) to see another textfield populate with all the data under that particular date. So far, all the information loads into the textboxes at the same time. How can I get it to only load information under a particular date when somebody clicks on that date?

Before I started this project, I was convinced I could do this by manipulating the [j] (see code below) in the myFunc2 function. Currently, it's set up to increment blank_mc._y by whatever value is returned by [j]. But for some reason this doesn't work. I feel that if I could atleas get this part to work - I could probably do the rest.

AS code:

Code:
function loadXML(loaded) {
if (loaded) {
var nodes = this.firstChild;

[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 2.0 :: Have Pause Within 'for Loop' Before It Runs Through Next Loop?

Mar 20, 2007

wondering if anyone knows if its possible to have a pause within a 'for loop' before it runs through the next loop? heres the script i've built up so far, i'm running off other variables and arrays to pull in the logos and the animating in is working fine except that they all run in at the same time, basically what i want is that they would run one after the other with a 5 second gap between them..[code]so i did that and put wait(delay); after the var boxcounter=2; in each of the If statements.. but no luck... can anyone shed any light? or suggest a way it get it to hold for a few seconds before running though the loop again? or am i going about this in completely the wrong way??!

View 5 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 Random Function With While Loop?

Feb 22, 2011

I have a while loop that I need to shuffle the order of my array. This was initially an AS2 code and am trying to convert this over but have come across with an error I don't understand so hoping someone may know what it means. My while loop code is:

Code:
var randomArray = shuffle(orderArray);
function shuffle(toShuffle) { // shuffles an array

[code]......

View 5 Replies

ActionScript 3.0 :: How To Make A Function Loop

May 30, 2011

I looked through the documentation on looping, but I don't understand it.  I'm trying to make this function loop, until the user stops it:

function playMusic(evt:MouseEvent):void{    channel.stop(); //to prevent users from starting files multiple times over top of each other - is there a better way to do this?    channel = myMusic.play(songPosition);    myTimer.start();}

View 11 Replies

ActionScript 3.0 :: Breaking Out Of Function Rather Than Loop

Jan 30, 2009

If I want to break out of a function rather than a loop, it's suggested that I use the return; statement. But that doesn't work in the following code, I just want the trace statement to run once...

Code:
stage.addEventListener(Event.ENTER_FRAME, EnterFrameHandler);
function EnterFrameHandler(event:Event):void {
trace("It worked, obviously.");
return;
}

So, this will trace the phrase over and over with no stopping point. Why doesn't return have an effect? Doesn't the first line only happen once... ?

View 2 Replies

ActionScript 3.0 :: URL The Load() Function In A For Loop?

Jul 19, 2009

why with this code i only get a request to ?ip=192.168.1.5 and not for all? what is it wrong? any problem with the load() function in a for loop?

[Code]....

View 1 Replies

ActionScript 2.0 :: For Loop OnRelease Function?

Jul 14, 2010

I am designing and coding a navigation menu at the moment, and so far I have got the button instances to duplicate for each of the menu items, and set widths, positioning values and RollOver/RollOut functions. However, I would ideally like to include the onRelease button functions in the for loop too - as they are all the same apart from the variable "i". Here is the code snippet:

ActionScript Code:
for (i=1;i<(_root.noofmenuitems+1);i++){
duplicateMovieClip("mc", "mc"+i, i);

[code]...

Now my problem is that by the time the onRelease function is called, the for loop has been completed and the value of i returned is the last i value from the loop (_root.noofmenuitems+1). The this["mc"+i] part obviously works, because the trace function is called when I click any of the menu items.The problem is that I have 6 menu items, and when I click any of them, the trace function returns "test 7" - not the corresponding i values for each button.

View 9 Replies

ActionScript 3.0 :: Pass Value From A Loop To A Function?

Jul 20, 2010

this is a standalone AIR app which runs off of usb media to help people organize their personal information. there is an XML file in a separate folder which stores the name of a file that the user uploads to usb media (into yet another folder), in this case, the person's living will. getting the path to that file as it differs from mac to pc has been a challenge and i feel the only way around this is to give a conditional for the operating system (second function below).

My immediate goal below is to get the name of the file (VALUE) over to the openThisFile function so that "fileName" can be given a value appropriately in the second function code for mac. I can't figure out how to do this...Alternately, is there a way to manipulate "currentTarget.data.toString()"? I was thinking that could also help me... it has the full path to the file, which unfortunately does not work on Macs... for some reason it just can't locate the file (unless I'm missing something).

Quote:

public function handleLoadData(event:Event):void {
try {
propertyFilePath = path;

[code]....

View 0 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 3.0 :: How To Loop Addeventlistener Function

Aug 24, 2011

I have a script that contains: an array of movieclips -> MaxBallArr
another array of movieclips -> MaxBallLrg
an array of textfields -> MaxToolTipArr
a library movie clip -> max_box

I'm trying to gather them some how in an addEventListener which worked fine in that way:

ActionScript Code:

[Code]...

View 2 Replies

ActionScript 2.0 :: Integrate Loop In Function?

Aug 5, 2004

I made a for in loop and a function to control my button mc's like this:

[Code]...

but that isn't working.

View 11 Replies

ActionScript 2.0 :: [FMX] Have A Function Call Within A For Loop?

Nov 9, 2004

Is it possible to have a function call within a for loop?

Code:
for(i=0;i<someDynamicVar-1;i++){
_root["button"+i].onRollOver = function() {
trace(i);
trace(imageList[i]);
}

Also is it possible to give a movieclip that has an image loaded into it, button functions?

View 7 Replies

ActionScript 2.0 :: Setinterval For A Loop Function?

Jun 16, 2005

Code:
_root.leftButton.onRelease = function() {
for(var i=0; i<6; i++){
animateThumbsToLeft(variable_1, variable2);
}
};

ok how and where do i put the setInterval script if i want to execute the "animateThumbsToLeft" function for 6 times and inbetween each time have a delay of say half a second..

View 1 Replies

ActionScript 2.0 :: Function Created In For Loop?

Mar 1, 2008

I have the following code that should set the onPress events for movieclips

Code:
function actionSetter() {
for(var k = 0; k< 5; k++) {
trace(k); //traces correctly
_level0["EventBtn" + k].onPress = function() {

[Code]...

What should I do to correctly define onPress for my movieclips within the loop?

View 2 Replies







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