Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-19-2007, 07:54 PM   #1
rockitgood
Registered User
 
Join Date: Sep 2007
Posts: 50
Default 1016: Base class is final.

How come I can't extend the Date class?

Code:
package com.utils
{
	public class DateFormat extends Date
	{
		private static var _months:Array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
		private static var _appendToNum:Array = ["st", "nd", "rd", "th"];
		public function DateFormat()
		{
			super();
		}
	}
}
i just get this error

1016: Base class is final.

Also, is AS 2.0 I would have to use super(); and pass all the original arguments into the object. How does this work in AS 3.0?
rockitgood is offline   Reply With Quote
Old 09-19-2007, 08:01 PM   #2
TruePatriot
Registered User
 
Join Date: Sep 2007
Posts: 17
Default

The date class uses the final attribute:

public final dynamic class Date

The final statement specifies that a method cannot be overridden or that a class cannot be extended.

You use the super() function the same way as in AS2.
TruePatriot is offline   Reply With Quote
Old 09-19-2007, 08:03 PM   #3
rockitgood
Registered User
 
Join Date: Sep 2007
Posts: 50
Default ..

oh man. So I guess the only way is for it to be a container class.. owell
rockitgood is offline   Reply With Quote
Old 09-19-2007, 08:06 PM   #4
TruePatriot
Registered User
 
Join Date: Sep 2007
Posts: 17
Default

Quote:
Originally Posted by rockitgood View Post
oh man. So I guess the only way is for it to be a container class.. owell
Just use a static function that takes a date and returns a string. I don't understand why you'd want to copy those arrays into every date variable.
TruePatriot is offline   Reply With Quote
Old 09-19-2007, 08:09 PM   #5
rockitgood
Registered User
 
Join Date: Sep 2007
Posts: 50
Default ..

all i was trying to do was format the date into something like

July 1st, 2007

In the book i bought "ActionScript 3.0 Cookbook" they talk about a DateFormat class but it doesn't seem to exist...
rockitgood is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Remoting with Perl dopefries Flash Remoting 3 02-17-2007 01:42 PM
AS3 F9 - How to have main class path without carring around instance refer? FLXERmaster ActionScript 3.0 3 01-07-2007 11:17 PM
Reusable class ... ? xxlm ActionScript 2.0 3 01-18-2006 03:29 AM
How can I implement a two-way relationship between classes in AS 2.0? MHH ActionScript 2.0 5 10-13-2004 04:35 PM


All times are GMT. The time now is 07:37 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.