Hello. I thank in advance for the time of those who might be able to 
help me.
I have the following situation.

I have worked in an application developed with Tapestry 3 which displays 
a digital clock using a
regular flash movie. However, my interest lies in knowing if I could 
embed a flex component within
a tapestry page. Unfortunately, I'm stuck using Flex 1.5...  ¬_¬

My objective is to make the clock component pull out the current date & 
time
that the server knows at the time the clock component starts ticking for 
the first time.
Afterwards, the component should increment the clock time on it's own.

So far, I have the following code which could be embedded inside a JSP:

<%@ taglib uri="FlexTagLib" prefix="mm" %>
<mm:mxml>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
width="275" height="18" creationComplete="initialize()" 
backgroundColor="#135144" marginTop="0" marginBottom="0" marginLeft="0" 
marginRight="0">

    <mx:Script>
    <![CDATA[
        private static var DAYS = ['sunday', 'monday', 'tuesday', 
'wednesday', 'thursday', 'friday', 'saturday'];
        private static var MONTHS = ['january', 'february', 'march', 
'april', 'may', 'june',
                                     'july', 'august', 'september', 
'october', 'november', 'december'];

        private var currentDate : Date;
        private var timeoutInterval : Number;

        private function initialize() : Void {
            testService.getServerDate();
        }

        private function receiveDate(serverDate : Date) : Void {
            currentDate = serverDate;
            clearInterval(timeoutInterval);
            timeoutInterval = setInterval(mx.utils.Delegate.create(this, 
increaseClock), 1000);
        }

        function increaseClock() : Void {
            if (currentDate != null) {
                currentDate.setSeconds(currentDate.getSeconds() + 1);
            }
            dateTextField.text = formatDate();
        }

        private function formatDate() : String {

            var dateString : String = DAYS[currentDate.getDay()];
            dateString += ' ';
            dateString += currentDate.getDate();
            dateString += ' ';
            dateString += MONTHS[currentDate.getMonth()];
            dateString += testFormatter.format(currentDate);
            return dateString;
        }
    ]]>
    </mx:Script>

    <mx:RemoteObject id="testService" source="TestDelegate" 
concurrency="last">
        <mx:method name="getServerDate" 
result="receiveDate(event.result)" />
    </mx:RemoteObject>

    <mx:DateFormatter id="testFormatter" formatString=" YYYY LL:NN:SS AA" />

    <mx:Label id="dateTextField" fontWeight="bold" color="#fece0a"/>

</mx:Application>
</mm:mxml>

But I'm still struggling to know if this could be embedded in some way 
within a Tapestry page.
Is there any document where I could be referred to for some insight on this?

Thanks for your time and help!


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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:
    http://docs.yahoo.com/info/terms/
 


Reply via email to