Date.now is not a function Error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Date.now is not a function Error

Fei Yin
This is the third time I ask this strange question .

I want to load sub.swf file to main.swf file ,and run Sub class . in
Sub class, I want to get the system time now and display it . But the
player show me a strange error that say "Date.now is not a function".

Who can tell me HOW CAN I FIX THIS PROBLEM ?
----
Best regards

Yin Fei

>From Icebirds.net

--
haXe - an open source web programming language
http://haxe.org

multimoduletest.tar.gz (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Date.now is not a function Error

Nicolas Cannasse
Le 29/03/2011 13:29, 尹飞 a écrit :
> This is the third time I ask this strange question .
>
> I want to load sub.swf file to main.swf file ,and run Sub class . in
> Sub class, I want to get the system time now and display it . But the
> player show me a strange error that say "Date.now is not a function".

Try to compile your sub.swf with  -D haxe_boot
Then when it is loaded - before calling anything else - create an
instance of its haxe.Boot class.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Date.now is not a function Error

Jan_Flanders
In reply to this post by Fei Yin
On Tue, Mar 29, 2011 at 1:29 PM, 尹飞 <[hidden email]> wrote:
> This is the third time I ask this strange question .
>
> I want to load sub.swf file to main.swf file ,and run Sub class . in
> Sub class, I want to get the system time now and display it . But the
> player show me a strange error that say "Date.now is not a function".

It seems to work fine when I test your example. The textfield says:
2011-03-29 13:35:43
Which haXe version are you using?

Jan

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Date.now is not a function Error

Jan_Flanders
In reply to this post by Fei Yin
On Tue, Mar 29, 2011 at 1:29 PM, 尹飞 <[hidden email]> wrote:

> This is the third time I ask this strange question .
>
> I want to load sub.swf file to main.swf file ,and run Sub class . in
> Sub class, I want to get the system time now and display it . But the
> player show me a strange error that say "Date.now is not a function".
>
> Who can tell me HOW CAN I FIX THIS PROBLEM ?
> ----
> Best regards
>
> Yin Fei
>
> >From Icebirds.net
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

I see (from the swf in your zip) that you are still using haxe 2.06
which compiles every swf with a document class named 'flash.Boot'.
Unless you upgrade to 2.07 you need a LoaderContext with a separate
ApplicationDomain in main.swf to be able to load and run the sub.swf.

Jan

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Date.now is not a function Error

Fei Yin
But when I upgrade to haXe 2.07 , when I debugging my programs , I
want to see if the sub module is compile correct and no classes missed
when compiling , so I need to get the class list of module swf, but I
get a error when I using --gen-hx-classes :

icebird@icebird-new:~/vxpshare/haxetest$ haxe -swf-lib sub.swf
--gen-hx-classes --no-output -swf-version 10 -swf foo.swf
sub.swf@Void:1: character 0 : Type name Void is redefined from module StdTypes

This make me a big trouble for debugging sometimes .
----
Best regards

Yin Fei

>From Icebirds.net



2011/3/29 Jan Flanders <[hidden email]>:

> On Tue, Mar 29, 2011 at 1:29 PM, 尹飞 <[hidden email]> wrote:
>> This is the third time I ask this strange question .
>>
>> I want to load sub.swf file to main.swf file ,and run Sub class . in
>> Sub class, I want to get the system time now and display it . But the
>> player show me a strange error that say "Date.now is not a function".
>>
>> Who can tell me HOW CAN I FIX THIS PROBLEM ?
>> ----
>> Best regards
>>
>> Yin Fei
>>
>> >From Icebirds.net
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>
> I see (from the swf in your zip) that you are still using haxe 2.06
> which compiles every swf with a document class named 'flash.Boot'.
> Unless you upgrade to 2.07 you need a LoaderContext with a separate
> ApplicationDomain in main.swf to be able to load and run the sub.swf.
>
> Jan
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org