Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User none800's Avatar
    Join Date
    Apr 2010
    Posts
    9
    Hi,

    I'm working on a game that uses getTimer() to record player's score. My game uses two variables startTime & endTime & when the game is over score is calculated as (endTime - startTime). But when the game is suspended in background i need an event to be triggered so that i can pause my timer (otherwise player may cheat).
    Is there any event handler or any other way to code such situation???

    Regards,
    Pete

  2. #2
    Nokia Developer Champion sajisoft's Avatar
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,062
    Hi none800,
    Unfortunately, there is no pure Flash Lite API to detect that whether your flash content is in background or foreground. But there is a solution to your problem . Simply, use setInterval API instead of getTimer because according to my observation, setInterval get paused once your application is sent to back and get start from the same position where u left it. So, in that case ,the user cant cheat. As this is my 1000th post, you are getting a code tip as bonus :
    Code:
    //AS 2
    _global.mytimer = 0;
    function callback() {
     _global.mytimer ++;
     _stat.text = _global.mytimer ;
    }
    var intervalID:Number = setInterval(callback, 1000);
    Best Regards,
    SajiSoft

Similar Threads

  1. Flash Lite 4 Suspend Event?
    By rpurushotma in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2011-03-18, 00:56
  2. Flash Lite applications event handling
    By colombus2in in forum [Archived] Flash Lite on Nokia Devices
    Replies: 4
    Last Post: 2010-10-28, 18:39
  3. Problem with Flash Lite & Nokia - Flash Lite does not open in MMS
    By muggzy in forum [Archived] Flash Lite on Nokia Devices
    Replies: 4
    Last Post: 2008-12-17, 17:13
  4. Getting Flash Lite installed on Flash Lite enabled but not pre-built devices!
    By sirbijan in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2008-06-04, 07:39
  5. Flash Lite eSeminar: Predictive Mobile Search comes to Flash Lite
    By biskero in forum [Archived] Flash Lite on Nokia Devices
    Replies: 0
    Last Post: 2008-04-17, 14:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved