get "screen.width" without call "System.external"

46 views
Skip to first unread message

Akima

unread,
Jun 17, 2015, 2:12:52 PM6/17/15
to fla...@googlegroups.com
So I need to get "screen.width" (and height) without adding js functions to the html.

Is there any way to do that? 
(in html5, not flash)

Emilio Shodi

unread,
Jun 18, 2015, 2:02:53 AM6/18/15
to fla...@googlegroups.com
js.Browser.window.screen.width

By the way this question belongs more to haxe forum than here :)

среда, 17 июня 2015 г., 21:12:52 UTC+3 пользователь Akima написал:

Florencia Zanollo

unread,
Jun 18, 2015, 9:27:25 AM6/18/15
to fla...@googlegroups.com
Yeah, I saw that but couldn't make it work. Could you show me an example?
Thanks for the answer!

(PS: guess you're right, this is more haxe than flambe)


Flopy

--
You received this message because you are subscribed to a topic in the Google Groups "Flambe" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flambe/74La12Lgp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flambe+un...@googlegroups.com.
To post to this group, send email to fla...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flambe/4e1454bc-594c-4dfb-babb-3ad85f19eaf0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Emilio Shodi

unread,
Jun 18, 2015, 9:54:23 AM6/18/15
to fla...@googlegroups.com
I don't know. For me it works as is

Try to wrap it in #if html ... #end.

Or just use untyped __js__("window.screen.width");

четверг, 18 июня 2015 г., 16:27:25 UTC+3 пользователь Akima написал:

Mark Knol

unread,
Jun 18, 2015, 10:28:28 AM6/18/15
to fla...@googlegroups.com
If your game runs fullscreen, System.stage.width should do the trick.

Florencia Zanollo

unread,
Jun 18, 2015, 10:48:59 AM6/18/15
to fla...@googlegroups.com
ok I'm going to try that. Thanks!

Mark, yes it runs fullscreen (that is what I'm after) but System.stage.width returns the size of the screen with the navigation bar. 

Thanks for the answers!

Flopy

On Thu, Jun 18, 2015 at 11:28 AM, Mark Knol <mark...@gmail.com> wrote:
If your game runs fullscreen, System.stage.width should do the trick.

--
You received this message because you are subscribed to a topic in the Google Groups "Flambe" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flambe/74La12Lgp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flambe+un...@googlegroups.com.
To post to this group, send email to fla...@googlegroups.com.

Mark Knol

unread,
Jun 18, 2015, 6:05:48 PM6/18/15
to fla...@googlegroups.com
No, it returns the width of the canvas/swf object without browser bars https://aduros.com/flambe/api/flambe/subsystem/StageSystem.html#width
Otherwise you should report this as bug. I always align my stuff using this value and this is the recommended method to use.

Florencia Zanollo

unread,
Jun 23, 2015, 11:31:47 AM6/23/15
to fla...@googlegroups.com
Mark, I tried what you said. 
It returns the width and height of the canvas as for that moment but when fullscreen gets called (on user input) the browser bars are hided but the canvas is not re-sized (to fill the entire, now full, screen).

So the result is this

​there's a piece of the screen that's not covered.

Thanks!

(my current solution is to re-size it manually - with a js function - but I'm trying to remove all external js)

On Thu, Jun 18, 2015 at 7:05 PM, Mark Knol <mark...@gmail.com> wrote:
No, it returns the width of the canvas/swf object without browser bars https://aduros.com/flambe/api/flambe/subsystem/StageSystem.html#width
Otherwise you should report this as bug. I always align my stuff using this value and this is the recommended method to use.
--
You received this message because you are subscribed to a topic in the Google Groups "Flambe" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flambe/74La12Lgp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flambe+un...@googlegroups.com.
To post to this group, send email to fla...@googlegroups.com.

Mark Knol

unread,
Jun 23, 2015, 1:44:28 PM6/23/15
to fla...@googlegroups.com
Are you updating the layout and retreiving the stage width/height when System.stage.resize is called?

Florencia Zanollo

unread,
Jun 23, 2015, 1:45:35 PM6/23/15
to fla...@googlegroups.com
Resize isn't called (or at least I'm not getting the event)

On Tue, Jun 23, 2015 at 2:44 PM, Mark Knol <mark...@gmail.com> wrote:
Are you updating the layout and retreiving the stage width/height when System.stage.resize is called?
--
You received this message because you are subscribed to a topic in the Google Groups "Flambe" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flambe/74La12Lgp84/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flambe+un...@googlegroups.com.
To post to this group, send email to fla...@googlegroups.com.

Emilio Shodi

unread,
Jun 23, 2015, 7:03:31 PM6/23/15
to fla...@googlegroups.com
I had the same problem before (check out this thread https://groups.google.com/forum/#!topic/flambe/caZbETvnJpA)
I sitll have no fix for this issue so i don't use fullscreen api now.

вторник, 23 июня 2015 г., 18:31:47 UTC+3 пользователь Akima написал:

Emilio Shodi

unread,
Jun 23, 2015, 7:07:34 PM6/23/15
to fla...@googlegroups.com
And yes, no resize event is fired on entering fullscreen mode (well, it should be easy-fixable — call HtmlStage.onWindowResize on fullscreen.change)

среда, 24 июня 2015 г., 2:03:31 UTC+3 пользователь Emilio Shodi написал:
Reply all
Reply to author
Forward
0 new messages