[Flashcoders] Class Error Message

2006-01-16 Thread Chris Kennon

Hi All,

In the following code my attempt at formatting the date returns this  
to the output window:

//
**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
55: This statement is not permitted in a class definition.

now = new Date();

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
56: This statement is not permitted in a class definition.

trace (The Time is  + formatTime(now));

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
61: ActionScript 2.0 class scripts may only define class or interface  
constructs.

 }

Total ActionScript Errors: 3 Reported Errors: 3
//
/**
A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
private var width:Number;
private var height:Number;
private var stageHeight:Number = 300;
private var stageWidth:Number = 300;
private var theDate:String;
private var now:Date;
private static var textFieldDepth:Number = 0;
private var messageFormat:TextFormat;
public var messageDisplay:Function = displayGreeting;
public var message:String = ;

// Movie clip that will contain visual
// elements of the hello.
private var container_mc:MovieClip;
//
public function Hello(target:MovieClip) {
container_mc = target.createEmptyMovieClip(blah, 1);
placeGreeting();
}
private function placeGreeting() {
messageFormat = new TextFormat();
messageFormat.font = Verdana;
messageFormat.color = 0xff;
messageFormat.bold = true;
		container_mc.createTextField(messageText, textFieldDepth, 75,  
100, 150, 25);

container_mc.messageText.text = messageDisplay();
container_mc.messageText.border = false;
container_mc.messageText.setTextFormat(messageFormat);
}
	//for testing only will use am/pm passed from formatTime() to output  
message

private function displayGreeting() {
if (now == afternoon) {
message = Disco Rules;
} else {
message = Samba Rules;
}
return message;
}
private function formatTime(theDate){
var hour=theDate.getHours();
		var minute=theDate.getMinutes()9 ? theDate.getMinutes() : 0 +  
theDate.getMinutes();

if (hour  12){
var timeString = (hour-12) + : + minute + PM;
}else{
var timeString = hour + : + minute + AM;
}
return timeString;
}
now = new Date();
trace (The Time is  + formatTime(now));



}
}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Class Error Message

2006-01-16 Thread Howard Nager
When are you looking for this to happen:

   now = new Date();
   trace (The Time is  + formatTime(now));

If you want that to happen when you create a new instance of the class then 
slap it in the constructor.

Also - you have an extra '}' in there at the end.


-Original Message-
From: [EMAIL PROTECTED] on behalf of Chris Kennon
Sent: Mon 1/16/2006 6:11 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Class Error Message
 
Hi All,

In the following code my attempt at formatting the date returns this  
to the output window:
//
**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
55: This statement is not permitted in a class definition.
now = new Date();

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
56: This statement is not permitted in a class definition.
trace (The Time is  + formatTime(now));

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
61: ActionScript 2.0 class scripts may only define class or interface  
constructs.
  }

Total ActionScript Errors: 3 Reported Errors: 3
//
/**
A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
private var width:Number;
private var height:Number;
private var stageHeight:Number = 300;
private var stageWidth:Number = 300;
private var theDate:String;
private var now:Date;
private static var textFieldDepth:Number = 0;
private var messageFormat:TextFormat;
public var messageDisplay:Function = displayGreeting;
public var message:String = ;

// Movie clip that will contain visual
// elements of the hello.
private var container_mc:MovieClip;
//
public function Hello(target:MovieClip) {
container_mc = target.createEmptyMovieClip(blah, 1);
placeGreeting();
}
private function placeGreeting() {
messageFormat = new TextFormat();
messageFormat.font = Verdana;
messageFormat.color = 0xff;
messageFormat.bold = true;
container_mc.createTextField(messageText, textFieldDepth, 75, 
 
100, 150, 25);
container_mc.messageText.text = messageDisplay();
container_mc.messageText.border = false;
container_mc.messageText.setTextFormat(messageFormat);
}
//for testing only will use am/pm passed from formatTime() to output  
message
private function displayGreeting() {
if (now == afternoon) {
message = Disco Rules;
} else {
message = Samba Rules;
}
return message;
}
private function formatTime(theDate){
var hour=theDate.getHours();
var minute=theDate.getMinutes()9 ? theDate.getMinutes() : 0 
+  
theDate.getMinutes();
if (hour  12){
var timeString = (hour-12) + : + minute + PM;
}else{
var timeString = hour + : + minute + AM;
}
return timeString;
}
now = new Date();
trace (The Time is  + formatTime(now));



}
}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Class Error Message

2006-01-16 Thread Andy Johnston

A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
   private var width:Number;
   private var height:Number;
   private var stageHeight:Number = 300;
   private var stageWidth:Number = 300;
   private var theDate:String;
   private var now:Date;
   private static var textFieldDepth:Number = 0;
   private var messageFormat:TextFormat;
   public var messageDisplay:Function = displayGreeting;
   public var message:String = ;

   // Movie clip that will contain visual
   // elements of the hello.
   private var container_mc:MovieClip;
   //
   public function Hello(target:MovieClip) {
   container_mc = target.createEmptyMovieClip(blah, 1);
   now = new Date();
   var timeNow =  formatTime(now)
   placeGreeting(timeNow);
   }
   private function placeGreeting(time) {
   messageFormat = new TextFormat();
   messageFormat.font = Verdana;
   messageFormat.color = 0xff;
   messageFormat.bold = true;
   container_mc.createTextField(messageText, textFieldDepth, 75,  
100, 150, 25);

   container_mc.messageText.text = time;
   container_mc.messageText.border = false;
   container_mc.messageText.setTextFormat(messageFormat);
   }
   private function formatTime(theDate){
   var hour=theDate.getHours();
   var minute=theDate.getMinutes()9 ? theDate.getMinutes() : 0 
+  theDate.getMinutes();

   if (hour  12){
   var timeString = (hour-12) + : + minute + PM;
   }else{
   var timeString = hour + : + minute + AM;
   }
   return timeString;
   } 
  
   }

}


Hi All,

In the following code my attempt at formatting the date returns this  
to the output window:

//
**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
55: This statement is not permitted in a class definition.

 now = new Date();

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
56: This statement is not permitted in a class definition.

 trace (The Time is  + formatTime(now));

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
61: ActionScript 2.0 class scripts may only define class or interface  
constructs.

 }

Total ActionScript Errors: 3  Reported Errors: 3
//
/**
A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
private var width:Number;
private var height:Number;
private var stageHeight:Number = 300;
private var stageWidth:Number = 300;
private var theDate:String;
private var now:Date;
private static var textFieldDepth:Number = 0;
private var messageFormat:TextFormat;
public var messageDisplay:Function = displayGreeting;
public var message:String = ;

// Movie clip that will contain visual
// elements of the hello.
private var container_mc:MovieClip;
//
public function Hello(target:MovieClip) {
container_mc = target.createEmptyMovieClip(blah, 1);
placeGreeting();
}
private function placeGreeting() {
messageFormat = new TextFormat();
messageFormat.font = Verdana;
messageFormat.color = 0xff;
messageFormat.bold = true;
container_mc.createTextField(messageText, textFieldDepth, 
75,  100, 150, 25);

container_mc.messageText.text = messageDisplay();
container_mc.messageText.border = false;
container_mc.messageText.setTextFormat(messageFormat);
}
//for testing only will use am/pm passed from formatTime() to 
output  message

private function displayGreeting() {
if (now == afternoon) {
message = Disco Rules;
} else {
message = Samba Rules;
}
return message;
}
private function formatTime(theDate){
var hour=theDate.getHours();
var minute=theDate.getMinutes()9 ? theDate.getMinutes() : 0 
+  theDate.getMinutes();

if (hour  12){
var timeString = (hour-12) + : + minute + PM;
}else{
var timeString = hour + : + minute + AM;
}
return timeString;
}
now = new Date();
trace (The Time is  + formatTime(now));

   
   
}

}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Class Error Message

2006-01-16 Thread PR Durand

Hi Chris

At the end of your code you have this now = new Date(); outside any method
so flash doesn't know what to make with.
Those 2 lines
   now = new Date();
   trace (The Time is  + formatTime(now));
seem to be here to test your formatTime method, but it has to be in 
flash, not in the class, if you keep this format.

Or you can also integrate it to your constructor:
   public function Hello(target:MovieClip) {
   container_mc = target.createEmptyMovieClip(blah, 1);
   placeGreeting();
   var now:Date = new Date();
   trace (The Time is  + this.formatTime(now));
   }

Regards,

PR




Chris Kennon a écrit :


Hi All,

In the following code my attempt at formatting the date returns this  
to the output window:

//
**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
55: This statement is not permitted in a class definition.

 now = new Date();

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
56: This statement is not permitted in a class definition.

 trace (The Time is  + formatTime(now));

**Error**  
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as: Line  
61: ActionScript 2.0 class scripts may only define class or interface  
constructs.

 }

Total ActionScript Errors: 3  Reported Errors: 3
//
/**
A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
private var width:Number;
private var height:Number;
private var stageHeight:Number = 300;
private var stageWidth:Number = 300;
private var theDate:String;
private var now:Date;
private static var textFieldDepth:Number = 0;
private var messageFormat:TextFormat;
public var messageDisplay:Function = displayGreeting;
public var message:String = ;

// Movie clip that will contain visual
// elements of the hello.
private var container_mc:MovieClip;
//
public function Hello(target:MovieClip) {
container_mc = target.createEmptyMovieClip(blah, 1);
placeGreeting();
}
private function placeGreeting() {
messageFormat = new TextFormat();
messageFormat.font = Verdana;
messageFormat.color = 0xff;
messageFormat.bold = true;
container_mc.createTextField(messageText, textFieldDepth, 
75,  100, 150, 25);

container_mc.messageText.text = messageDisplay();
container_mc.messageText.border = false;
container_mc.messageText.setTextFormat(messageFormat);
}
//for testing only will use am/pm passed from formatTime() to 
output  message

private function displayGreeting() {
if (now == afternoon) {
message = Disco Rules;
} else {
message = Samba Rules;
}
return message;
}
private function formatTime(theDate){
var hour=theDate.getHours();
var minute=theDate.getMinutes()9 ? theDate.getMinutes() : 0 
+  theDate.getMinutes();

if (hour  12){
var timeString = (hour-12) + : + minute + PM;
}else{
var timeString = hour + : + minute + AM;
}
return timeString;
}
now = new Date();
trace (The Time is  + formatTime(now));

   
   
}

}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Class Error Message

2006-01-16 Thread Chris Kennon

Hi All,

Thanks, as most savvy programmers have figured this is a training  
exercise, an I'm learning quite a bit.




Respectfully,


Christopher Kennon
Principal  Creative Director -Bushidodeep
www.bushidodeep.com

__
Knowing is not enough, you must apply;
   willing is not enough, you must do.
 ---Bruce Lee


On Jan 16, 2006, at 3:32 PM, PR Durand wrote:


Hi Chris

At the end of your code you have this now = new Date(); outside any  
method

so flash doesn't know what to make with.
Those 2 lines
   now = new Date();
   trace (The Time is  + formatTime(now));
seem to be here to test your formatTime method, but it has to be in  
flash, not in the class, if you keep this format.

Or you can also integrate it to your constructor:
   public function Hello(target:MovieClip) {
   container_mc = target.createEmptyMovieClip(blah, 1);
   placeGreeting();
   var now:Date = new Date();
   trace (The Time is  + this.formatTime(now));
   }

Regards,

PR




Chris Kennon a écrit :


Hi All,

In the following code my attempt at formatting the date returns  
this  to the output window:

//
**Error**   
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as:  
Line  55: This statement is not permitted in a class definition.

 now = new Date();

**Error**   
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as:  
Line  56: This statement is not permitted in a class definition.

 trace (The Time is  + formatTime(now));

**Error**   
BushidoDeep:Users:chris:Desktop:hello:com:bushidodeep:Hello.as:  
Line  61: ActionScript 2.0 class scripts may only define class or  
interface  constructs.

 }

Total ActionScript Errors: 3  Reported Errors: 3
//
/**
A Simple hello class
that assigns a custom
message to a text field
based upon time of day.
**/
class com.bushidodeep.Hello {
private var width:Number;
private var height:Number;
private var stageHeight:Number = 300;
private var stageWidth:Number = 300;
private var theDate:String;
private var now:Date;
private static var textFieldDepth:Number = 0;
private var messageFormat:TextFormat;
public var messageDisplay:Function = displayGreeting;
public var message:String = ;

// Movie clip that will contain visual
// elements of the hello.
private var container_mc:MovieClip;
//
public function Hello(target:MovieClip) {
container_mc = target.createEmptyMovieClip(blah, 1);
placeGreeting();
}
private function placeGreeting() {
messageFormat = new TextFormat();
messageFormat.font = Verdana;
messageFormat.color = 0xff;
messageFormat.bold = true;
container_mc.createTextField(messageText,  
textFieldDepth, 75,  100, 150, 25);

container_mc.messageText.text = messageDisplay();
container_mc.messageText.border = false;
container_mc.messageText.setTextFormat(messageFormat);
}
//for testing only will use am/pm passed from formatTime() to  
output  message

private function displayGreeting() {
if (now == afternoon) {
message = Disco Rules;
} else {
message = Samba Rules;
}
return message;
}
private function formatTime(theDate){
var hour=theDate.getHours();
var minute=theDate.getMinutes()9 ? theDate.getMinutes() :  
0 +  theDate.getMinutes();

if (hour  12){
var timeString = (hour-12) + : + minute + PM;
}else{
var timeString = hour + : + minute + AM;
}
return timeString;
}
now = new Date();
trace (The Time is  + formatTime(now));

  }
}




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders