Size displayed on board <loadURL>

Explorer ,
Jan 22, 2020 Jan 22, 2020

Copy link to clipboard

Copied

I would like to know how I can define the size at which StageWebView information will be displayed on my stage.

Currently it occupies the entire stage, I would like to know how I can stay with the dimensions below:

width = 320 x height = 245

Thank you in advance, follow the code:

 

 

stage.scaleMode = StageScaleMode.NO_BORDER;

import flash.display.MovieClip;
import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.events.MouseEvent;

var webView: StageWebView = new StageWebView();

click.addEventListener(MouseEvent.CLICK, acc);

function acc (Event:MouseEvent) : void 
{
	webView.stage = this.stage;
	webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
	
	webView.loadURL("https://google.com/");
}

 

TOPICS
ActionScript, Code, Error, Other, Product issue, Tablet, Timeline

Views

148

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 22, 2020 Jan 22, 2020

Copy link to clipboard

Copied

Hi.

 

Replace:

webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);

 

By:

webView.viewPort = new Rectangle(0, 0, 320, 245);

 

Regards,

JC

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 22, 2020 Jan 22, 2020

Copy link to clipboard

Copied

Is there a way to centralize this function? For it is clinging to an edge.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 22, 2020 Jan 22, 2020

Copy link to clipboard

Copied

If you want to center an object that has the origin point in the top left corner, use the following formula:

displayObject.x = (parent.width - displayObject.width) * 0.5;

displayObject.y = (parent.height- displayObject.height) * 0.5;

 

So your code would be:

webView.viewPort = new Rectangle((stage.stageWidth - 320) * 0.5, (stage.stageHeight - 245) * 0.5, 320, 245);

 

Regards,

JC 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines