Skip to main content
Inspiring
February 28, 2012
Question

Changing parameters of StageWebView after it has been defined. [HELP]

  • February 28, 2012
  • 1 reply
  • 1162 views

How can I change the x and y paramaters of a stageWebView once it has been defined ?

var socialWebView:StageWebView;

socialWebView = new StageWebView();

var path = "http://www.google.ca" as String;

socialWebView.stage = this.stage;

socialWebView.viewPort = new Rectangle(0, 42, 1024, 728);

socialWebView.loadURL(path);

How come this wont work (  socialWebView.x = 10 )   ????

Any help is appreciated

This topic has been closed for replies.

1 reply

sinious
Legend
March 1, 2012

You're thinking that StageWebView is an object on the stage.

It is not.

You define the viewPort with a rectangle that sets the x, y, width and height. You can do this at any time later. Thus the equivalent of moving x over 10 pixels is setting a new viewPort:

socialWebView.viewPort = new Rectangle(10, 42, 1014, 728);

You can change this as much as you like at any time.

Known Participant
July 16, 2013

I currently have a movieClip where I am loading child movie clips so as to have easy layer control, but when I introduce a StageWebView it covers a popup menu.

Is it correct that a StageWebView cannot be loaded to an existing movieclip, or to a sub-layer - to allow menu buttons to appear over the StageWebView?

sinious
Legend
July 17, 2013

StageWebView is not on the display list, it is over it. That means yes, you cannot put display list content (MovieClips, Sprites, etc) on the Flash display list over any StageWebView.

The most you can do at the moment is use an ANE that will allow you to "fake it" as needed. I use darkredz UIWebView ANE which allows you to take a bitmap picture of the contents of a StageWebView. You could then add that snapshot to the display list as an object and overlay anything you like. However if the user goes to interact with the StageWebView you will need to switch back to the non-fake real StageWebView and the menu must disappear because it will be over the entire display list.

An example of a usage of that is taking a snapshot, adding to the display list then showing an advertisment that appears over it, or a menu, but once a selection is made it must appear to go away because the SWV will cover it again.

I use that ANE and it works as advertised however do note that all ANEs must have the PIE header added to get accepted if this is an iOS project. Apps aren't being rejected due to it just yet, but they will in the future at some point Apple chooses.