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


Similar Posts:


ActionScript 3 :: Slowing Down Loop In Recursive Function

May 2, 2010

I have a difficult problem with a recursive function. Essentially I need to 'slow down' a for loop within a function that repeatedly calls itself (the function); Is this possible, or do I need to somehow extract the recursive nature of the function?

function callRecursiveFuncAgain(ob:Object):void{
//do recursive stuff;
for (var i:int = 0; i < 4; i++) {
_nextObj=foo
callRecursiveFuncAgain(_nextObj);
}}

View 3 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 :: Call A Function In A Loop?

Jul 30, 2009

I have a function:

[Code]...

This function creates a word inside of a movieclip. The words that it makes are specified in a text document in an array, and I don't know how many there will be. Then I have a do while loop that creates movie clips for these words to go into:

[Code]...

View 1 Replies

ActionScript 2.0 :: Pausing Function Call In For Loop?

Jun 3, 2007

I have a thumbnail gallery and i want each thumbnail to appear 1 by 1 rather than appear all at once.At the moment i have a for loop that creates each of the thumbnails.

[Code]...

View 3 Replies

ActionScript 3.0 :: [flex As3]function Non Recursive Call. How?

Feb 3, 2009

So, I create standard AS3 flex project. In constructor goes only start();


rest of functions are basically this:

private start():void { f1();}

private function f1():void { f2();}

private function f2():void { f1();}


And it's standard recursion. SWF either breaks or loops as many times as I tell it. One f calls the other, which calls first... I do not want that.

I want f1 to do some stuff, calls f1 and closes itself. Than f2 works, calls f1 and closes. And so on.

Like having 2 sets of code that loops through.
What's the cleanest way to do that?

View 16 Replies

ActionScript 3.0 :: [flex As3] Function Non Recursive Call?

Sep 2, 2009

I create standard AS3 flex project. In constructor goes only start();

rest of functions are basically this:
private start():void { f1();}
private function f1():void { f2();}
private function f2():void { f1();}

And it's standard recursion. SWF either breaks or loops as many times as I tell it. One f calls the other, which calls first... I do not want that. I want f1 to do some stuff, calls f1 and closes itself. Than f2 works, calls f1 and closes. And so on. Like having 2 sets of code that loops through.

View 1 Replies

ActionScript 3.0 :: Call An OnComplete Function Without Leaving The Code Loop

Mar 23, 2011

I am trying to figure out how to call an onComplete function without leaving the code loop (because the vars are no longer recognized with  the hand-off). I thought this might work:

[Code]...

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 3.0 :: Call MouseClick Function From Another Place

Feb 20, 2009

I have a function that is called from clicking a button

PHP Code:

con.scrollerDetails_mc.content_mc.info_mc.spin.addEventListener(MouseEvent.CLICK, spinIt);
var isTurning:Boolean = false;
function spinIt(e:Event):void

[Code].....

View 2 Replies

ActionScript 2.0 :: Any Way To Determine Recursive Loop End?

Jul 4, 2005

How do I determine the end of a recursive loop - when going through an xml document of unknown size?

View 7 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 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 :: 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

ActionScript 3.0 :: Loop Function To Removeallchildren?

Feb 8, 2009

i need a function that would remove all children of a specified container, except specified exceptions, something like removeall(cont, {cont.mc1, cont.mc2});that removes all children of cont, except the two mcs. if possible i need the number of exceptions to be not too limited.i almost made it, but then, when i needed to add the children back, i got stuck.the function needs to remember (array?) everything it has removed, including the state in which all of it was (alpha, scale, childinxed, etc);even that almost succeeded, but when i used one specific array that i declared outside of the function, if i used it to remove children of somebody else, i couldnt make the array remember both cases to add them later. make an array of arrays?anyway, i am very very much stuck, and would would be very happy to get out.if something like this exists on the web, would love a link. if not, i think such a function (especially integrated with an eventmanager class to make a super as3 nanny) would be a great gift to the as3 people.

View 14 Replies

ActionScript 3.0 :: Loop Without Use Of Timer Function?

Jun 28, 2010

have images play automatically when you don't click on PREV or NEXT buttons in a gallery for a certain amount of time.

I've used the TIMER function, but found that, when I click on PREV or NEXT, the timer would be activated again on that picture, which messes up the entire browsing experience.

View 10 Replies

ActionScript 2.0 :: Using The CreateTextBox Function In A Loop?

Oct 10, 2004

I'm creating a sort of psuedo DBMS in flash and I'm having trouble populating my tablesI'm creating input textboxes for each of the input values.My problem is this. The textboxes are being created in a for loop like this..

for(var i=0; i<recordsPerPage; i++){
var yellow = String("servId"+i);
this.createTextField(yellow, (i+13), 3.4, (23+17*i), 40, 24);

[code].....

View 3 Replies

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

ActionScript 2.0 :: Stop The Loop Function?

Jun 1, 2011

Am Creating a game in as2 an object come from left to right Randomly how do i stop the object i written script in single frame but it runs in all frame of the game

_root.onEnterFrame = function() {
passed++;
if (passed>speed) {

[Code]....

View 4 Replies







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