Skip to main content
Inspiring
October 26, 2006
Question

Date datatype in a class

  • October 26, 2006
  • 3 replies
  • 260 views
Hi all,

I have created a class where I have initialized a Date object and I am trying to get the current Day Month and Year for some
data checking purposes. The only problem is that they get() methods of the date object all return undefined. Can you not
use a Date object in an actionscript .AS file for some reason? Also my class extends ASBroadcaster.
This topic has been closed for replies.

3 replies

MaxManNHAuthor
Inspiring
October 26, 2006
Ok I got it. If you notice that Get Date property function I have in there. Yeah
it didn't like that at all. Once I renamed it everything else cleared up. Thanks
for the help. The stub class helped big time.

Good luck.
Inspiring
October 26, 2006
MaxManNH wrote:
> Hi all,
>
> I have created a class where I have initialized a Date object and I am trying
> to get the current Day Month and Year for some
> data checking purposes. The only problem is that they get() methods of the
> date object all return undefined. Can you not
> use a Date object in an actionscript .AS file for some reason? Also my class
> extends ASBroadcaster.
>

Here's a working class maybe you can compare what you're doing to what
is here.

class Foo
{
private var _date:Date;
public function get Month ():Number
{
return _date.getMonth ();
}
public function Foo ()
{
_date = new Date ();
}
}

// usage
var foo:Foo = new Foo ();
trace( foo.Month );


-- James


--
James O'Reilly — Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train
Inspiring
October 26, 2006
MaxManNH,

> Can you not use a Date object in an actionscript .AS file
> for some reason?

You can use *any* AS datatype in an AS class file.

> Also my class extends ASBroadcaster.

I've never tried to do that, since ASBroadcaster is a mixin class. Any
reason why you're extending it?


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."


MaxManNHAuthor
Inspiring
October 26, 2006
I want the class to fire an event to a listener on my main timeline. The listener executes some code
to parse together a couple of strings, then uses remoting to send the string to a database.

Here is my class code.