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?
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
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?
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
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();}
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...
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.
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;
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:
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..
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.
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:
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.
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..
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?
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) {
well its not really a loop in the strict programatic sense, but the effect is similar. I have a function attached to a button that uses the onEnterFrame event of an MC to start some action. When I rollout I want the action to stop, similar to using a clearInterval method. I tried using the setInterval method to create the action but the values inside the interval function are only checked at the first call of the setInterval, not after each interval.I'll admit I am far from a programer or any kind of expert in code, so my methodology may be completely whack. I am open to suggestions to better solutions...FYI, here is the code I am using
I've modified Squirrel Finder (off Kirupa) a little to create a list that goes to various links. Only problem is, the links for each button do not match, as I believe the linking function is not going through the loop. I've included a FLA, I need it so that the label goes to the URL specified in the XML. In this case, Google goes to [URL] when clicked, and eBay goes to [URL] when clicked.
"256 levels of recursion were exceeded in one action list.This is probably an infinite loop.Further execution of actions has been disabled in this movie."Why do I get this error (above) when I use the code (below)? Why isn't this acceptable? [I use function similar to this in Javascript with no problem.][code]
I want to call a function and pass a different array value each time. bit difficult to explain but see below:
Code: var mnu:ContextMenu = new ContextMenu(); mnu.hideBuiltInItems();[code].......
This just uses the context menu as an example. If you run it & right-click on a, b, or c, you get #a every time.What am I missing?! Why is it always #a? I have also tried using apply() but it gives me the same result.
I just got stuck with something while making an animation. I am making an animation where I want the last frames to keep repeating I want everything else to stop playing but to have specific animations repeat from a certain key-frame. Something like the animation on this site.
I have 20 players in a game and cutting and pasting lots of code except for a few numbers. I have future features that would require over 400 lines of mostly repeated code. So I learned how to use "for", and practiced with a trace command. Traced the results exactly as I thought. However when I apply it to the guts of my function, the movie breaks down. I suspect it's because the function is being called on an EnterFrame command and the for loop I wrote is being executed over and over.
This works when I hand code: Actionscript Code: function drill(){GUESS0 = ((guess0min * 60)*1000) + ((guess0seconds * 1000)) GUESS1 = ((guess1min * 60)*1000) + ((guess1seconds * 1000)) GUESS2 = ((guess2min * 60)*1000) + ((guess2seconds * 1000)) GUESS3 = ((guess3min * 60)*1000) + ((guess3seconds * 1000)) GUESS20 = ((guess20min * 60)*1000) + ((guess20seconds * 1000)) //and then 300 more lines of other code}
And then a button later calls this when pressing: Actionscript Code: my_MC.onEnterFrame = function(){_root.drill (); //so _root.drill is continually being called, which is good, because it has all sorts of data that needs to be refreshed, but I think it's screwing with my "for" loop.}
And the following is NOT working. Actionscript Code: function drill(){for (i=0;i<20;i++){ "GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));";}
But when I trace it in a separate test movie, it outputs exactly what I would hope it placed in the code: Actionscript Code: for (i=0;i<5;i++){trace("GUESS"+i+" = ((guess"+i+"min * 60)*1000) + ((guess"+i+"seconds * 1000));");}
So at the end of the day, I guess I can trace these results in a test movie and use it to generate what I need, and cut and paste it into the project... but I thought 'for' loops were for saving time AND space. Am I using this code right? Maybe my use of "", or +, or i is misguided?