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
Similar Posts:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Feb 23, 2011
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
scrollRight_btn.onRollOver = function(){
thumbScroll(+5);
}
[code].....
View 1 Replies
Aug 5, 2004
I made a for in loop and a function to control my button mc's like this:
Code:
for (var i in this) {
if (this[i]._name.substr(0, 4) == "btn_") {
setButton(this[i]._name);
}
[code]....
but that isn't working.
View 11 Replies
Dec 27, 2004
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.
View 3 Replies
Jul 24, 2009
"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]
View 9 Replies
Feb 22, 2010
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.
View 2 Replies
Feb 23, 2010
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.
View 2 Replies
Mar 9, 2010
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?
View 4 Replies