Flash :: Comparing Date Objects In As2
Jan 5, 2010[Code]...
Obviously the two date objects are somehow subtly different, and that difference somehow gets overlooked when they're parsed out as strings, but how are they different?
[Code]...
Obviously the two date objects are somehow subtly different, and that difference somehow gets overlooked when they're parsed out as strings, but how are they different?
Do you know any way to compare a date to a range of date using the Date class in as2.
For example i want to know a given day (11-12-2009) is among the start and end date of a given range (11-01-2009 to 11-20-2009).
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?
I have a 2 different date formats. 1) dd/mm/yyyy 2) dd-mm-yyyy
I want to compare these 2 date formats in Javascript or Actionscript.
I'd like to know how to compare one array to another array with objects.
For example:
Array1 = [one, blue, car];
// there will always be only one entry in this array - no Array1[1], no Array1[2], etc.
Array2 = [product.number, product.color, product.type, product.cost, product.qty];
The actual content in Array2 would be something like this:
Array2[0] = [three, green, boat, 100, 5];
Array2[1] = [two, blue, truck, 200, 3];
Array2[2] = [one, red, car, 50, 20];
...and so on, up to about 60.
I'm trying to figure out to go through all of Array2 to determine if there's a match to Array1. Since none of the entries in Array2 are the same, there will always be one match.In this instance, I want to match array1 with product.number, product.color, and product.type. My example has them as the first 3 criteria, though that may not always be the case.
Something along the lines of this:
Code:
function findMatch () {
for(i = 0; i < Array2.length; i++) {
if(all 3 Array1 items equals items in Array2[i]) {
[code]...
Background: I've a combobox search that allows a user to select from drop-downs. After a user selects items from all 3 drop-downs, they click a submit button, and there's a check to see if the criteria in the drop-downs matches anything in the Array2 (which it should, if you can select it, then it's in the array).
After that, the matched information is used to populate a movieclip. There's actually about 20 pieces of information associated with each product. However, I only need to match 3 of them.I've searched and found comparisons for arrays. But I don't see how they'd apply to my issue as I'm using objects and there are more items in array2 than in array1. Of course, they may apply, and I'm just not understanding how. I could create a 3rd array and move only the items needed for a match from the array2 to it. Then I could do a straight comparison between array1 and array3.
So I am trying to populate a user state from XML in such a way that a new user will start with a set of default variables.
An example default state might be:
Code:
state={obj2:{foo:"bar"}};
This would then be changeable by the user so his foo could later be "bar2" and that would be saved to a database.
Now, let's say I want to add a new node to the xml, so the default would be:
Code:
default ={obj2:{foo:"bar", foo2:{foo:"bar"}}};
An earlier user would have no foo2, so an attempt to use state.obj2.foo2.foo on a text field would generate an error.
What I'd like to be able to do is see if state has a value and if not, fill the user's data with the matching node in the default (in pseudocode):
Code:
if (some function (state.obj2.foo2.foo ) is not there) {
// fill with default
state.obj2.foo2=default.obj2.foo2
}
I have some objects that are very, very likely to be equal. I'm comparing them every second to check if they're the same as one stored in a data model on the client.Instead of having to check 5-6 data points to make sure they're equal, I would like to compare the binary to tell if they're not equal, so I can quickly overwrite the object in the collection if they do not have an identical binary representation.for example, I have the following objects:
ActionScript Code:
class tag{
var xCoord;
[code]....
So, instead of doing this sort of comparison for every member in the class
ActionScript Code:
if ( tagOne.xCoord != tagTwo.xCoord ){
swapTagsInCollection (tagOne, tagTwo);
}
I would like to do something like this.
ActionScript Code:
if ( tagOneBinary != tagTwoBinary ){
swapTagsInCollection (tagOne, tagTwo);
}
I created a script that will rotate a different ad every day, based on a comparison of the current date & the ads assigned day. The bug in the script is that the number of ads vs the number of days may be odd, so the last one or two ads will miss a (days) rotation every month. Is there a way I can get this to work so every ad hits its rotation.
var displayAdOne:Array=new Array;
var displayAdTwo:Array=new Array;
var displayAdThree:Array=new Array;
[code].....
I have a multidimensional array where the items have Date objects. I 've tried to use Array.sortOn(myDate) with no success. Do I have to convert the Date to a string (like 20070731) to use sortOn correctly?
View 1 RepliesI have to validate that 1) the end Date is not less than the start Date and 2) the difference between the two UTC Dates is not more than 12 months. To do this, I need a monthDifference function:
public static function monthDifference(start:Date, end:Date):int;
Since partial months can be confusing, this is how month differences are supposed to work:
The month difference between January 1, 2010 and January 31, 2010 is zero (0).
The month difference between January 31, 2010 and February 1, 2010 is one (1).
The month difference between January 1, 2010 and February 28, 2010 is one (1).
The month difference between January 1, 2010 and March 1, 2010 is two (2).
How can I calculate month difference in ActionScript 3.0?
I am trying to compile some example actionscript code. In Flex (Flash Builder 4.6) I imported a project folder (happens to be the PurePDF examples). In a few places, I have yellow "?" icons when looking at the source files - though there are no warnings or errors showing up for them yet (I do have other errors I am addressing). This is an example - when I hover the "?" icon, I see access of undefined property getTime:
[Code]....
I cleaned up the errors I mentioned, and these yellow "?" marks still appear when viewing the code. There are no warnings or errors in the 'problems' window, but these question marks I describe are still there. Even if I close the file and clean the project and re-open the file.
I'm using flash CS4 and actionscript 2.0. I have a situation where I need to locate and check the date of an external file (either .exe or .swf) and return that date string to a variable in flash. I then need to display that date to a piece of dynamic text within the flash file. Is there a function within action script that will check and retrieve the file date of an external file.
View 4 RepliesDo you know any way to compare a date to a range of date using the Date class in as2.
For example i want to know a given day (11-12-2009) is among the start and end date of a given range (11-01-2009 to 11-20-2009).
I am working on an application that is near the end of its development cycle and has mostly passed user testing. We recently realized that having flex convert dates to the client's local timezone is not desired, as all of our dates are in EST and contain no time data. Since BlazeDS sends dates in UTC, this results in the dates being converted to the day before in timezones west of EST.
The best solution is to go in and refactor all dates to adjust for the timezone offset, but that is just not doable at this stage. Since all dates in our application don't care about time, I would really like to be able to intercept all Date objects that come across BlazeDS and adjust for the timezone offset.
Is there a way of exporting an FLA file to a human-readable format, so that different revisions of a file can be compared?
I found a script for exporting to XML here (post 6):[URL] -- but it doesn't work as advertised - e.g. it doesn't export any details of items in the library.
I've got an xml file that contains some data (which will be created by an external file later on in the project) and i want to be able to check the data in that XML file against a variable stored in flash.
If the value in the XML is equal to or greater than the value in the variable i want to jump to a different frame. If the xml value is less that the variable value i want it to stop and tell the user a message. i've included my code below. I just cant get it to work. Regardless of if the value in the XML file is higer or lower than the variable in flash, it always continues to the final frame instead of stopping accordingly.
ActionScript
Code:
//Load xml file that contains amount of cash user has and populate cash_txt box with amount
function loadXML(loaded) {
[Code]....
I'd like to know if there's anyway I can compare two BitmapData and get a "similarity percentage" (knowing how look-alike they are). I've done a bit of research and came across bitmapData.compare(otherBmd), but that only returns if they differ in size, or pixel, and not how much they differ. The point of this was to compare some Bmd obtained through a camera with a library image (so this is what I got so far):
import flash.display.Bitmap;
import flash.display.BitmapData;
var img1:BitmapData = new monaLisa();
var cam:Camera = Camera.getCamera();
var video:Video = new Video(camMock.width,camMock.height);
video.attachCamera(cam);
[Code] .....
So I know that PV3d looks quite dead. But it is documented over the internet much better. So I decided to develope my product using old but good PV3d engine. Time goes on so I plan to port it sooner or later to Away3d. So I need a list of things that aere not in Away3d that I have in PV3d. And a list of generall use diffrencies (use of cameras, viewports, etc). So where to get comparing list of papervision3d vs Away3d?
View 1 RepliesIm using flash 8, I always used to import graphics rather than to work with original drawing tools of flash, im studding those tools and I have some questions. is there a way to do mathematic in the parameter like I can do in illustrator (I tried but nothing)?is there any way to repeat and duplicate the last transform? Comparing to illustrator?is there a way I can align the transformation point to other object?is there a way to align points?I can subtract, union...but how to get overlapped shapes?
View 1 RepliesI got some text that has a background, and the backgroud color can change to any color.
So, I need to find a way to figure if my text will be readable or not, the text should change to black (for example, yellow background) or white ( dark blue background ) if the contrast is not good enough.
So, is there a method to do this?, what would you use to make this work?
I have a XML file with a few concert dates. In my flash/AS3 file, I would like to show only the up coming event, relative to current date. Like this:
Event 01: 30-05-2010
Event 02: 02-06-2010
Event 03: 05-06-2010
Today is 28-05-2010, so I need to list Event 01. On 01-06-2010 I need to list Event 02. I have the basic AS3 code for listing the XML working, but I'm having trouble filtering the result.
I'm trying build a simple band site using flash and as2. All I want to have is a page listing shows that sorts them according to date and also when the show date has passed drops that entry from view.I can do this easily enough with a database and php but want to learn how to do it in actionscript. Here is what I currently have, shows load from the xml file into a simple textbox:
Code:
scrollBar.target = shows_txt;
showsXML = new XML();
[code]....
I am instantiating a new Date object using the below values.
var thisDate:Date = new Date(2011, 12, 2, 9, 30); But when I did a trace, I got
Mon Jan 2 09:30:00 GMT+0800 2012.Why is the date wrong?
my date of string like (2009-12-03 21:05:00) date with time . so i used to store var newdate:Date=new Date(Date.parse(startdate)); but shows some errors.and also i tried to split string(date) used date function likevar datenumber:Number= (new Date(Date.parse(startdate))).getDate();
View 1 RepliesDoes anyone know how to get actionscript to render a null date value '000:00:00T00:00:00'? I am calling a web service that expects date fields in the SOAP xml. I need some of these dates to serialize as null and I can't see how to produce null. The closest value I can get is '1899-11-30T00:00:00Z'. Below is the code I am using:
[Code]...
I want to integrate a date picker component using action script for date of birth.
View 2 RepliesI want to convert Date(ActionScript 3) to java.util.Date through a xml. First, write a user defined ActionScript class like this.
[Code]...
Finally, In server side of Java, I want to convert this xml to Java class like this for using JAXB Unmarshaller.
[Code]...
Writing in AS3. I cannot write, t:Date = u.data.time; u.data.time is "Mon Oct 31 00:00:00 GMT-0500 2005",because this cannot convert to Date.
View 1 RepliesI'm trying to determine the difference in time between todays date and a future date. I only need to determine how many months and days it is between todays date and this future date. Anyone know of any prebaked scripts anywhere for determining what todays date is and subtracting it from the end date would be? [code]So if today's date is less then the end date I'd like to determine how many months and days are left until the end date is reached and display the number of months and days until that end date.
View 1 RepliesI'm trying to get a random date in a date range and this is what i have so far but it doesnt seem to be working ? Where I'm I Going wrong ?Gets the date difference
private function differenceBetweenDates(date1:Date, date2:Date):Number{
var MS_PER_DAY:uint = 1000 * 60 * 60 * 24;[code]..........