Hi Frederico,
                    The Alert is pop uped after some time interval. For
first time it is ok, i.e. 3 seconds, but after that it vanishes much before
3 seconds, many times less than 1 second and sometimes it just flashes,
can't be seen.
          My concept of timer is not that clear, It will be great if u
provide some timing snipeet using On Enter Frame.
On Jan 7, 2008 3:19 PM, Frederico Garcia <[EMAIL PROTECTED]> wrote:

>   YOGESH JADHAV escreveu:
>
> > Hi all,
> > I want a reliable timer in my app to remove a alert
> > after say 3 seconds. Earlier I tried the normal setTimeOut but it is
> > not reliable and gives error in firefox. So i tried with onEnterFrame
> > technique, but it is also not working properly. I also tried by
> > setting application frame rate to some value ( like 99, 70 etc). I
> > have seen many application which are having perfect and reliable
> > timing events. Can anybody guide me to achieve perfect timing event.
> > Code snippets will be more than appreciated.
> > Here is my code
> >
> > private function showMyAlert():void
> > {
> > alert = Alert.show(" Test, shud be gone in 3
> > seconds");
> > //setTimeout(hideAlert, 3000);
> > onCreationComplete();
> > }
> >
> >
> > private function hideAlert():void
> > {
> > PopUpManager.removePopUp(alert);
> > }
> >
> > private function alertCloseHnadler(event:CloseEvent):void
> > {
> > if (event.detail == Alert.YES)
> > Alert.show("Yes");
> > }
> >
> > private function onCreationComplete() : void
> > {
> > timer = new Timer(3000);
> > timer.addEventListener( TimerEvent.TIMER, onTimerEvent );
> > timer.start ();
> > fps = 0;
> > this.addEventListener(Event.ENTER_FRAME, onFrameEnter);
> >
> > }
> >
> > private function onFrameEnter( event : Event ) : void
> > {
> > fps++;
> > trace("enterframe");
> > }
> >
> > private function onTimerEvent( event : Event ) : void
> > {
> > hideAlert();
> > }
> >
> >
> > --
> > There is no point in knocking the "closed Windows" when the door is
> > "Open". Open your eyes, use open source software.
> >
> >
> > Regards,
> > Yogesh
> >
> > __________ NOD32 2760 (20080102) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.eset.com
> Hi,
>
> The code for Timer should work. Not advisable to use at the same time as
> onEnterFrame. Either Timer or onEnterFrame are susceptible to CPU usage.
> But with such an interval (3secs) you should have no problem.
>
> I've used Timer to make a clock (www.kemelyon.com) and it's exact in
> seconds.
>
> How big is the error for Timer (and it takes longer or less than
> expected)?
>
> Regards,
>
> Frederico Garcia
>  
>



-- 
There is no point in knocking the "closed Windows" when the door is "Open".
Open your eyes, use open source software.


Regards,
Yogesh

Reply via email to