Adobe AIR的:里面的StageWebView影片剪辑影片剪辑、里面、Adobe、AIR

由网友(freedom 自由)分享简介:我有一个简单的问题。我想里面有一个影片剪辑一个的StageWebView因此,如果影片剪辑移动,舞台搬到了。I have a simple question.I want to have a StageWebView inside a MovieClip so if the MovieClip is moved,...

我有一个简单的问题。 我想里面有一个影片剪辑一个的StageWebView因此,如果影片剪辑移动,舞台搬到了。

I have a simple question. I want to have a StageWebView inside a MovieClip so if the MovieClip is moved, the Stage is moved to.

var view:MovieClip = new MovieClip();
view.y=50;
view.x=10;
view.height=stage.stageHeight-50;
view.width=stage.fullScreenWidth;
addChild(view);

var webView:StageWebView = new StageWebView();

webView=new StageWebView();
webView.stage=view.stage;
webView.viewPort=new Rectangle(0,0,stage.fullScreenWidth,stage.stageHeight);
webView.loadURL("http://www.google.com/");

尽管查看三菱商事拥有50 y值和10 web视图是locatet在x x值:0,Y:0。当然,我可以只改变视口设置,但我真的需要web视图与视图MC走动。

Even though the "view" mc has a y value of 50 and an x value of 10 the webView is locatet at x:0 and y:0. Of course I could just change the viewPort settings but I really need the WebView to move around with the "view" mc.

感谢你提前和最诚挚的问候。

Thank you in advance and best regards.

推荐答案

这不是显示列表中的,所以你只能通过调整视口属性调整位置。

It's not on the display list so you can only adjust the position by adjusting the viewPort property.

当你开始移动,然后取出位图和更新的StageWebView你可以绘制的StageWebView到MovieClip中的位图时,此举结束。

You could draw the StageWebView to a Bitmap within the MovieClip when you start moving it and then remove the Bitmap and update the StageWebView when the move finishes.

AS3文档的drawViewPortToBitmapData()

修改提供快速code例如:

这code是有点粗糙,但很明显它应该没有任何闪烁或延误。

This code is a bit rough obviously but it should work without any blinking or delays.

dragBar = new Sprite();
addChild(dragBar);
dragBitmap = new Bitmap();
dragBitmap.y = 20;
dragBar.addChild(dragBitmap);
dragBar.graphics.beginFill(0xFF0000);
dragBar.graphics.drawRect(0, 0, 800, 20);
dragBar.x = 20;
dragBar.y = 40;
dragBar.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown)

stageWeb = new StageWebView();
stageWeb.viewPort = new Rectangle(dragBar.x, dragBar.y+20, 800, 600);
stageWeb.stage = stage;
stageWeb.loadURL('http://www.google.co.uk/');

private function handleMouseDown(event:MouseEvent):void
{
    dragBar.startDrag();
    dragBar.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
    var bd:BitmapData = new BitmapData(800, 600);
    stageWeb.drawViewPortToBitmapData(bd);
    dragBitmap.bitmapData = bd;
    stageWeb.stage = null;
}

private function handleMouseUp(event:MouseEvent):void
{
    dragBar.stopDrag();
    dragBar.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
    dragBitmap.bitmapData = null;
    stageWeb.stage = stage;
    stageWeb.viewPort = new Rectangle(dragBar.x, dragBar.y+20, 800, 600);
}
阅读全文

相关推荐

最新文章