Unity Community


Page 1 of 2 12 LastLast
Results 1 to 20 of 23

  1. Posts
    12

    Full Screen Applications?

    Hello, is there any way to make a Flash application (exported from Unity) show in full screen?


  2. Posts
    455
    they are working on enabling full screen, currently, you would have to create a flash swf shell for full screen, and the mouse lock does not yet play nicely with unity swf's, they are working on that too, hopefully the next unity update will have both

  3. Unity



    Location
    Denmark
    Posts
    471
    hi. The next update won't have either yet. I've looked at both things, as they are codependent; we'll have this in sooner rather then later after the next build; however due to some disparity on how unity handles gui and how flash's security sandbox regarding enabling fullscreen works, this will need some workarounds for that on our end.

    In the mean time, having fullscreen can be done in the next build with a hack-ish workaround, which will give you access to the stage from nested actionscript. From there you could capture events from the stage and invoke fullscreen from those mouse events. When it's out I will show paste the workaround, however, it's not integrated or elegant at all. We are working hard on improving the flash build, but it's still in preview and not at release level yet.


  4. Posts
    455
    well i can paste the full screen interactive work around, the issue is, i did not bother writing the event from sending flash's movementX and movementY over to the Unity, because i thought the next build would have support for these. perhaps you can persuade the UT team to just add support for those 2 variables, but not actually use them. that would allow any hackish workaround to perform better rather than having to send constant movement variables from flash to unity when the mouse moves.


  5. Posts
    6
    Hi Ralph, please do post the example on how to get access to the stage. I'm in need of this!


  6. Location
    Brighton/London
    Posts
    43
    You can access the Stage in 3.5.2 via UnityNative:

    Code:  
    1. ActionScript.Import("com.unity.UnityNative");
    2. ActionScript.Statement("trace(UnityNative.stage);");


  7. Posts
    662


  8. Posts
    3
    Any update on this? In a click handler I'm doing:

    ActionScript.Import("com.unity.UnityNative");
    ActionScript.Statement("UnityNative.stage.displayS tate = 'fullScreen'");
    ActionScript.Statement("trace(UnityNative.stage.di splayState)");

    but I'm getting:

    SecurityError: Error #2152: Full screen mode is not allowed.

  9. Unity



    Location
    Denmark
    Posts
    471
    Normally, that's a flash error indicating that you don't have the allowFullScreenFlag set in your html. However, I've heard of people having issues with this on Flash 11.3 (in general, not just unity-flash). What version are you trying to run this on? Does your html have this flag ?


  10. Posts
    3
    allowScriptAccess and allowFullScreen are both true (the wrapper is the one that Unity generates from the Flash build, which defaults them to true). The version I'm targeting is 11.2; my Flash player version is 11.2.202.235. From what I understand the full screen requesting code has to exist directly within the mouse or key handler in the ActionScript layer; looking at the generated code it seems as if this is not the case?

  11. Unity



    Location
    Denmark
    Posts
    471
    @ryamldess; yes indeed, you'll need to invoke the fullscreen using the flash wrapper; you can for example detect a click on stage on there and see if the point falls within a rect. For now this is the only way to do this, we'll have it fixed in the release.


  12. Location
    India
    Posts
    3
    Please give the example


  13. Location
    Brighton/London
    Posts
    43
    @Anna, you can modify the preloader example to do this.

    You'll need to make the following changes to the AS3 source:
    - the UnityLoaderParams supplied to the UnityContentLoader will need to have the first parameter (scaleToStage) set to true.
    - add an event listener (e.g. KeyboardEvent, MouseEvent) and when that occurs, set the stage's displayState to StageDisplayState.FULL_SCREEN


  14. Posts
    128
    I get a sample from the archive and add the necessary code to as3.
    Unfortunately full screen is not available.
    This solution works?


  15. Posts
    1

    I do it like this

    Code:  
    1. import com.unity.UnityNative;
    2. import flash.display.Sprite;
    3. import flash.display.Stage;
    4. import flash.display.StageDisplayState;
    5. import flash.events.MouseEvent;
    6.  
    7. var hitArea:Sprite = new Sprite();
    8. hitArea.graphics.beginFill(0, 0);
    9. hitArea.graphics.drawRect(0, 0, 960, 580);
    10. UnityNative.stage.addChild(hitArea);
    11.            
    12. hitArea.addEventListener(MouseEvent.CLICK,onClick);
    13. function onClick(evt:MouseEvent):void
    14. {
    15.     UnityNative.stage.displayState=StageDisplayState.FULL_SCREEN;
    16. }


  16. Posts
    97
    Did Unity put fullscreen in yet?


  17. Posts
    97
    Hello.

    Could someone who got this working perhaps give an explanation suitable for Flash newbies on how to get this to work? I think it'd help a lot of people (including me).


  18. Location
    Finland
    Posts
    274
    I haven't played with this, but I'd say the solution agang0718 posted would be the easiest way to go. And I'd probably implement it inside loader-swf, that then loads the unity created swf. TommiH, have you played with that kind of stuff before? It gives you way better control of the Flash specific stuff, and also makes it easier to tweak the flash-functionality without the need to compile unity-content every time you do some minor changes in it.

    With that method, you could easily, more or less, just copy-paste the code agang0718 provided.

    Shouldn't be impossible to create a static class out of that code and use it straight in Unity that way. Using 'inline' AS in unity might be also possible, but could get messy, with the functions at least.
    Last edited by mtoivo; 11-23-2012 at 11:23 AM.


  19. Posts
    97
    Thanks. I managed to get it working with the ActionScript class. In case someone as clueless as me is reading this, here's the code:

    Code:  
    1. using UnityEngine;
    2. using UnityEngine.Flash;
    3.  
    4. public class FullScreenSwitcher : MonoBehaviour {
    5.    
    6.     public void Start(){
    7.         ActionScript.Import("com.unity.UnityNative");
    8.         ActionScript.Import("flash.display.Sprite");
    9.         ActionScript.Import("flash.display.Stage");
    10.         ActionScript.Import("flash.display.StageDisplayState");
    11.         ActionScript.Import("flash.events.MouseEvent");
    12.         ActionScript.Statement("var hitArea:Sprite = new Sprite();" +
    13.                                "hitArea.graphics.beginFill(0, 0);" +
    14.                                "hitArea.graphics.drawRect(0, 0, 960, 580);" +
    15.                                "UnityNative.stage.addChild(hitArea);" +
    16.                                "hitArea.addEventListener(MouseEvent.CLICK,onClick);" +
    17.                                "function onClick(evt:MouseEvent):void" +
    18.                                "{" +
    19.                                "UnityNative.stage.displayState=StageDisplayState.FULL_SCREEN;" +
    20.                                "}");
    21.     }
    22. }


  20. Posts
    34
    i do it with some warning

    unkonwn 'FullScreen_MC'
    FullScreen_MC' unknown attribute 'FullScreen_text'
    FullScreen_text' unknown attribute 'text'

    the full screen worked, but can't response the key event。


    thanks!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •