1
votes

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;
        browser.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

3
Can you provide more code? is this Flex 3 or 4? Flex 4 uses addElement, not addChild. Also, make sure your browser isn't being placed behind something else. - J_A_X
Here, I'll put the entire "Main.mxml", since it is pretty small... I edited the original to contain everything. - Jared Mecham

3 Answers

2
votes

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

1
votes

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!

0
votes

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.