Title: Displaying the current date in an easy to read format
Cheers Matt, that put me right... :)
 
 function initDates()
 { 
  var ddDate:Date;
  var dayNames:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
  var monthNames:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  ddDate = new Date();
  showDate.text = "Date: " + dayNames[ddDate.getDay()] + ", " + ddDate.getDate() + " " + monthNames[ddDate.getMonth()] + " " + ddDate.getFullYear();
 }
 
I didn't use the DateFormatter but I will bear in mind its existance.
 
Ta,
 
T
-----Original Message-----
From: Matt Chotin [mailto:[EMAIL PROTECTED]
Sent: 23 March 2005 16:19
To: [email protected]
Subject: RE: [flexcoders] Displaying the current date in an easy to read format

You need to put your assignments in a function, you cannot just run code on its own like that.

 

<mx:Script>

Var ddDate : Date;

Var date : Date;

 

Function initDates()

{

  ddDate = new Date();
  date = "Date: " + ddDate.getDay() + ", " + ddDate.getDate() + " " + ddDate.getMonth() + " " + ddDate.getFullYear() + "";

 

}

</mx:Script>

 

Then have the initialize event handler call initDates()

 

Matt

 


From: Anthony Merryfield [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 23, 2005 7:35 AM
To: [email protected]
Subject: [flexcoders] Displaying the current date in an easy to read format

 

Hi everyone,

I need to display the current date on screen in an easy to read format but get this error each time I try:

A class's instance variables may only be initialized to compile-time constant expressions.

A snippet of my code is below, it is in a component:

<?xml version="1.0" encoding="utf-8"?>

<mx:Box xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:vo="uk.co.isesolutions.apps.commerce.modules.fulfilment.flex.vo.*" xmlns:debug="uk.co.isesolutions.framework.flex.debug.*" xmlns:viewHelper="uk.co.isesolutions.apps.commerce.modules.fulfilment.flex.viewHelper.*" childrenCreated="initComponent()" hide="validateBDVS()" width="100%">

        <viewHelper:DirectDebitViewHelper id="directDebitVH" name="directDebitView" view="{ this }" />

        <mx:Script>
        <![CDATA[      
       
                var ddDate = new Date();
                var date = "Date: " + ddDate.getDay() + ", " + ddDate.getDate() + " " + ddDate.getMonth() + " " + ddDate.getFullYear() + "";

               
       
]]>
        </mx:Script>

        <mx:VBox width="100%">
                <mx:Text text="{date}" width="100%" styleName="smallPrint" fontWeight="bold" />
        </mx:VBox>

</mx:Box>

If anyone can help, either with the code above or by junking what i've done and supplying me with something known to work, i'd be very thankful!

Cheers,

Tony.



This communication together with any attachments transmitted with it ("this E-Mail") is intended only for the use of the addressee and may contain information which is privileged and confidential. If the reader of this E-Mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient you are hereby notified that any use, dissemination, forwarding, printing or copying of this E-Mail is strictly prohibited. Addressees should check this E-mail for viruses. The Company makes no representations as regards the absence of viruses in this E-Mail. If you have received this E-Mail in error please notify our ISe Response Team immediately by telephone on +44 (0)20 8896 5828 or via e-mail at [EMAIL PROTECTED] Please then immediately delete, erase or otherwise destroy this E-Mail and any copies of it.

Any opinions expressed in this E-Mail are those of the author and do not necessarily constitute the views of the Company. Nothing in this E-Mail shall bind the Company in any contract or obligation.

For the purposes of this E-Mail "the Company" means The Carphone Warehouse Group Plc and/or any of its subsidiaries.

Please feel free to visit our website: http:// www.carphonewarehouse.com or http://www.phonehouse.com

The Carphone Warehouse Group Plc (Registered in England No. 3253714) 1 Portal Way, London W3 6RS





This communication together with any attachments transmitted with it ("this E-Mail") is intended only for the use of the addressee and may contain information which is privileged and confidential. If the reader of this E-Mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient you are hereby notified that any use, dissemination, forwarding, printing or copying of this E-Mail is strictly prohibited. Addressees should check this E-mail for viruses. The Company makes no representations as regards the absence of viruses in this E-Mail. If you have received this E-Mail in error please notify our ISe Response Team immediately by telephone on +44 (0)20 8896 5828 or via e-mail at [EMAIL PROTECTED] Please then immediately delete, erase or otherwise destroy this E-Mail and any copies of it.

Any opinions expressed in this E-Mail are those of the author and do not necessarily constitute the views of the Company. Nothing in this E-Mail shall bind the Company in any contract or obligation.

For the purposes of this E-Mail "the Company" means The Carphone Warehouse Group Plc and/or any of its subsidiaries.

Please feel free to visit our website: http:// www.carphonewarehouse.com or http://www.phonehouse.com

The Carphone Warehouse Group Plc (Registered in England No. 3253714) 1 Portal Way, London W3 6RS

Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to