Comments on: Operators overloading in AS3 (JavaScript too) – Workaround https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/ 👨🏻‍💻 iOS tinkerer Wed, 11 Mar 2026 10:46:25 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: Filip Zawada https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/#comment-75 Fri, 18 Jan 2013 07:16:23 +0000 http://filimanjaro.com/?p=79#comment-75 Hi Wormss,
It depends what you want to achieve. Once on a stackoverflow I’ve suggested a solution to cast quickly a color object using 0+ statement:

var someColor:uint = 0+new Color(…);

I fixed issue with polish captcha and fixed autoresponder – thanks for noticing.

One more interesting thing about JavaScript, you can get current timestamp there in such a way: (+new Date()) instead of new Date().getTime()

]]>
By: WORMSS https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/#comment-72 Wed, 03 Oct 2012 11:57:17 +0000 http://filimanjaro.com/?p=79#comment-72 why write in english and then use a polish as a test to allow comments? Idiotic..

I just wanted to say it was too bad I can’t use valueOf so I can do

__n = new Object(value, value2, value3);
ended up using
__n = new Object(value, value2, value3).value; Shame..

]]>
By: thienhaflash https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/#comment-71 Mon, 27 Aug 2012 16:07:12 +0000 http://filimanjaro.com/?p=79#comment-71 Very good finding and an interesting post read for a very long time.

Thanks for sharing !

p/s : I don’t know Polish, please try to change the language for the comment box !

]]>
By: Filip Zawada https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/#comment-70 Thu, 16 Aug 2012 13:15:47 +0000 http://filimanjaro.com/?p=79#comment-70 Indeed, comparison operators aren’t cast while being compared (what makes sense). The only exception I know is when comparing object to string, e.g.: anyInstance == “str”. In such a case you just need to override toString() method.

]]>
By: Ash https://filimanjaro.com/blog/2012/operators-overloading-in-as3-javascript-too-%e2%80%93-workaround/#comment-60 Sat, 28 Apr 2012 07:08:13 +0000 http://filimanjaro.com/?p=79#comment-60 Thank you for the cool info!
The valueOf() function works perfect with arithmetic operators. What about comparison operators? I compare two instances with “==”-operator. Redefined valueOf() function returns identical info, but trace gives me “false”. Could you help me please?

Thanks!

]]>