ActionScript 2.0 :: Re-Evaluate Variables In A Conditional Loop?
Dec 17, 2010
Ive racked my brain on this one and I just cant seem to see what im doing wrong. I have 2 text boxes that need to be evaluated against each other. Both are input boxes that capture and store data into variables. I just want to compare those values and run the proper code. t works fine for the first round. If I enter new values, the variables are updated as well. But the new values are not applied to the condition the second time around.
var requested: Number = input_txt1.text;
var total: Number = input_txt2.text;
btn_mc.onMouseUp = doPress;
[code].....
View 13 Replies
Similar Posts:
Jun 17, 2011
I've been programming some stuff in Actionscript (haXe) and arrived this very specific problem. Here's the code (pseudo :S):
[Code]...
View 2 Replies
Oct 20, 2005
is it possible to make a shortcut something like this. this one doesnt work, but I thought there could be a way to make it work
[Code]...
View 2 Replies
Oct 27, 2009
I have a conditional statement (if) that I am trying to use contingent on multiple variables being true. So the AS I have right now is:
[Code]...
But when I run that I get the following error message: "Error 1050: Can not assign to a non reference value" What do I need to change so that once 1,2 and 3 have been visited visitComplete is set to true?
View 3 Replies
Jun 9, 2006
[code]In my real application, I've actually created a named array with element1 as key...so that I can address it directly by it's name.The problem is that - in my real application - the array2 element doesn't share a name in common with element1 (so I could address it by its name..as just told you,using named array) but with element5.
View 1 Replies
Mar 24, 2010
I am attempting to create what I call an 'On Air' rotator for a radio station. I would like to pull in an image file for each program when it is on air. I have the following AS 3 code that seems to work:
var now = new Date();
var day = now.getDay(); // Returns integer between 0 and 6
var hour = now.getHours(); // Returns integer between 0 and 23
[Code].....
The weekday programming is the same every day. We have some programs that are three hours in length. I would like to cut down on the number of statements I write. I am unsure how to combine the weekdays and have a range of hours in one conditional statement. Will the following work?
if (day >= 0 && day <= 4 && hour >= 6 && hour <= 10)
I'm attempting to express the condition "if the day is Monday through Friday and the hour 6 am to 10 am"
View 5 Replies
Aug 18, 2010
I am using the script below to move from a flash menu to other URLs. It works fine except we need to play the sound completely before sending the browser to the new URL. We are using external sound files and AS3.
[Code]...
View 5 Replies
Feb 21, 2009
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 Replies
May 5, 2011
Say, I had a loop in a function...
[Code]....
How would I refer to a in another function
View 8 Replies
Feb 1, 2012
I define this function
function beatsFilledcheck():void
{
if (a1Shape == "none" || a2Shape == "none"[code].....
whenever I run as
beatsFilledcheck();
it sets beatsFilled = true even if all but one a*Shape variables are still "none".cant understand why?
View 7 Replies
Jan 23, 2011
Is it possible to use a for loop to "combine" array variables..g.
Actionscript Code:
var myArray1:Array = [1, 2, 3]; var myArray2:Array = [1, 2, 3]; for (var i:Number in myArray1 && var i:Number in myArray2) //is something like this possible? { ...
[code].....
View 4 Replies
Jan 1, 2011
How am i to get the variables zombData.zomb0, & zombData.zomb1 from inside the "for loop"
I want this trace command dynamic
Quote: trace(zombData.zomb+i);
it works when i put zombData.zomb0 (a variable sent from a PHP script)but if i want to make it dynamic how it is; It fails & outputs NaN How do i make it dynamic for the loop?[code]...
View 1 Replies
Jan 5, 2010
I have 24 movie clip buttons. Named "btn1" through "btn24". I can't figure out how to return the variable as a number that cooresponds to each button onRollOver.
[Code]...
View 2 Replies
Jan 2, 2011
i'm trying to use a for loop to generate for me a set of vars, but it's not really working out. =.=.
I'm loading the image file names from a xml, and i want that the for loop create vars like "fotoToLoad0, fotoToLoad1 ..." and load the filename within.
I guessed i had to use the eval command, but as far as my ignorance sees it, when it is used, the eval makes a variable reffer to another and not fill it's value. (I guess i'm wrong thou).
Here's what i've tried so far:
Code:
for (i=0; i< totalNodes; i++){
var fotoEnd = imagesXML.firstChild.childNodes[i].firstChild.firstChild;
var fotoTemp = eval ('fotoToLoad'+i);
fotoTemp = fotoEnd;
That's quite not working thou =(. If i try used 'fotoToLoad1" for example, in a text box it just returns undefined
View 2 Replies
Apr 23, 2009
I used to dynamically set some variables using a FOR loop kinda like so PHP Code:
//Sorry, from memory
var possibleValues:Array = ["red","green","blue","yellow"];
for (i=0;i<possibleValues._length;i++){
_root["colorNumber"+i] = possibleValues[i];
}
Second question, using that code in a function would set the variables at the root level making them available throughout the timeline. Without "_root" how do I get that variable available to everything?
View 7 Replies
Jan 24, 2010
I need to make new sprites on-the-fly within a for loop, and this code does not work:
Code:
for(var i:int = 0; i<5; i++) {
var this['menuBtn'+i] = new Sprite();
[code].....
View 2 Replies
Dec 20, 2011
I'm trying to get specific variables out of a for each loop. These variables are used to display a click event on a marker on a map. If you click the marker on the map, the details pop over it. Now these details are being overwritten each time the loop starts (50 times). The solution I'm looking for, let's me select a marker on the map with the according detail attached to it.
There might be an easy solution but I haven't found it yet.
The code : for each(artistXML in artistList.events.event)
[Code]...
View 1 Replies
Sep 9, 2009
i'm having trouble creating an image preloader with a loop. my apologies, this might be a very simple task that i've been pulling my hair out over for an hour.
i have 8 UIloaders. each named image1,image2,image3, etc. they are inside a movie clip called "allClips_mc".
this VERY long, redundant code works:
Code:
magicBox_mc.allClips_mc.n1.image1.source = "newsClips/images/newscast01.jpg";
magicBox_mc.allClips_mc.n2.image2.source = "newsClips/images/newscast02.jpg";
magicBox_mc.allClips_mc.n3.image3.source = "newsClips/images/newscast03.jpg";
magicBox_mc.allClips_mc.n4.image4.source = "newsClips/images/newscast04.jpg";
[Code]....
View 2 Replies
Oct 6, 2010
ActionScript Code:
var val1:Number = 10.80;
var val2:Number = 11.54;
var val3:Number = 12.22;
How would I express this in a loop?
var sum:Number = val1 + val2 + val3;
View 3 Replies
Feb 15, 2005
Here's what I've got:
var cColor1:Color = new Color(mcBut1.mcFill);
var cColor2:Color = new Color(mcBut2.mcFill);
var cColor3:Color = new Color(mcBut3.mcFill);
var cColor4:Color = new Color(mcBut4.mcFill);
var cColor5:Color = new Color(mcBut5.mcFill);
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
Something like:
for (var i:Number = 1; i < 6, i++) {
var cColor+i = new Color(eval("mcBut"+i).mcFill);
}
View 2 Replies
Apr 26, 2002
I've a .txt-file containing variables. The variables are structured like this:
aaa_301, bbb_301, ccc_301
aaa_302, bbb_302, ccc_302
...
[code]....
View 9 Replies
Feb 1, 2010
i'm trying to create a menu system where each item expands in height when clicked but is then collapsed back to the original state when other items are clicked.m is the height of the expanded state. n is the height of the collapsed state. i is the number tacked on the instance name.Also, I'm using Tweener for smoother transitions. I've done this already by copying out the code but it's 24 items so 24x24 lines of code when I'd like to be able to do it a little more elegantly. Here's roughly what I want to do, but don't know if it's possible:[code]So every box below the one that's been clicked on most recently gets the value of m added to the y value and every box above doesn't.Is it possible to retrieve the value of the variable i that corresponds to the currentTarget?
View 1 Replies
Nov 21, 2010
I want to declare 8 variables at the class level like this:
Code:
private var graphicDesign1:Sprite;
private var graphicDesign2:Sprite;
private var graphicDesign3:Sprite;
private var graphicDesign4:Sprite;
[code]....
But I would like to do it with a for loop. Is that possible? If so i'm doing it wrong this is what I have.
Code:
for(var i = 1; i < 9; i++){
private var +"graphicDesign"+i:Sprite;
}
View 1 Replies
Apr 11, 2005
Code:
var x:Number = 0;
var y:Number = 0;
var i:Number = 1;
[Code]....
i have no access to y in the (x < 600) loop... yet i gets incremented every loop.
View 2 Replies
Feb 15, 2005
Here's what I've got:
[Code]...
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
[Code]...
View 2 Replies
Apr 18, 2005
i wanna create a photo album.this is thumbs page.
Code:
for(i=0;i<2;i++){
this.createEmptyMovieClip("logo_mc"+i+"", 999);
loadMovie(""+i+".jpg", logo_mc+i+);
}
how can i solve this problem about variables??
View 5 Replies
Aug 6, 2003
Code:// This example is set to evaluate half a second pause (500)
if (Number(getTimer()-lastClick)<500) {
// Add your doubleclick actions here
if (Reaction._visible eq false) {
setProperty ("Reaction", _visible, True);
} else {
[Code]...
This is a double-click detector.. I was just wondering, since I've never seen lastClick, is there such a thing as lastMove? I'm thinking of using onClipEvent (MouseMove) with a x and y detection timer, or could the one above have some hope?
View 3 Replies
Sep 4, 2010
The plan is to set up variables to react to a flashvars value like this:
[Code]...
There would be many mainVars (over 100, actually) and this setup isn't working.
View 1 Replies
Feb 3, 2011
want to make this stuff working.
Actionscript Code:
for (var i:Number=1; i<=3;i++){ var char_name+i = event.target.data.char_name_ + i;//It should be like//var char_name1 = event.target.data.char_name_1;//var char_name2 =
[code]....
View 2 Replies
Sep 4, 2010
The plan is to set up variables to react to a flashvars value like this:[code=html]<param name="flashvars" value="mainVars=1" />[/code]
[Code]...
There would be many mainVars (over 100, actually) and this setup isn't working.
View 2 Replies