Copy link to clipboard
Copied
Hello Fellow Humans Around The World Of Earth!
Before I start I wanna make sure everyone knows, that I'm new to Flash. I'm trying to learn it myself but with a little help from a friend.
Anyway, I'm trying to develop an application for the Android Market for my clan. It should be able to show up a specific url. I have found out that I should use a "command" called navigateToURL.
This is what one of my friends has made but it doesn't seem to work.
<s:ViewNavigator label="Forum" width="100%" height="100%" firstView="views.ForumView" click="openWebsite()"/>
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
protected function openWebsite () : void
{
navigateToURL(new URLRequest("www.goodgamingpeople.com@url"), "_self");
}
]]>
</fx:Script>
I want it to show a website inside the app and not like a pop-up into the person's device's web browser.
If anyone of you have any other idea how to do this, or know what is wrong I would be more than happy to know it! Remember to keep your language clean!
Copy link to clipboard
Copied
You have to use StageWebView, if you want the browse the web within your mobile app,
Here is quick example..
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="title whatever"
viewActivate="init()">
<fx:Script>
<![CDATA[
import spark.events.ViewNavigatorEvent;
protected var webView:StageWebView = new StageWebView();
protected function init():void
{
webView.stage = stage;
webView.viewPort = new Rectangle(0, 0, SETWIDTH, SETHEIGHT);
webView.loadURL(String("http://www.goodgamingpeople.com/"));
addEventListener(ViewNavigatorEvent.REMOVING, onRemove);
}
protected function onRemove(event:ViewNavigatorEvent):void
{
this.webView.dispose();
}
protected function BackBtn_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if (webView.isHistoryBackEnabled)
{
webView.historyBack();
}
else
{
trace("No pages in the browsing history.")
}
}
protected function ForwardBtn_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if (webView.isHistoryForwardEnabled)
{
webView.historyBack();
}
else
{
trace("No pages in the browsing history.")
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
then ofcourse connect your buttons here..
</s:View>
Otherwise the correct code to use for the navigateToURL is.
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
protected function openWebsite () : void
{
navigateToURL(new URLRequest('http://www.goodgamingpeople.com"));
}
]]>
</fx:Script>
Copy link to clipboard
Copied
Hmm... it dosen't quit seem to be working. http://www.mediafire.com/download.php?3pjbpocw8rs3w2u
Copy link to clipboard
Copied
send me a zip. not fxp
im getting a error when i try to import it
WAIT JUST GOT IT OPENED
Message was edited by: soul-mapp
Copy link to clipboard
Copied
Ok.. the example i gave above was only a example
there were parts you need to add and change..
Anyway..try this..
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Server Status">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.events.ViewNavigatorEvent;
protected var webView:StageWebView = new StageWebView();
protected function init():void
{
webView.stage = stage;
webView.viewPort = new Rectangle(0, 20, stage.stageWidth, stage.stageHeight);
webView.loadURL(String("http://www.goodgamingpeople.com"));
addEventListener(ViewNavigatorEvent.REMOVING, onRemove);
}
protected function onRemove(event:ViewNavigatorEvent):void
{
this.webView.dispose();
}
protected function BackBtn_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if (webView.isHistoryBackEnabled)
{
webView.historyBack();
}
else
{
trace("No pages in the browsing history.")
}
}
protected function ForwardBtn_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
if (webView.isHistoryForwardEnabled)
{
webView.historyBack();
}
else
{
trace("No pages in the browsing history.")
}
}
]]>
</fx:Script>
<s:Button click="BackBtn_clickHandler(event)" label="back"
y="7" left="475" />
<s:Button click="ForwardBtn_clickHandler(event)" label="Forward"
y="7" left="556" />
</s:View>
Copy link to clipboard
Copied
Hmm... it still doesn't seem to be working. Or maybe its just the Adobe Air Simulator that can't show it?