Skip to main content
Known Participant
April 5, 2012
Question

AIR 3.2 StageWebView complete event not working on iPad2

  • April 5, 2012
  • 1 reply
  • 3962 views

I have created a simple test app using Flash CS5.5 and air 3.2 to test the stageWebView functionality however I am having problems getting the Event.COMPLETE to fire. My website loads fine but the  onComplete function is not being called.

Here is my code. I would appreciate if anyone can confirm if there is a bug or if there is a problem with my code.

import flash.media.StageWebView;

if (objApp == undefined) {

          var objApp = new Object();

}

function displayWebsite(e:MouseEvent):void {

          objApp.webView = new StageWebView();

          objApp.webView.stage = this.stage;

          objApp.webView.viewPort = new Rectangle(120, 120, 530, 710);

          objApp.webView.addEventListener(Event.COMPLETE,onComplete);

          objApp.webView.loadURL("http://www.mediakitchen.co.uk");

}

function onComplete(e:Event):void { 

          debugTxt.text = "WebPageLoaded";            

}

function onError(e:ErrorEvent):void {

          debugTxt.text =="Page is not available. Try reloading.";

}

function onChanging(e:LocationChangeEvent):void {

          debugTxt.text =="Loading...";

}

This topic has been closed for replies.

1 reply

Inspiring
April 5, 2012

Everything looks right.

I am using AIR 3.2 and my completes are working.

P StevenAuthor
Known Participant
April 5, 2012

Thanks Applauz78

That is reassuring to know. I will recreate the file in case the file is corrupt or something weird.

Thanks for your help

P StevenAuthor
Known Participant
April 20, 2012

This is still bugging me. Whilst the cut down example did indeed work, when I try this for a video, it does not work. In the following example, I can hear the video playing but I cannot see it. The onVideoLoadComplete function is not being called.

Any ideas why this would work when loading a website but not when loading a video. If I put the  webView.stage = this.stage; where I have commented out, the video displays correctly however I need to display and remove things from my app once the video has completed loading. Is this a bug or am I missing something here? Perhaps there is no way to detect when a video has completed loading? I am packaging with Flash CS5.5 and AIR 3.2

import flash.geom.Rectangle;

import flash.media.StageWebView;

import flash.filesystem.File;

var webView:StageWebView = new StageWebView();

var path:String = new File(new File("app:/video.mp4").nativePath).url;

// webView.stage = this.stage;

webView = new StageWebView();

webView.viewPort = new Rectangle(100, 100, 400, 300);

webView.addEventListener(Event.COMPLETE,onVideoLoadComplete);

webView.loadURL(path);

function onVideoLoadComplete(e:Event):void {

 

          debugTxt.text = "video load complete"; 

          webView.stage = this.stage;

  

}