4 Replies Latest reply on Oct 26, 2006 9:01 AM by MaxManNH

    Date datatype in a class

    MaxManNH Level 2
      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.
        • 1. Re: Date datatype in a class
          Level 7
          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."


          • 2. Re: Date datatype in a class
            Level 7
            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
            • 3. Re: Date datatype in a class
              MaxManNH Level 2
              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.

              • 4. Re: Date datatype in a class
                MaxManNH Level 2
                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.