Actionscript Screen Idle - actionscript-3

I made a small flash program to help me with my workouts but because of the length the computer screen goes idle. It looks like there is a solution for this on android but is there one just for regular flash programs?

If this is an AIR app, to disable screen timeout set:
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
If this is Flash running in a browser, I do not believe it is possible.

Related

Can Android Air have a splash screen using Flash Pro?

Is there a way to specify a splash screen for an Android AIR application in Flash Pro? I've seen a number of techniques but none for Flash Pro.
Thanks.
Flash Pro is no different than any other AS3 IDE except that it gives you visual tools to create with. You still have access to the exact same code and techniques. You can use SplashScreenImage to do it, if you're using Flex. For the most part, you don't want to do anything that runs code on mobile, which is why Flex doesn't allow you to. So no animation, no movement, no anything. Just a static image.
Regardless, any technique you've found should work just fine on Android and with Flash Pro. As I said, there is no difference between an app created with Flash Builder, IntelliJ, Flash Develop, and Flash Pro. They all use the same compiler, same runtime, same codebase, etc.

Flash Player behaviour when lost focus

I've got a real problem with FlashPlayer. What I need is to have it working on full speed when it is in the THROTTLE mode - that means when FlashPlayer loose its focus and decrease framerate to about 4fps. This is commonly know as a feature for mobile phones or when you change a tab in your browser and your .swf movie doesn't run with full speed anymore.
I need this full speed because we run tests with flash swfs on virtual servers, and unfortunatelly tests run very long.
I found that in FP11.2 was ThrottleEvent introduced that inform you what Flash Player is doing. It can go to PAUSE, THROTTLE, or RESUME state. Unfortunatelly it seems that I can't force other stage.frameRate when it really goes into any of these states. I tried also with Event.DEACTIVATE, and Event.ACTIVATE without any results.
Can I go around this any way? Or if not, what version of FlashPlayer was the latest before Adobe incorporated this feature into FP?
Thanks for any response!
Kindest Pawel
you should try
stage.addEventListener(ThrottleEvent.THROTTLE, doStuff)

How can i detect hardware accleration problems in flash?

When I used full screen in as3, application opens full screen, but it completely blank. At other computers all works fine. I searched hard and found that sometimes hardware acceleration could provoke this. I turned off hardware acceleration manually (by right-click menu on flash app > settings), and app started work in full screen correctly.
How could I detect, if client have hardware acceleration turned on, and application shows him white screen? If any possibilities to fight with this problem other way?
For video hardware acceleration you should use the VideoStage class. So if you can get an instance of the StageVideo class then hardware acceleration is available. How to get this instance described here.

How to continue a SWF rendering whilst off screen?

I need to be able to continue rendering a SWF file whilst it is off screen or minimized. Taken from the adobe website: "This is an automatic feature in Flash Player since version 10.1. Flash Player minimizes processing when SWF content goes off-screen."
I have extensively searched around for a solution on this. One solution suggested was to use the HTML parameter "hasPriority" and set it to true which will ensure some things are not paused. SWF content will stop rendering regardless of this when off screen or hidden.
Does anyone know if it is possible to disable this automatic feature so my SWF will continue to render off screen?
Thanks in advance for any help.
The flash virtual machine is specifically designed so that, while viewing flash in the browser, the VM is paused when the instance of the player loses window focus. This is necessary functionality in order to... well.. keep flash from utterly destroying your computer, forcing it catch ablaze and send it to the computer underworld. Just imagine what would happen if you had 3-4 flash sites open and rendering off screen on your tablet. It would die a horrible death. You cannot override this functionality.

AS3: How to get fullscreen and keyboard input?

Since flash doesn't allow keyboard input while in fullscreen mode I'm wondering if there is a workaround to that?
I have a flash that is going to run fullscreen in a browser and needs different kinds of keyboard input. I have read something about AIR, but I don't fully understand it and would like another way if thats even possible.
Anybody knows?
public function setFullScreen():void
{
this.width = Capabilities.screenResolutionX;
this.height = Capabilities.screenResolutionY;
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
Use the FULL_SCREEN_INTERACTIVE
This is now possible in Flash Player 11.3+
Simply compile your application to support a minimum version of 11.3.0 and it will work if you use:
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
in your html you must put:
<param name="allowFullScreenInteractive" value="true" />
you will see a prompt when you enter full screen:
you can see an example on this official adobe blog:
http://www.leebrimelow.com/wp-content/uploads/2012/04/overlay.gif
It is not possible to get input key with fullscreen mode within the browser.
Air is only for desktop application so if your application have to work into the browser no Air for you.
If you have to get input into fullscreen mode you can try to make a virtual keyboard (an example) and user will use the mouse to press the keyboard key.
It actually is possible in Flash 10, but only for a few keys. See this page:
Understanding the security changes in Flash Player 10
Flash Player 9 does not allow keyboard
input when displaying content in
full-screen mode. Flash Player 10
changes this, allowing for a limited
number of keys to be usable in
full-screen mode. These include Tab,
the Spacebar, and the (up, down, left,
right) arrow keys.
Another option is to just use the browser's built-in fullscreen capability. All major browsers offer it as far as I know (IE, Firefox, Chrome, etc). Usually it's under View->Fullscreen, hotkey F11. Depending on the browser it will either give you the entire screen, or maybe leave a small bar across the top/bottom. Then you simply need to make your flash application expand to fill the entire HTML page.
Patrick is right. Due to security risks, your going to have a tough time getting your goal met. Adobe AIR is your best solution and will be easy to achieve in your state.
Here is a great video to get your started from Lee Brimelow. http://theflashblog.com/?p=403 (Building AIR Applications in Flash CS3)
Since AIR applications are built right in Flash or Flex, all you will need to do is configure how your application compiles, and you have yourself a Adobe AIR application capable of utilizing the keyboard while running as a cross platform desktop application.
Ahh, AIR is not for browsers? Too bad. Seems like I won't be able to get everything I wish for :p I have functions for the most important things without the keyboard functions, but I would really like them all of course.
I'll look into Silverlight then and see if thats an option.
Thanks guys! :)