I want to use StageWebView just for communicating with a JS page, without actually showing it at all
Is this possible, and if so, what is the best recommended way of doing it?
Seems that not setting the viewport might accomplish this, as well as positioning the viewport offscreen
First you need the interaction, then you need to put the view off the stage. Take a look at RichWebView which is an alternative to StageWebView https://github.com/myflashlab/webView-ANE
As the documentation says, you can't do this with StageWebView.
The StageWebView class provides a simple means to display HTML content
on devices where the HTMLLoader class is not supported. The class
provides no interaction between ActionScript and the HTML content
except through the methods and properties of the StageWebView class
itself. There is, for example, no way to pass values or call
functions between ActionScript and JavaScript.
Using HTMLLoader you could do this.
Related
I want to create a help screen for my game. This screen contains text and pictures that describe the game.
One option is to create a stage and add a table to it that will define the position of the different labels and images. However, this option seems to be "unnatural", limited when it comes to format options, and a potential headache when it comes to code maintenance.
The content of the screen is static which makes it a good candidate for an HTML document. My idea is to create the help screen document in HTML and then have it rendered inside my help screen. My question is, is this possible in libgdx? If not, what other way would I have to implement this?
As it is not possible to embed a browser in your LibGDX app (as nicely explained here), you could either link to an external website in the device's browser or use the libgdx-stagebuilder to build up the Scene2D stage using XML. Or you just stick to the normal LibGDX way. Unfortunately, I don't see any other option than those.
I don't think this is supported in libGDX as of yet, but it should be possible using platform specific code. How you do it will vary from platform to platform, so I can't tell you exactly what to look up, but android has something called webview you might want to look at.
attempting to add a flash component slider to my as 3 class and I cant find any examples on the web. I am surprised at the number of funky home made sliders i am seeing. Maybe there is a problem with flash components and as 3? Could you leave a note if this is doable, and any rough direction you could provide. thnks!!
The examples in the AS3 docs should give you the information you need.
Reasons not to use the slider component:
It adds 32KB to the size of your SWF. Not a great option where file size is critical.
It's not that difficult to code a slider which may be more suitable to your needs.
I wouldn't be (haven't been) afraid to use the built-in slider component, though.
You do need to make sure the component is in your FLA library before compiling. Including the code in your AS will not do since I beleive Flash needs all of the visual elements present.
Would it be possible to create a virtual web browser, inside your existing web browser, using canvas, to achieve near pixel perfect representation of websites across all browsers?
Take a look at http://html2canvas.hertzen.com/ - It's a HTML renderer using a Canvas element. There are a few limitations (some CSS3 properties don't work) and you can only do static images with it. But it's still very cool.
Also it's still going to be browser-specific in terms of exact positioning of elements.
Theoretically: Yea, maybe... no.
Practically: Hell no.
You can't play flash / silverlight / java applets on canvas. Also, you'd have to:
Manually parse the DOM,
Apply CSS,
Execute JS,
Render everything,
Make input elements,
dropdown menu's,
hyperlinks,
mouseovers,
and all that kind of interaction work,
And whatever else I've forgotten.
Like proper Anti-Aliasing
Only with tremendous difficulty.
Why not just use <iframe>?
How to achieve a true BorderLayout effect in GWT?
If possible without a library?
If I need to use a library, please not a payed one, neither a deprecated one?
From Kinjal's post, the 2.0 *LayoutPanel classes are almost certainly what you want. The DockLayoutPanel and its subclass the SplitLayoutPanel will provide this functionality in two different ways.
There are two important things about using Layout Panel classes. First, use a strict doctype (such as the html5 doctype). Second, all panels must be given a size and must be informed of resizes - this is why they all implement the RequiresResize interface.
The easiest way to do that is to start not with a RootPanel, but with a RootLayoutPanel - this will ensure that you get resize events from the browser window. Then, add in the layout panel of your choice, and it too will be resized.
If you build your own widget subclasses and want to be notified when resizing happens, you too should implement RequiresResize. Similarly, if you are building a widget subclass that will be sizing its children, you should implement the ProvidesResize interface.
Use HLayout or VLayout and set custom css style to achieve it.
You can also take a look at this Layout documentation
I'm creating a flex drag and drop interface of sorts that will have a range of different components. Is there a standard way of adding resize handlers to a component or does the component need to be overridden?
Do you mean front-end resizing?
Senocular wrote an excellent transform class for that:
http://www.senocular.com/flash/tutorials/transformtool/
http://www.senocular.com/demo/TransformToolAS3/TransformTool.html
I found quite a useful example that is easy to implement. It gives support for changing cursors, setting bounds, rotation and fixed aspect ratio. I think its worth a look for anyone needing to add resize support.
https://github.com/marc-hughes/ObjectHandles/tree/master/flex-object-handles
The above link is a flex project download. Import the flex project and run the MoveAndResize.mxml example.