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
Contributor
Posts: 29
Registered: ‎12-07-2010
My Device: PlayBook
My Carrier: None

StageWebView - anyone else having issues

I have an app that relies on the StageWebView class for the user to log into their account and grant the application access, once this is done it is never used again, but is still an important part of the app. The urls passed to loadURL() are made up of key / value pairs and are quite long and seem to crash the app.

 

I have built a basic browser app to test the StageWebView class and basic urls seem fine but long key / value urls crash.

 

Does anyone know if this is something that is only happening in the simulator and that the release playbook would handle these urls?

 

Thanks

 

Shane

/**********************************************************************/

Playbook apps:
LPlayer

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: StageWebView - anyone else having issues

hey ultravisual,

 

you are not alone. the QNX AIR API has a similar API that is (supposed to be) more compatible than the default StageWebView API provided by adobe called QNXStageWebView. Here's the link to the to a thread that discusses the API:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/API-docs-for-QNXStageWebView/m-p/...

 

you may have noticed that it is an undocumented API and is not fully supported (numerous posts on the forums with user complaints about it). but i think you have a work around that is possible.

 

instead of opening a page from your website your best bet would be to use the URL Loader class along with the URLRequest Class to do the login and get your app access to its data. Below is an example application i created in AS3 utitlizing the URLLoader class to post data just as you would in a form online and then getting a response from the server:

RandomTests.as:

 

package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
import flash.net.navigateToURL;
import flash.text.TextFieldAutoSize;

import qnx.ui.buttons.LabelButton;
import qnx.ui.text.Label;
import qnx.ui.text.TextInput;

[SWF(width="1024",height="600",backgroundColor="#CCCCCC",frameRate="30")]
public class RandomTests extends Sprite
{
private var enterText:TextInput;
private var enterBtn:LabelButton;
private var statusText:Label;
private var loader:URLLoader;

public function RandomTests()
{
enterText = new TextInput();
enterText.setSize(400, 50);

addChild(enterText);

enterBtn = new LabelButton();
enterBtn.label = "Click me to post";
enterBtn.setPosition(410,0);
enterBtn.setSize(150,50);
enterBtn.addEventListener(MouseEvent.CLICK, postData);

addChild(enterBtn);

statusText = new Label();
statusText.autoSize = TextFieldAutoSize.LEFT;
statusText.setPosition(0,100);
statusText.format.color = 0xFF0000;

addChild(statusText);
}
public function postData(e:MouseEvent):void
{
/*
* url:String will store the address to your page online
*/
var url:String = "http://www.rabcore.com/workshop/receivePost.php";
/*
* request:URLRequest is what you send with all your variables
* and data to using the loader class
*/
var request:URLRequest = new URLRequest(url);
/*
* variables:URLVariables will store all the variables you
* want to submit to the webserver
*/
var variables:URLVariables = new URLVariables();
/*
* for every variable you want to send use the
* variables.[variable_name] = "string" format
*/
variables.showMeData = enterText.text;
/*
* add the variables to the request
*/
request.data = variables;
/*
* set the method to POST if you are submitting a form
* type that does not have a URL query string
* set the GET if you want the variables to show up
* up as a url query string (e.g. page.php?showMeData=something)
*/
request.method = URLRequestMethod.POST;

/*
* set up the URLLoader object that will send the request to
* the server
*/
loader = new URLLoader();
/*
* set up a listener to check when the request has been sent and
* received by the webserver using the Event.COMPLETE event
*/
loader.addEventListener(Event.COMPLETE, updateStatus);
/*
* finally send the request to the webserver
*/
loader.load(request);
}
public function updateStatus(e:Event):void
{
statusText.text = "Data has been submitted successfully.";
/*
* remove listeners when done
*/
loader.removeEventListener(Event.COMPLETE, updateStatus);
}
}
}

 

you can get more details about this program from the following thread:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/How-to-post-messages-on-a-website...

 

hope that helps. good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman