trace(name) will not work in my case. I am doing refactoring of project(removing xml and using toplevel objects instead). Where impact of code change is more, so i thought sharing a common function will lessen it. I can not able to pass object as refrence in said function(imapct on code change is more). I require it to get refrence of caller object at runtime. Only in debug mode will not solve my problem googled but didn't find any alternate solution.
-----Original Message----- From: Alex Harui [mailto:[email protected]] Sent: Thursday, September 05, 2013 10:19 PM To: [email protected] Subject: Re: function caller reference BTW, even if trace(name) works, I would caution that I believe it doesn't work in JS and will pose a porting problem if you ever need to port that code to JS. On 9/5/13 9:44 AM, "Alex Harui" <[email protected]> wrote: >He's trying to determine who called this shared method. The stack trace >idea isn't guaranteed to work on release players. > >And as the error suggested, it is best to pass in the caller. But just >trace(name) may also work. > >On 9/5/13 8:38 AM, "Tom Chiverton" <[email protected]> wrote: > >>Throw an error, catch it, and look in the stack trace. >> >>What are you trying to achieve that can't be done, as the message >>suggests, by some other means ? >> >>Tom >> >>On 05/09/2013 16:04, Raj U. Shaikh wrote: >>> Hi, >>> I wanted to access caller of function, >>> >>> For example: >>> var object:Object = new Object(); >>> >>>object["name"] = "First Object"; >>> >>>object["fun"] = myFun; >>> >>>object.fun(); >>> >>> var object2:Object = new Object(); >>> >>>object2["name"] = "Second Object"; >>> >>>object2["fun"] = myFun; >>> >>>object2.fun(); >>> >>> Where, >>> >>> public function myFun():void{ >>> >>>trace("Function caller: " + arguments.caller["name"]); >>> } >>> >>> So, Player should have traced >>> >>> Function caller: First Object >>> Function caller: Second Object >>> >>> But, Its failed and getting following warning. >>> 1058: Migration issue: The property caller is no longer supported. Try >>>declaring caller as an argument of the function instead.. >>> >>> Is there any alternate option available? >>> >>> Thanks & Regards, >>> Raj Shaikh >>> Senior Software Engineer >>> >>> Majesco Mastek - P&C Division >>> Mastek Millennium Center, A-7, Millennium Business Park, Sector 1 Off >>>Thane Belapur Road, Mahape Navi Mumbai - 400701 >>> (T) 91 22 27781272 Extn - 5250 | Mobile: 9970395965 | Fax: 91 22 >>>27781332 | www.mastek.com<http://www.mastek.com/> >>> >>> Impossible are done straight away...Miracles take a little bit time. >>> >>> MASTEK LTD. >>> In the US, we're called MAJESCOMASTEK >>> >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>~ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> Opinions expressed in this e-mail are those of the individual and not >>>that of Mastek Limited, unless specifically indicated to that effect. >>>Mastek Limited does not accept any responsibility or liability for it. >>>This e-mail and attachments (if any) transmitted with it are >>>confidential and/or privileged and solely for the use of the intended >>>person or entity to which it is addressed. Any review, re-transmission, >>>dissemination or other use of or taking of any action in reliance upon >>>this information by persons or entities other than the intended >>>recipient is prohibited. This e-mail and its attachments have been >>>scanned for the presence of computer viruses. It is the responsibility >>>of the recipient to run the virus check on e-mails and attachments >>>before opening them. If you have received this e-mail in error, kindly >>>delete this e-mail from desktop and server. >>> >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>~ >>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>> ______________________________________________________________________ >>> This email has been scanned by the Symantec Email Security.cloud >>>service. >>> For more information please visit http://www.symanteccloud.com >>> ______________________________________________________________________ >> > MASTEK LTD. In the US, we're called MAJESCOMASTEK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
