AS3: How to get fullscreen and keyboard input? - actionscript-3

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! :)

Related

How can I overlay html elements over my DirectShow application?

I'm working with a DirectShow application that exports as a Firefox plugin for video streaming.
To the best of my knowledge, it seems as though the plugin is being rendered on a separate window from the web page. I'd like to edit the application to allow html elements over the plugin much like flash allows with wmode='opaque' or 'transparent'. Another option that would work is to pass mouse events through the application (such as mouse move and mouse down).
I've been reading up on put_MessageDrain and put_Owner, but I'm not sure how to apply these to the application or if they will work.
I'm also aware that iframe shimming may work, but since I have access to the source code of the application I'd like to add the functionality directly rather than use a work around. Is iframe shimming my best option? It seems like the easiest option.
The application currently uses Windowless mode and is always on top of everything else on the web page.
The way video is displayed with DirectShow video renderers, you cannot make it transparent without providing your own video renderer filter, or custom allocator/presenter object for one of the standard video renderers. DirectShow renderers display video with DirectDraw or Direct3D surface which stands alone from hosting window and is not interacting with host in a way supposed to get you combined picture with transparent video and something else as well.
I've been reading up on put_MessageDrain and put_Owner
These are for Windowed mode, you seem to use Windowless which assumes that you are providing a hosting window and rectangle to cover opaquely. Renderless, the third mode VMR-7/9 and EVR offer you is the one where you provide allocator/presenter and override the presentation.
Windows SDK (for some you might need to look for an older version, not the latest) provides with samples: Renderless, VMR9Allocator, EVRPresenter which demo the renderless mode.

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 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.

Fullscreen mode loaded when opening Flash Player

Is it possible to make a flash player go full screen (not in browser)?
Would there be any bug / error on different version of Flash player?
HI!
stage.displayMode = StageDisplayState.FULL_SCREEN_INTERACTIVE;
Available only in Adobe AIR.
It allows you to listen to keyboard events (meaning you can also type inside text boxes etc..)
stage.displayMode = StageDisplayState.FULL_SCREEN;
Available in any AS3 based flash file (starting from flash 9)
There is no issue with using it, except you cannot use the keybard.
From my experience with fullscreen mode's in flash the main thing to bear in mind is to make your application have liquid layouts which re-act to the Event.RESIZE. Then when you listen for that event re-lay out your application to the new ( fullscreen ) width and height.
To do this you would change the stage.displayMode to StageDisplayState.FULL_SCREEN
In Flash player it's Ctrl-F, as menu suggests, so it's certainly possible. Have you tried stage.displayMode = StageDisplayState.FULL_SCREEN_INTERACTIVE? StageDisplayState doc says it's here from version 9.0.28.0.

Capture image from camera into form or html5 canvas

I need to capture an image from a webcam (tethered camera, etc.) into a form or html5 canvas so that I can save the image to the server. Also, I would like to be able to preview the image live in the page.
For example, I have a browser running at a registration check in station. I would like to take a picture of the attendee currently standing in front of the table, and submit that image into the database. Then I can use that image to print the attendee's badge with their picture on it.
I'm using rails and paperclip, though I doubt that matters.
Anyone done this before, or have some ideas how to do it?
There is a plugin for jQuery entitled 'jQuery Webcam Plugin' that provides a friendly and easy way to interact with a webcam. It actually relies on a small flash component (unfortunately), but it does a great job of making the interaction easy - as well as providing functionality to copy imagery direct into an HTML5 canvas.
Again, it's unfortunate that it relies on Flash, but I think any reliable solution is going to need flash at this point in time.
The plugin is available here: http://www.xarg.org/project/jquery-webcam-plugin/
At present, if you want to interact with a web cam from a web page you need to look at using a plug in. Flash has a mature interface to web cams, so it would be my first choice of tool.
There used to be a spec for native web cam support in HTML 5, but it has been spun out into its own, independent, specification. Currently there is no browser support for it outside of experimental Opera builds.
Android >=3.0 (on plenty of tablets and one phone soon) is supposed to support this. Searching for "html media capture" and "device api" will get you a lot more information.
On the not-even-alpha bleeding edge side, there are things like webrtc and the mozilla rainbow plugin.