Date Comparison Script (using Strings From Db)
Hey all,
I have this great date comparison script that works with the date object:
ActionScript Code:
target_date = new Date();
target_date.setYear(2005, 8, 16);
target_date.setHours(9, 0, 0, 0);
// loop to display clock
this.onEnterFrame = function() {
var now_date = new Date();
var diff = targetDate-now_date.getTime();
// 86400000ms in a day
var days = Math.floor(diff / 86400000);
diff -= days * 86400000;
// 3600000ms in a hour
var hours = Math.floor(diff / 3600000);
diff -= hours * 3600000;
// 60000ms in a minute
var minutes = Math.floor(diff / 60000);
diff -= minutes * 60000;
// 1000ms in a second
var seconds = Math.floor(diff / 1000);
var miliseconds = Math.floor(diff / 100);
// update the text fields
days_txt.text = days;
hours_txt.text = hours;
minutes_txt.text = minutes;
seconds_txt.text = seconds;
miliseconds_txt.text = miliseconds;
};
however, i need to get the current date from a string passed in by PHP and the target date from a string passed in by PHP.
i notice that if i trace out target_date i get: Fri Sep 16 09:00:00 GMT-0400 2005
however, if i set a string like newTargetDate = "Fri Sep 16 09:00:00 GMT-0400 2005"; i cannot use this for comparison because i cant invoke the .getTime() function on it.
anyone know how i would go about doing this?
thanks much
Ultrashock Forums > Flash > ActionScript
Posted on: 2005-09-06
View Complete Forum Thread with Replies
Sponsored Links:
Converting A Date To A Numerical Formart For Comparison
Hello Guys,
Having problems converting a date (i.e. 12/12/2004) to a numerical format (i.e. 10030430003). Using flash MX 2K4. Flash keeps on returning NaN? Code posted below:
ActionScript:
var my_str = eval(currentColumnVal2);
var my_array:Array = my_str.split("/");
var new_array:Array = new Array();
new_array[0] = my_array[2];
new_array[1] = my_array[1];
new_array[2] = my_array[0];
var tmp_currentColumnDate = new_array.join(",");
var my_date:Date = new Date(tmp_currentColumnDate);
var mynum:Number = my_date.getTime();
trace(mynum); //Will return 'NaN'
trace(tmp_currentColumnDate); //Will return '2004,10,12'
trace(eval(currentColumnVal2));//Will return '12/10/2004'
Any ideas would be greatly appretiated,
Oli
View Replies !
View Related
Numbers, Strings, And The Date
Sorry for the really simple question, but I forgot something. Let's say I'm trying to display the date. For the minutes thing, I have:
minutes = my_date.getMinutes()
First, I think I need to convert that second thing into a string.
Second, do I need to introduce my date variable earlier? That's kind of weird.
Thanks.
By the way, I believe that this AS shows up as undefined. (not NaN, whatever that is).
View Replies !
View Related
Numbers, Strings, And The Date
Sorry for the really simple question, but I forgot something. Let's say I'm trying to display the date. For the minutes thing, I have:
minutes = my_date.getMinutes()
First, I think I need to convert that second thing into a string.
Second, do I need to introduce my date variable earlier? That's kind of weird.
Thanks.
By the way, I believe that this AS shows up as undefined. (not NaN, whatever that is).
View Replies !
View Related
I Need To Validate Date Strings Input With Keyboard
I'm working on a project where a user inputs date via a touchscreen keyboard into a database. We have to work with the clients database as is, and there is a strict datatype requirement for the date. The date has to exist on the calender ie. 2-29-04 works but 2-29-05 does not (leap year).
Now, I know how to make a calendar/event schedule with the date object, and do have the option of just ploping a calendar in front of them to navigate through and select a valid date, and this seems like the best idea right now. However, I would like to know if anyone has just validated user input dates via keyboard into a field, so I could just keep the keyboard up there for them, instead of switching the interface around so much.
Thanks for any help.
View Replies !
View Related
Are Strings Arrays? 4 Digit Date To 4 Element Array?
Getting my feet wet in actionscript and see that it sure resembles javascript, which, if I remember correctly lets you access each individual characters in a string as an element in an array. Can this be done in actionscript?
what I'm trying to do is turn the .getFullYear (2001) into some sort of form where I can access each individual number, be the 2 the zeros or the 1.
View Replies !
View Related
Retriveing Date Variables From Text File/ Converting Strings To Dates
Hi,
I'm trying to read date variables from an external text file. I'm using the LoadVars method and it is working fine for regular string variables. I'm running into trouble trying to convert some of those strings into date variables so I can compare the current date to the targetDateX variable from the text file. I'm working on a countdown timer for a list of different times/dates. It will display the time left until the first event, then after that event the time left until the second event. I'm running the code in a for loop and everything is working except being able to convert the string with format (yyyy,mm,dd,hh,mm) into a date variable- I've attached a sample of where I'm having trouble.
Thanks in advance for any help! :)
Attach Code
var targetDateX:String = "targetDate" + i;
//sets a variable targetDateX equal to the variable targetDate(i) so that you can read it from the text file
var targetDateA:Date = new Date (this[targetDateX]);
//attempting to set it into a date format
trace (this[targetDateX]);
//returns the variable stored with the name targetDate(i) in the text file
trace (targetDateA);
// returns 'Invalid Date'
Edited: 11/09/2008 at 12:45:04 PM by wyattr1
View Replies !
View Related
Prob With Comparing Utf-8 Enc Loaded Strings With Other Strings
I load a bunch of strings from a MySQL database. Those strings have been utf-8 encoded before being put there. When I load one of the strings and compare with a string defined inside flash it works great as long as the string doesnt have more than one word. Two words or more doesnt work.
So loaded string "Oil and vinegar" isn't equal to the internally set string "Oil in vinegar" according to flash, although it is utf-8 encoded in the database...
blablabla load string "Oil and vinegar" from db into var words
if (words == "Oil and vinegar") { blablabla }
but this condition never evaluates as true....
What am I doing wrong?
View Replies !
View Related
Convert RSS2 Date Format To Flash Date() Object
How can I take an RFC 822 (RSS 2) formatted string, and read it into a Flash MX Date() object. Flash does'nt like the format.
I have a function that will break the string apart the long way but is there an easier way to accomplish this - I can't believe flash would'nt have it built in like .NET or ColdFusion.
Thanks!
Aaron
View Replies !
View Related
Comapreing A Datefield Selected Date To Current Date
i have a made a small swf which checks the seleted date on the datefield component is passed current date or not...
i have a function get the day associated with it...
stop();
function getDayName(num) {
switch (num) {
case 0 :
return "Sunday";
break;
case 1 :
return "Monday";
break;
case 2 :
return "Tuesday";
break;
case 3 :
return "Wednesday";
break;
case 4 :
return "Thursday";
break;
case 5 :
return "Friday";
break;
case 6 :
return "Saturday";
break;
}
}
today = new Date();
today = getDayName(today.getDay())+" "+today.getMonth()+" "+today.getDate()+" 00:00:00 GMT+06000 "+today.getFullYear();
on relese event of the button...
dateField is named - arr_date
on (release) {
_global.selday = _root.arr_date.selectedDate;
_global.selday2 = getDayName(_global.selday.getDay())+" "+_global.selday.getMonth()+" "+_global.selday.getDate()+" 00:00:00 GMT+06000 "+_global.selday.getFullYear();
res = (selday2<today);
_root.dis = res;
}
the thing is sometimes res says "TRUE" for future dates also.
download fla here
can anyone help on this.
Thanks
View Replies !
View Related
Display Date And Day With Computing Three Days From The Date With Certain Restriction
Hi
i have a code that display date and day from your local machine.
Here it is:
================================================== ===========
function howlong(arg) {
if (length(arg) == 1) {
arg = "0"+arg;
return arg;
} else {
arg = arg;
return arg;
}
}
myDate = new Date();
//hr = howlong(String(myDate.getHours()));
//mnt = howlong(String(myDate.getMinutes()));
daytext = myDate.getDay();
//daytext = daytext+3;
dd = myDate.getDate();
//dd = dd+3;
mm = myDate.getMonth();
//yyyy = myDate.getFullYear();
switch (daytext) {
case 0 :
daytext = "Sunday";
break;
case 1 :
daytext = "Monday";
break;
case 2 :
daytext = "Tuesday";
break;
case 3 :
daytext = "Wednesday";
break;
case 4 :
daytext = "Thursday";
break;
case 5 :
daytext = "Friday";
break;
case 6 :
daytext = "Saturday";
break;
}
switch (mm) {
case 0 :
mm = "Jan";
break;
case 1 :
mm = "Feb";
break;
case 2 :
mm = "Mar";
break;
case 3 :
mm = "Apr";
break;
case 4 :
mm = "May";
break;
case 5 :
mm = "Jun";
break;
case 6 :
mm = "Jul";
break;
case 7 :
mm = "Aug";
break;
case 8 :
mm = "Sep";
break;
case 9 :
mm = "Oct";
break;
case 10 :
mm = "Nov";
break;
case 11 :
mm = "Dec";
break;
}
textdate = (daytext+", "+mm+". "+dd+".");
================================================== ===========
Now problem is it should compute three days from that date with certain restrictions like (dont count Saturday and Sunday, Dec 25th, Nov, 22nd, Jan 1st)...
I have to display the date based on the above rules..
plz help
Thanks
maxarindam
View Replies !
View Related
Comparison
flash mx
can someone help me please...
i entered this on a frame of my movie clip, and i have five text field, for each text field that is not blank, it supposed to add 1 to c, but it doesn't seem to work at all,
can someone tell me what's wrong with the code please...
<code>
for(i=0;i<5;i++)
{
if(varray[i] != "")
{
c++;
}
else{
}
}
</code>
View Replies !
View Related
Y Comparison
I want a movieclip to move a certain distance away from another movie clip, when it touches another movieclip, this is what I have
onClipEvent (enterFrame) { if (this.hitTest(_root.fall)) { _y = _root.wall3._y+20; } }
this is in the movie clip i want to move, wall3 is what i want it to move away from, fall is the trigger.
plz help if you can, i don't know what I'm doing wrong
View Replies !
View Related
String Comparison
Hi, I'm facing some problems on string comparison, I can't figure out why. Below is my code:
if (thisURL != "http://192.168.1.36/url.html") {
gotoAndPlay ("wrong", 1);
} else {
gotoAndPlay ("correct", 1);
}
thisURL is a variable being passed in from javascript. I've checked and confirm that it is eq to http://192.168.1.36/url.html There's no trailing spacing in front and behind. But it keep going to the "wrong" scene instead of the "correct" scene. I just don't understand why. I've even tried to force the variable to a String by using String(thisURL) but it still doesn't work. Someone teach me plz.
View Replies !
View Related
Software Comparison
hi all,
i've recently been trialling FlashMX (i'm a newbie) and i've found it good, although very complex. At the same time, i've been talking to a more experienced user who says that he prefers flash5 to MX. I'm just wondering about peoples' opinions: which is better (or why is one better than the other)
i can get flash MX fairly cheap for the academic price, so that's not really an issue, it's all about which actual software is better...
all opinions appreciated
Stuart
View Replies !
View Related
Comparison Operators
Hi Everyone,
I am about this... Any clues???
I am loading a text file into a dynamic textfield named "text"
I am trying to check if "text" is empty
if (_root.text ne ""){
_root.gotoAndPlay("end");
}else{
_root.gotoAndPlay("start");
}
Right now I am using 'ne' because it works when I use this, (and I know that it is deprecated) BUT, when I use '!=' it doesn't work.
Someone please shed some light as I don't want to have to use any deprecated items.
Thank you!
View Replies !
View Related
Text Comparison
I'm Making a Quiz where you have to actually Type the answer, it works just fine but I don't know how to make a comparison without the Matching Case option.
How can say to Flash that text = TexT ? ? ? ?
Cheers
View Replies !
View Related
Array Comparison
Hello. I am trying to fix this error. I am trying to make an array that wont have repeating entries. I will explain the problem.
I am making a game that uses a coordinate system (x,y) in an array to dynamically script the needed map piece. It is going to be a failry large map, so I need to make sure it dosent ever make more than one instance of the same x,y coordinate. The coordinates are placed into the array when the player moves into the coordinate. Here is what I have for script
Code:
onClipEvent (enterFrame) {
if (change==1) {
//change is a variable checked when the player moves off the edge of a map.
for (j=0; j<_root._level0.map.length; j++) {
// I guess this runs thru the array "map" and compares the two strings.
if (name==_level0.map[j]) {
break;
// a break makes it not continue forever (?)
} else {
_level0.map.push(name);
// the coordinate is added if it is not in the array already (?)
break;
// breaks the command to stop looping.
}
}
}
}
Thanks in advance
View Replies !
View Related
Variable Comparison
im trying to compare two variables and if they match perform an action, im not sure where the error is..
here is what i have
if (_root.var1 == _root.var2){
setProperty("_root.MC", visability, true);
}
thanks
View Replies !
View Related
Array Comparison
Hi,
I have a code that goes..
on (release) {
_root.d0 = Number(array1[0])-Number(array2[0]);
_root.d1 = Number(array1[1])-Number(array2[1]);
_root.d2 = Number(array1[2])-Number(array2[2]);
_root.d3 = Number(array1[3])-Number(array2[3]);
}
and i compacted that to...
on (release) {
for (i=0; i<array1.length; i++) {
_root.d[i] = Number(array1[i])-Number(array2[i]);
}
}
But it dose'nt work!!!!!!!!!!
Anybody??
View Replies !
View Related
Mathematical Comparison
hello!
I have a doubt: i need to make a mathematical comparison between 2 numbers, using it in a if statement:
shouldn't be:
if (x > 10 && x < 12){
trace(X)
}
returning the x number 11?
Its not working! Can anybody help me out please. Thank you
View Replies !
View Related
Time Comparison
Not sure how to do this, I'm trying to validate a form, I've got all the form stuff working, but I have 2 fields: StartTime and EndTime, and they're comboboxes, with the same lists of about 20 entries : 7:00 AM to 5:00 PM in 30 minute intervals
I'm trying to make sure that someone doesn't accidentally enter an EndTime that's before the StartTime, but I'm not exactly sure how to compare these two fields. (if EndTime < StartTime)
Any help is greatly appreciated, thanks!
View Replies !
View Related
Array Comparison
Hello,
The code below compares two arrays indexed values. This code works fine. The code checks each index to match index to index.
But, I'm creatig a drag & drop quiz that needs to compare & test as true the entire array elements even if the index are out of order. For example, if choices pushed into the array was 6,5,1 the values would still be true because all the correct choices where made even though it's elements don't match index for index.
Any help would be greatl appreciated.
iaustin
answers = new Array(1,5,6);
choices = new Array(1,5,6);
for(var i=0; i<=answers.length; i++){
if(answers[i] != choices[i]){
//load answers
notmatched = choices;//single wrong index
trace("arrays not matched==" +notmatched);//works & show index difference
trace("answers== " +answers);
trace("choices== " +choices);
//break;
}else{
bothmatch= "both match";
trace("answers== " +answers);
trace("choices== " +choices);
trace(bothmatch);//still shows??? even if not matched!
//break;
}
}
View Replies !
View Related
[F8] Text Comparison
I have a program that compares some built in text and some text that a person inputs. Basically I want to compare two strings and see how accurately one was typed in. How close it is to being like the other.
View Replies !
View Related
String Comparison
Hello,
I have a problem to determine the equality of two strings.
Code:
var mydate = new Date();
var theMonth = new String(mydate.toString().substring(4,8));
if(theMonth =="Oct"){
trace("Yes");
}
I have tried eq as well. Both gave no reponses. Does anyone know what happen? Do you know what I did wrong.
Thanks for your help. I just cannot figure it myself ...
^^
View Replies !
View Related
Variable Comparison
Hello
in a main function I have an mc with 3 buttons and I'm trying to compare the anwser chosen by the user with the right answer.
But even if the two traces gives me the good values the If statemnt doens't work thought they are the same types :Number
Code:
function main_function (){
var reponse : Number = 3
function guess (bt_num:Number){
question_mc["answer_"+bt_num].onRelease = function (){
trace ("Ipress"+bt_num)
trace ("the answer is : "+reponse)
if (bt_num === reponse){
trace("good")} else
{trace ("bad")}
}
Thanks
}
guess(1)
guess(2)
guess(3)
}
View Replies !
View Related
String Comparison
can anyone help me to debug the code please.
it seems like the if statement doesnt compare those two strings, as it always go into the else statement.
help...
code:
var inputText: String;
var rightAnswer: String = "keep";
inputText = String (txtText.text); //txtText is an input box
trace(inputText); // it does return watever user puts into the input box
if (inputText == rightAnswer) {
trace(inputText == rightAnswer) // it returns as undefined.
imgTick._alpha = 100;
}else {
imgCross._alpha = 100;
}
thank you....
View Replies !
View Related
Array Comparison
Last edited by Codemonkey : 2006-03-26 at 10:45.
Hello,
The code below compares two arrays indexed values. This code works fine. The code checks each index to match index to index.
But, I'm creatig a drag & drop quiz that needs to compare & test as true the entire array elements even if the index are out of order. For example, if choices pushed into the array was 6,5,1 the values would still be true because all the correct choices where made even though it's elements don't match index for index.
Any help would be greatl appreciated.
iaustin
ActionScript Code:
answers = new Array(1,5,6);
choices = new Array(1,5,6);
for(var i=0; i<=answers.length; i++){
if(answers[i] != choices[i]){
//load answers
notmatched = choices;//single wrong index
trace("arrays not matched==" +notmatched);//works & show index difference
trace("answers== " +answers);
trace("choices== " +choices);
//break;
}else{
bothmatch= "both match";
trace("answers== " +answers);
trace("choices== " +choices);
trace(bothmatch);//still shows??? even if not matched!
//break;
}
}
View Replies !
View Related
DATE() Reads Date From Server Or User?
2 questions about DATE() function:
1º The value is taken from the date setted on the server or the user machine?
2º How do i break apart the value to check each value? I mean, day, month, etc.
Im working on a quiz that has to display a different question every 15 days. Im loading them from a TXT. I´m missing that part of the code.
Thanks for any help.
View Replies !
View Related
Flash MX: Date To String And Back To Date
Greetings,
Im struggling to (a date which is converted to a string to format date as mm/dd/yyyy hh:mm:ss") transform the string textDate into a Date?
Im looking at mxateFormatter but I dont understand how it works
Any advice and guidance would be appreciated.
Cheers
Rob W
Code:
displaydate = new Date();
var day = displaydate.getDate()>9 ? displaydate.getDate() : "0"+displaydate.getDate();
var month = displaydate.getMonth()+1;
var years = displaydate.getFullYear();
if (month <9)
{
var month = "0"+month;
}
displaydate = (month + "/" + day + "/" + years);
timedisplay = new Date();
var hours = timedisplay.getHours()>9 ? timedisplay.getHours() : "0"+timedisplay.getHours();
var minutes = timedisplay.getMinutes()>9 ? timedisplay.getMinutes() : "0"+timedisplay.getMinutes();
var seconds = timedisplay.getSeconds()>9 ? timedisplay.getSeconds() : "0"+timedisplay.getSeconds();
timedisplay = (hours + ":" + minutes + ":" + seconds);
_root.textDate = (displaydate + " " + timedisplay)
View Replies !
View Related
Bad Data From Date.getDay() And Date.getMonth()
I am trying to utilize the Date class to retrieve the current date, and populate fields for each date part. However, the day and month returned from either the day/month properties or the getDay()/getMonth() methods are incorrect: today is 4/11/2008, yet I get back a month of 3 and a day of 5!
Here is the relevant code:
var curDate:Date=new Date();
NewProjectStartMonthField.text=String(curDate.getMonth());
NewProjectStartDayField.text=String(curDate.getDay());
NewProjectStartYearField.text=String(curDate.fullYear);
View Replies !
View Related
Comparing Current Date With Date String
Im loading in a date from a database and storing it in a string called dateToCheck. The dates I am loading in from my datebase could be anything so I want to check if its past, present or future but as its a string and not a date when I compare to the current date it doesn't seem to work.
Im storing the current date in actions script like this
var today_dateate = new Date();
var date_str:String = (today_date.getDate()+"/"+(today_date.getMonth()+1)+"/"+today_date.getFullYear());
Do I need to convert the value date value Im loading from my database into a proper date before I can check it agains the current date? If so is there any easy way of doing it.
Thanks
View Replies !
View Related
Wierd Comparison Issues
Hi all,
I have an array of numbers, and I want to find the highest number
// myArray = [45,67,22,98,16,150,80]
i am using code as such:
//
BiggestNumber = 0
for (i=0, i<myArray.length, i++){
if (myArray[i] > BiggestNumber) {
BiggestNumber = myArray[i]
}
//
Now this is all good and well until we get to the "150", and for some reason, the computer thinks that 150 isn't bigger thn the 98, and so it quotes 98 as the biggest number. If I put the 98 after the 150, same thing happens. Completely ignores the 150.
Can anyone help me out.
Thanks in advance
View Replies !
View Related
String & Variable Comparison
Hi,
Within a flash mx listbox, I made a button. On release I want the indexvalue(of the selected listbox row where the button is at), to be displayed in the root timeline(variable _root.letter) and the button's textfield (variable TextField1).
I did the following so far:
on (release)
{
_root.letter=Textfield1;
}
When I press the button within the listbox, the _root.letter variable displays, e.g. depending on the index value:
_level0.stockBox.container.fListItem0_mc.stockHist MC.textfield1
_level0.stockBox.container.fListItem1_mc.stockHist MC.textfield1
_level0.stockBox.container.fListItem2_mc.stockHist MC.textfield1
How can I filter the numbers out of fListItem0,1,2,3,...etc so that it will show at _root.letter?
Help appreciated
cheers
Patrick
View Replies !
View Related
String Comparison Problem
I am currently using Flash MX 2004 Pro on my windows xp professional pc. I am writing a program which reads in events from an external XML file then orders the events into array and automatically determines which events to display based on the current date. The program has to compare the date of each event to the actual date to determine if the event has already happened. However I have run into the following problem. Below in the current format of an event:
event
number
month
day
year
promotion
description
end event
the event are read into flash and sorted into separate arrays titled myMonths, myDays, etc. Being as the variables are read from external xml files, they are stored as string arrays. When using the string comparison functions I find the following:
"8" is less than "9"
"9" is greater than "8"
"10" is less than "11"
"11" is greater than "10"
"9" is greater than "10" **
"10" is less than "9" **
if you notice the last 2 don't make sense. I understand the comparison probably compares the length first or one substring at a time and finds the "9" > "1" and ignores the 0. Is there a way to correct this bug? or possibly a way to do this kind of comparison without have to check the string length first?
View Replies !
View Related
++ Comparison Problem + URGENT PLEASE HELP ++
Thank you for trying to help.
flash 5
I am using the script below in the first frame of my movie to determine wether or not I am viewing it online or from a cd.
It works fine offline but online although my variable 'mystring' is setting to 'fttp' it is still asigning a 'yes' value to cd and the movie stops.
I am baffled, please explain the stupid mistake I must be making.
cd = 0;
_root.mystring = substring ( _url, 1, 4);
if (_root.mystring=="fttp") {
play ();
} else {
cd = "yes";
stop ();
}
View Replies !
View Related
Using Contains Comparison In Mx.xpath.XPathAPI
Is it possible to use something like this using m.xpath.XPathAPI parser
var recordPath:String = "/RECORDLIST/RECORDS/RECORD[contains(@name,'192.COM')]";
title_array = mx.xpath.XPathAPI.selectNodeList(codeFeed.firstChi ld, recordPath);
I am trying to match the values in the attribute name that contain "192.com"
This should be possible, but am not able to get any examples or documentation could someone help?
Thanks
KashSen
View Replies !
View Related
Array Comparison To String?
Hi
Im just working on an application and can any one tell me why this doesnt work and any possible ways round it?
trace(aArray[0].toString());
trace(["tField" + unique]);
if (aArray[0].toString() == ["tField" + unique]){
trace("ok");
}
right ok is never reported as a trace yet the first trace and the second report the exact same thing. so why is it that flash does not see them as the same if they are the same in trace?
trace(aArray[0].toString()); //traces tFieldOne
trace(["tField" + unique]); // trace tFieldOne
A little help?
View Replies !
View Related
Discrepency When Using Comparison Symbol?
Dear all!
I noticed there are some discrepency in result when using comparison operator between _width and a constant number.
In my test setup, I drew an arbitrary shape and converted it to a movieclip with the name "platform". Then I assigned a frame action script to it.
Code:
var platform:MovieClip = _root.platform ;
doit( platform._width ) ;
function doit( mywidth:Number ):Void
{
trace ( "mywidth = " + mywidth ) ;
trace( "Is mywidth >= mywidth ? = " + ( mywidth >= mywidth ) ) ;
trace( "Is mywidth <= mywidth ? = " + ( mywidth <= mywidth ) ) ;
trace( "Is mywidth == mywidth ? = " + ( mywidth == mywidth ) ) ;
trace( "Is mywidth >= 1281.8 ? = " + ( mywidth >= 1281.8 ) ) ;
trace( "Is mywidth <= 1281.8 ? = " + ( mywidth <= 1281.8 ) ) ;
trace( "Is mywidth == 1281.8 ? = " + ( mywidth == 1281.8 ) ) ;
trace( "Is 1281.8 >= mywidth ? = " + ( 1281.8 >= mywidth ) ) ;
trace( "Is 1281.8 <= mywidth ? = " + ( 1281.8 <= mywidth ) ) ;
trace( "Is 1281.8 == mywidth ? = " + ( 1281.8 == mywidth ) ) ;
trace ( "platform._width = " + platform._width ) ;
trace( "Is platform._width >= platform._width ? = " + ( platform._width >= platform._width ) ) ;
trace( "Is platform._width <= platform._width ? = " + ( platform._width <= platform._width ) ) ;
trace( "Is platform._width == platform._width ? = " + ( platform._width == platform._width ) ) ;
trace( "Is platform._width >= 1281.8 ? = " + ( platform._width >= 1281.8 ) ) ;
trace( "Is platform._width <= 1281.8 ? = " + ( platform._width <= 1281.8 ) ) ;
trace( "Is platform._width == 1281.8 ? = " + ( platform._width == 1281.8 ) ) ;
trace( "Is 1281.8 >= platform._width ? = " + ( 1281.8 >= platform._width ) ) ;
trace( "Is 1281.8 <= platform._width ? = " + ( 1281.8 <= platform._width ) ) ;
trace( "Is 1281.8 == platform._width ? = " + ( 1281.8 == platform._width ) ) ;
}
Then I proceed to "Control > Test Movie". Here is my test trace output:
mywidth = 1281.8
Is mywidth >= mywidth ? = true
Is mywidth <= mywidth ? = true
Is mywidth == mywidth ? = true
Is mywidth >= 1281.8 ? = true
Is mywidth <= 1281.8 ? = false ( Why is this false? )
Is mywidth == 1281.8 ? = false ( Why is this false? )
Is 1281.8 >= mywidth ? = false ( Why is this false? )
Is 1281.8 <= mywidth ? = true
Is 1281.8 == mywidth ? = false ( Why is this false? )
platform._width = 1281.8
Is platform._width >= platform._width ? = true
Is platform._width <= platform._width ? = true
Is platform._width == platform._width ? = true
Is platform._width >= 1281.8 ? = true
Is platform._width <= 1281.8 ? = false ( Why is this false? )
Is platform._width == 1281.8 ? = false ( Why is this false? )
Is 1281.8 >= platform._width ? = false ( Why is this false? )
Is 1281.8 <= platform._width ? = true
Is 1281.8 == platform._width ? = false ( Why is this false? )
I had expected it to be "true" for all. However, I noticed there are some "false" in my result. Does anyone know why this is so? Attached with this post is my source code. Please advice, many thanks in advance!
View Replies !
View Related
[MX04] Wonder Of Comparison Result
hi,any one test this as follow as
Code:
// part 1
trace (undefined > 1);
trace (undefined < 1);
trace (undefined == 1);
trace (undefined >= 1);
trace (undefined <= 1);
// part 2
trace (undefined > undefined);
trace (undefined < undefined);
trace (undefined == undefined);
trace (undefined >= undefined);
trace (undefined <= undefined);
//output
undefined
undefined
false
true
true
//
undefined
undefined
true
true
true
it make me wonder.in fact you can become '1' instead of anyother value in part 1.
i don't know how get the value in flashself
why the result is undefined when comparison > and <,but is true when >= and <=
View Replies !
View Related
[F8] AS : Speed Comparison Of Statements
I've heard that the "switch" statement is faster in terms of execution speed than the "if ... else" statement. If this is true, what other statements should be favored in lieu of their alternates?
For instance, which one of these would be fastest in terms of execution?:
Code:
switch(someBoolean != true) { ... };
switch(!someBoolean) { ... };
switch(someBoolean ^ true) { ... };
View Replies !
View Related
Integer Variable Comparison
I feel embarrased to post this !!
Why when the value of a is 1 (as seen with trace statement) it executes the code witin the 'IF' statement?
Code:
var a:Number = 0
if (a == 0)
{
var randNumber1:Number = Math.pow(-1, Math.floor(Math.random()*2));
var randNumber2:Number = Math.pow(-1, Math.floor(Math.random()*2));
this._y += this.randNumber1;//move it on the y axis at the set speed
this._x += this.randNumber2;//move it on the x axis at the set speed
++a;
trace(a);
}
View Replies !
View Related
[F8] Complex Comparison Tool
Hello people,
I've got a mammoth task ahead of me and I'm hoping for a little direction.
Apologies if this is in the wrong forum but it seems like heavy actionscript to me.
Basically, I've been tasked with making something very much like the application on the page below:
http://www.three.com.au/cs/ContentSe...=1155886581070
It's a mobile phone comparison tool. You select a phone at the top and it loads into the bottom panels. You can load up to 4 in and compare features side by side.
I'm going to be loading all of this in using XML. What I'm not so sure about is how do they force the viewport to scroll when you click on one of the flash expanding panels?
I have many many many more questions about how this was done but I'm hoping that people here would be able to point me in the right direction. My actionscript is good, but I know it's not this good. I'm going to be getting help but I want to be able to understand it for myself too.
Has anyone created anything like this before and if so would they be able to give me some tips?
Many thanks
Matt
View Replies !
View Related
[AS2] Variable Comparison Not Working
Here is a summary
Frame
1 Set Variables
2 The game, when you kill an enemy, Killed is incremented
3 if (_level0.Killed == _level0.toKill) {
gotoAndStop(4)
}
gotoAndPlay(2)
4 Win Screen, with stop();
Frame play order: 1 2 3 (back to 2), or if Killed==toKill 4
The variables are set correctly, but the gotoAndStop is not executed... Anything wrong?
View Replies !
View Related
|