Tuesday, July 21, 2009

similarity in javascript and actionscript in time functions

dealing with actionscripting and javascipting recently, need to port a time related javascript to actionscript. the Date class and setTimeOut are almost the same but have some differences, i listed them here
1) javascript Date.parse format is "date mon year hr:min:sec GMT" example: 21 Aug 2009 10:10:10 GMT. but actionscript Date.parse format is "mon date hr:min:sec year" example Aug 21
2) javascript setTimeout syntax is setTimeout("func(param1, param2)", timeout), actionscript is setTimeout(Functor, timeout, param1, param2)

in this project i also learnt how to exchange data between javascript and actionscript.
javascript->actionscript could use tag or swfobject flashvars
acriptscript->javascript could use ExternalInterface.call("func", param1, param2,paramn)

I have also learn how to use swfobject to insert swf into a div, it is by using the div id in the swfobject.embed second parameter

No comments: