开发者

How do I create an HTML "browser" area in Air with ActionScript?

I found this simple example online for how to add an HTML "browser" area in an Air application:

    protected function init():void
    {
        var browser:HTML = new HTML();
        browser.height = 400;
        browser.width = 400;
        browser.x = 10;
        br开发者_StackOverflow中文版owser.y = 10;
        browser.location = "www.google.com";
        addChild(browser);
    }

Only when I run the application, I don't see a browser, but just a blank white area. :/. I'm a total newb, and I suspect I'm missing something "obvious". A little help please?

The only other thing that is in Main.mxlm is the wrapper mx:WindowedApplication, which has mx="http://www.adobe.com/2006/mxml" and creationComplete="init()".

Thanks


Take a look at Flex-IFrame I used it a couple of times.


Turns out, I just needed something like this:

callLater(goToUrl);

where goToUrl is a method that sets the URL instead of something like this:

browser.location = "www.google.com"

Thanks for the help everyone!


Alright, this is a bit stupid and I'm not sure why it does this, but you just need to add http:// in the start of your location. I would of thought it would of gone there by default, but I guess not. Also, if you're using Flex 4, use addElement, not addChild.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜