Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8417521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:04:17+00:00 2026-06-10T02:04:17+00:00

In ActionScript, I’ve discovered, casting a Date to a Date and assigning it to

  • 0

In ActionScript, I’ve discovered, casting a Date to a Date and assigning it to a Date-typed variable throws a TypeError:

var date : Date = Date(new Date(2012, 01, 01));

Error #1034: Type Coercion failed: cannot convert "Wed Aug 22 17:06:54 GMT+1000 2012" to Date.

This is obviously wrong, but I’d like to know why it happens. My theory is that the Date cast, like the Number cast, has been overridden to attempt to convert the given type rather than just cast it.

Interestingly, casting anything else to a Date and assigning it to a Date also fails:

var date : Date = Date("1/2/3");
var date : Date = Date(123);

// (Both fail)

But assigning it to an Object succeeds:

var object : Object = Date(new Date(2012, 01, 01));
var object : Object = Date("1/2/3");
var object : Object = Date(123);

// (All succeed)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:04:19+00:00Added an answer on June 10, 2026 at 2:04 am

    AS3 can be very confusing and inconsistent at times.
    Basically you’re not casting anything in that code sample.

    AS3 has some global camelCased functions that will take precedence over casting operators.
    Vector also has a similar global function.

    When you do Date(bla) without the new operator, it apparently creates a string representation of that date… Try to cast with the as operator instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Actionscript... If I Have an XML variable that equals this: var X:XML=XML(<mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml
Flash ActionScript myData = new LoadVars(); myData.onLoad = function() { myText_txt.text = this.myVariable; };
In Actionscript you can have global variables like this: var number : Number =
ActionScript 3 - CS5 I'm new to Flash and wondering how to change fill
I'm new to ActionScript 3.0 and I am trying to work my way around
Im very new to actionscript 3 and I just cant seem to convert my
I am using Actionscript 2.0 In a Brand new Scene. My only bit of
I'm new to actionscript flash 3.0. Anyways, i have written code for one whole
I have a simple actionscript function var string:String = TEXT REMOVED; var myArray:Array =
In Actionscript you can have a variable hold a reference to a class type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.