Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
kartikrustagi
Posts: 7
Registered: ‎02-18-2011
My Device: Not Specified

OpenWindowEvent handler

I was trying to built a simple application which uses QNXStageWebView to display a webpage and the doing a window.open() call from this web page to open another web page (in a new QNXStageWebView): 

 

Html statement:

 

window.open("http://10.140.25.60/page1.html"):

In my event handler to qnx.events.OpenWindowEvent when I try to do a loadURL in the new QNXStageWebView, I get the error that event.url should be non null.

 

Event handler to OpenWindowEvent:

 

private function openTab(event:qnx.events.OpenWindowEvent):void{
	var w2View:QNXStageWebView = new QNXStageWebView("stage2"); 
	w2View.stage= stage;
	w2View.viewPort = new Rectangle(10,100,stage.stageWidth,stage.stageHeight-100);
	w2View.loadURL(event.url);
}

 

 

 

Here is the stack trace:

 

Main Thread (Suspended: TypeError: Error #2007: Parameter url must be non-null.)	
	qnx.media::QNXStageWebView/loadURL [no source]	
	AIRHelloWorld/openTab	
	flash.events::EventDispatcher/dispatchEventFunction [no source]	
	flash.events::EventDispatcher/dispatchEvent [no source]	
	qnx.media::QNXStageWebView/onOpenWindow [no source]	

 

 

 

Here is the addEventListner:

 

wView.addEventListener(qnx.events.OpenWindowEvent.OPEN_WINDOW,openTab);

 

 

Can anyone please help me with this. I will be more than happy to provide any other information. Thanks in advance.

 

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: OpenWindowEvent handler

Usually I'd start debugging by adding a "trace(event)" call as the first statement in the event handler.  If it shows something unusual, work backwards from there to find out why whatever issued the event didn't give it the right url property.

 

Maybe the window.open() call simply isn't hooked up properly yet... this is still an early build, I think.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Contributor
kartikrustagi
Posts: 7
Registered: ‎02-18-2011
My Device: Not Specified

Re: OpenWindowEvent handler

Well I did some debugging but that didn't give me any particular reason for whu event. url is null.

I am new to this whole environment so I am looking for some fundamental mistake which I am making.

 

FYI, the handler to openWindow is getting called (if this wasn't clear from my problem statement.)

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: OpenWindowEvent handler

It was clear that the handler is getting called, which is why I suggested putting trace(event) at the very start of it so you can see with certainty that the correct event is received, with all properties as expected except for the "url" property.  

 

That was, as I said, merely what I'd do to start.  Once I'd seen that, I'd come up with some more options based on the situation.  For example (I haven't looked), if the event in question had additional properties that might be affected by the original window.open() call, I'd try varying them.  Other ideas might come up.

 

You have to remember, when people post here they often have less than half a clue what they're doing.  We who answer have to attempt to guess a lot about their situation.  I've learned not to trust (for people I don't know from past interactions) that the code I see posted is necessarily what they're really running.  For example, people often edit the code they post to remove irrelevant stuff (sometimes a good idea, but only if they are good judges of "irrelevant").  In doing so, they may actually remove a hint of the bug.  By asking you to show the output of trace(event) right at the start of that handler, I eliminate any chance that you're skipping over something critical, either in what you posted or in your own analysis.

 

Anyway, you sound like you have much more than half a clue ;-), so you're probably already able to figure all these things out.  In that case, I suspect the answer lies in one of two areas.  Either having multiple QNXStageWebViews onscreen is a problem (no idea why that would be, or why it might affect your code, but given the nature of the native component involved I wouldn't be surprised), or they simply haven't got the window.open() functionality working in the simulator we've got.

 

I believe the simulator code is not maintained from the latest branch of their development code, but may be months old.  Given that even using navigateToURL() to open a page in the browser itself will not work if the browser is already open, maybe window.open() has similar troubles.. even related ones.

 

Sorry if none of that is of any use to you... for what it's worth, I don't believe anyone here has reported either success or failure with the same operation, so you're in new territory here.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: OpenWindowEvent handler

It "might" be fixed in 0.9.3, but I know from earlier versions that have multiple instances of the qnx web view did not work for me.

Please use plain text.
New Contributor
ptitmi
Posts: 4
Registered: ‎07-18-2011
My Device: Playbook

Re: OpenWindowEvent handler

Hi,

 

I have tested on playbook with OS version 1.0.6.2390, and I can see that the problem (null properties in openWindowEvent) is still there.

 

Do you know when this problem should be corrected ?

 

ptitmi.

 

 

 

Please use plain text.