Alf,

It means you intend to access to any datefield field in your application
from a generic function in an external AS file, don�t you?.
In this case, the argument should be the Datefield id:

getCurrentDate(myDateFieldId);

function getCurrentDate(myArg)
{
var myArg;// it must be the id
myArg.selectedDate = new Date();
}

The id. must be unique. To access to a field in a .mxml file from an
external file, you should specify the complete path from the "Application"
tag.

For example:

main.mxml
---------
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
xmnls:myNameSpace="*"..>

<myNameSpace:sample id="sample">

..
</mx:Application>

sample.mxml
-----------

...

<mx:DateField id="inputDate" dateFormatter="formatDate" />



The path to this datefield is: mx.core.Application.application.sample.
inputDate



Isaac Bib�s Forado



 
[EMAIL PROTECTED]  
m Para: [email protected]  
cc:  
23/02/2005 22:01 Asunto: Re: [flexcoders] dateField questions?  
Por favor,  
responda a  
flexcoders  
 
 




Hi ibibas,

How would I set up a function to accept an argument like this:

getCurrentDate(myDateFieldNameHere);

I know this isn't correct:
function getCurrentDate(myArg)
{
var myArg;
myArg.selectedDate = new Date();
}

I would like to make the function generic so I could reuse it on other
screens
using the same external AS file.

thanks,
-Art


Quoting [EMAIL PROTECTED]:

> Once created the datefield, use this code in a ActionScript function:
>
> inputDate.selectedDate = new Date();
>
> where inputDate:
>
> <mx:DateField id="inputDate" dateFormatter="formatDate" />
>
> You can format it using this function:
>
> function formatDate(item) {
> var df:DateFormatter = new DateFormatter();
>
> df.formatString = "DD/MM/YYYY"; // this the mask
>
> return df.format(item);
> }
>
>
> Hope it helps...;-)
>
>
> Isaac Bib�s Forado
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>




Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.






Reply via email to