ActionScript - StageWebView posición y tamaño

 
Vista:
Imágen de perfil de Eduardo
Val: 2
Ha mantenido su posición en ActionScript (en relación al último mes)
Gráfica de ActionScript

StageWebView posición y tamaño

Publicado por Eduardo (1 intervención) el 09/09/2020 22:31:22
Hola a todos tengo un proyecto en air el cual se hace en animate el cual encapsulo como una apk de android la cual muestra una web (WebView) con el elemento StageWebView de AS3 y funciona, me muestra en el ejemplo la web de google

1
2
3
4
5
6
7
8
9
10
11
// Example:
import flash.display.MovieClip;
import flash.media.StageWebView;
import flash.geom.Rectangle;
var webView: StageWebView = new StageWebView();
function StageWebViewExample() {
webView.stage = this.stage;
webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
webView.loadURL("http://www.google.com");
}
StageWebViewExample();

pero no se como ajustar el rectángulo (tamaño y posición de la misma) para que se vea a toda pantalla...

me dicen que es en esta parte

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

pero le asigno valores y sigue mostransose igual

ayuda pleasee!!






Captura
Capturah
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Alejandro

Ajustar el tamaño y la posición de StageWebView

Publicado por Alejandro (369 intervenciones) el 29/06/2023 18:53:19
Para ajustar el tamaño y la posición de StageWebView en tu proyecto de Adobe Animate encapsulado como una APK de Android, puedes modificar los valores del rectángulo asignado a la propiedad viewPort. Aquí tienes una posible solución:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import flash.display.Stage;
import flash.display.MovieClip;
import flash.media.StageWebView;
import flash.geom.Rectangle;
 
var webView:StageWebView = new StageWebView();
 
function StageWebViewExample() {
  webView.stage = stage;
 
  // Ajustar el rectángulo para que se vea a toda pantalla
  var screenWidth:Number = stage.fullScreenWidth;
  var screenHeight:Number = stage.fullScreenHeight;
  var viewPortRect:Rectangle = new Rectangle(0, 0, screenWidth, screenHeight);
  webView.viewPort = viewPortRect;
 
  webView.loadURL("http://www.google.com");
}
 
StageWebViewExample();

En el código anterior, he reemplazado `stage.stageWidth` y `stage.stageHeight` por `stage.fullScreenWidth` y `stage.fullScreenHeight` respectivamente. Esto asegura que el StageWebView ocupe todo el ancho y alto de la pantalla.

Ten en cuenta que la visualización de la página web en el StageWebView puede variar dependiendo del dispositivo y su relación de aspecto. Si quieres un control más preciso sobre el tamaño y la posición de la vista web, puedes ajustar los valores del rectángulo `viewPortRect` según tus necesidades.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar