Skip to main content
Participating Frequently
June 8, 2011
Answered

Replay of flash file

  • June 8, 2011
  • 1 reply
  • 629 views

I have made one sample.apk for Android using Flash CS5.5. The flash file contains some animations on each frame. Now when I test my application in android emulator, it's not launching from start(i.e. from first frame). It always show me the last visited frame(the last time where I left my application). Could anybody tell me how to launch application from start?

This topic has been closed for replies.
Correct answer relaxatraja

Then write the code to exit when you back:

stage.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDown );

NativeApplication.nativeApplication.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDown );

NativeApplication.nativeApplication.addEventListener( Event.DEACTIVATE, handleDeactivate );

function handleKeyDown( e :KeyboardEvent ) :void
{
    switch( e.keyCode )
    {
        case Keyboard.BACK:
            NativeApplication.nativeApplication.exit();
            break;
        case Keyboard.SEARCH:
        case Keyboard.MENU:
            e.preventDefault();
            break;
    }
}

function handleDeactivate( e :Event ) :void
{
    NativeApplication.nativeApplication.exit();
}

1 reply

relaxatraja
Inspiring
June 8, 2011

From the emulator:

Settings>Applications>Manage Applications>[select your running apk file]>[use Force stop] (or) [uninstall to remove the application]

Participating Frequently
June 8, 2011

Thanks for the reply!!

I know we can do this, but I was looking for alternate method because each time we need to remove and again install that application.  

relaxatraja
relaxatrajaCorrect answer
Inspiring
June 8, 2011

Then write the code to exit when you back:

stage.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDown );

NativeApplication.nativeApplication.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDown );

NativeApplication.nativeApplication.addEventListener( Event.DEACTIVATE, handleDeactivate );

function handleKeyDown( e :KeyboardEvent ) :void
{
    switch( e.keyCode )
    {
        case Keyboard.BACK:
            NativeApplication.nativeApplication.exit();
            break;
        case Keyboard.SEARCH:
        case Keyboard.MENU:
            e.preventDefault();
            break;
    }
}

function handleDeactivate( e :Event ) :void
{
    NativeApplication.nativeApplication.exit();
}