ActionScript 2.0 :: Compare 2 Values In If Statement?
Oct 24, 2008whats wrong here?
Code:
if (_root.txt_1_a == _root.section_btn){
trace("match");
[code]......
whats wrong here?
Code:
if (_root.txt_1_a == _root.section_btn){
trace("match");
[code]......
With 5 variables consist of a value, I would need to check if any value between fa to fe has a gap of 6 in integer as in f1=1, f2=0, f3=0, f4=7, f5=10; and between f1 and f4, which has a gap of 6.
var f1:int
var f2:int
var f3:int
[code].....
I'm in need of a code that creates a cookie, so the next time someone enters the site, the animation won't come out.
How do I create the cookie? How do I get the values and compare to see if they are valid or not?
I need to be able to compare the number of whole days between two dates in ActionScript, is this possible? I'd like to test if one date is 7 days or less after today, and if so is it one day or less (if it's before today this also counts).The workaround I have in place is using the .time part of the date field:
// Get the diffence between the current date and the due date
var dateDiff:Date = new Date();
dateDiff.setTime (dueDate.time - currentDate.time);[code].....
As I say - this is only a workaround, I'd like a permanent solution to allow me to check the number of whole days between 2 dates. Is this possible?
how to compare values of 2 dates using actionscript i executed this code in my program..
var time1:Date = new Date(Number(fromDate.substr(0,4)),Number(fromDate.substring(5,7))-1, Number(fromDate.substring(8,10)));
[Code]....
right way to solving this problem, the truth is im not even sure how to structure it before Ive even got down to coding...the scene
Code:
values = new Array("v1", "v2", "v3", "v4", "v5");
I have 100+ records in this array. v1 - v5 all contain number values.
[code].....
how to compare values of two separate datagrids.for example lets say i have a datagrid named mg_dg like this:
PHP Code:
[code]...
this is sorta what i'd like to accomplish but not in the sense of using a textinput component.it filters the datagrid of the text typed into the textinput component.
I'm creating this math based game for my son to learn math. Everything was going fine until the last if statement. What I need it to do is compare two values and determine if they are an identical match and if so say is correct and if not then say its incorrect. I have a random number generator and that number is being stored in a variable String and then it is being converted into a number, that part works. I then have setup like a calculator 4 different variables that act as plus, minus, multiplication and division. Since there is 4 different variables i have been thrown into a loop and can't figure this one out!This is my random number generator:
ActionScript Code:
var RandomNumS: String = "0";
var RandomNum : Number = Number(RandomNumS);
[code]....
I am creating a card game application in that dynamic movieclips created on stage and inside those movieclips different cards can drop, which have some values.
If one movieclip contains one card and another movieclip contained two cards and all the other movieclips 3rd,4th,5th.. etc contains some cards then, if i want to go back and want to drop another card at the top of the old one, than how i can do this, because when i go back and drop a new card inside movieclip than it replaces the old one. i don't want to create a new array for each movieclip.
I'm afraid I know the answer but I wanted to check first.
I want to run a single function based on multiple values.
[Code].....
I've got a little script that scales a video to the stage. The scaleing function has a switch statement to indicate what kind of scaling to apply.
If I declare the case value of the switch statement internally all is fine. However if I load this value from an XML doc, even though the trace indicated the value has loaded, the switch never fires.
ActionScript Code:
/stage variables
var sH:Number;
var sW:Number;
[Code].....
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"
The dictionary use strict equals(===) for key comparison, how to change the comparison, so I can use my standard for comparison, for example, I have a class named Student:
class Student{
var id:int;
var name:String;[code]....
I want Dictionary use id to compare if the two keys are equal, not use strict equal(===) to compare if the key is the same.
Having a few problems with what I thought was a simple if statement. Here is the code:
[Code]...
I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.
if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code
[Code]...
I dont want to copy the code from the first into the second and the first and second into the third.
My mind isn't working and there is probably an extremelly simple way to get this working.
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);
Heres the code:
Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
[code]....
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.
why this code won't work
[Code]...
I'm sure you can put if statements inside other if statements, seriously I can't figure it out
I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.
View 13 Replieswhat I'm trying to do is create an else if argument for each object in an array based on a user set number
Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}
to which I want it to GENERATE THE FOLLOWING CODE:
Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}
the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?
I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...
example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}
I've gotten these sliders to work but can't get the output values to add up. For instance, depending on the values for slider 1, 2 and 3, I need the total to show up in a separate text box. I keep getting a NaN message in the text box.Here's the code I have so far:
//item 1
sliderOne.width = 600;
sliderOne.value = 0;[code].....
How does one Compare Dates, as in
If (sampleDate is before TodaysDate) {
do something
}elseif (sampleDate is after TodaysDate) {
do something else
}
Is there any simple way to compare two arrays. i.e.; I have two arrays (a,b,c,d,e) and (b,c,d) after comparison I would like to get an array (a,e).
View 5 RepliesI've two Combo Box(cbFirst & cbSecond). I want to compare the value that has been selected by the user and based on the result, output is displayed. In both Combo Box I've provided the value.Here is my code:
var a:Number;var b:Number;
function First(evt:Event):void{ a = evt.target.value; trace(a); }cbFirst.addEventListener(Event.CHANGE, First);
[code]......
How to compare two audio files to see the difference of them.
View 4 RepliesI want to check whether string is empty or not when i create object=Shared.getLocal("abc"); it assigns undefinded to the object at the first time
if(object.data.name=="undefnied") {
// is this correct
}
I have this function:
private function returnFees(row:Object,name:String):int
{
var fee:int;
for each(var obj:Object in row)
[code].....
I want to compare the name of properties to the 'name'. But in this code the 'obj' is giving me the values of properties not the name.
How i can compare two array. following my code..
var my_array:Array=Array(5,10,15,20,25,30)
var new_array:Array=Array(7,8,9,10,11,12,13)
for(var i:Number=0;i<my_array.length;i++){
[code]....
I have two arrays myArray1 and myArray2.[code]How can you compare two arrows?
View 3 RepliesI need to compare a random numbers of XML files, sometimes is 3 and others 500, the swf need�s to loop the entire directory and check each XML to see if the TAG inside of it it�s equal to the SWF filename, here�s what I got until now.
ActionScript Code:
var file_name_only:Array = _root._url.split("/");
var file_swf:String = file_name_only[file_name_only.length-1];
//var file_swf='6723.swf'
[code]....