1 Reply Latest reply on Dec 12, 2012 6:59 PM by joe.coyle

    Need help auto loading a web page when Adobe Air starts up

    joe.coyle

      I would like to create an Adobe Air desktop application that auto loads a web page on startup.  I have found some code that almost does what I want but there is a click event that loads the page and I want the application to auto load the page at startup.  I have already removed the chrome bar so the user cannot closeout, minimize or maximize the window.  I am creating this for computer station that will allow the user to browse a single site and prevent them from getting to the desktop.  This will be a touch screen only computer with no physical keyboard.

       

      here is the code I have so far but I want to remove the TextInput and button.  The only URL I want to load is the one I add to the code.

       

      Any help would be greatly appreciated

       

      Best regards,

       

      Joe

       

      <?xml version="1.0" encoding="utf-8"?>
      <!-- http://airexamples.com/2009/01/03/displaying-web-pages-in-an-html-control-in-an-adobe-air-application/ -->
      <mx:WindowedApplication name="HTML_location_test"
                     xmlns:mx="http://www.adobe.com/2006/mxml"
                     alwaysInFront="true"
                      showStatusBar="false"
                      showFlexChrome="false"
                      backgroundColor="white"
                      layout="absolute"
                      >
      
                <mx:Script>
                          <![CDATA[
      
                                    private function btn_click(evt:Event):void {
                                    html.location = textInput.text;
                                    }
                          ]]>
                </mx:Script>
      
                <mx:ApplicationControlBar dock="true">
                          <mx:Form styleName="plain"
                                               defaultButton="{btn}"
                                               width="100%" borderVisible="true">
                                    <mx:FormItem label="location:"
                                               direction="horizontal"
                                              width="100%">
      
                                              <mx:TextInput id="textInput"
                                                         text="http://MyWebSite.com"
                                                        width="100%" />
      
                                              <mx:Button id="btn"
                                                         label="Go"
                                                        click="btn_click(event);" />
                                    </mx:FormItem>
                          </mx:Form>
                </mx:ApplicationControlBar>
      
      
      
      
                <mx:HTML id="html" />
      
      </mx:WindowedApplication>
      
      
        • 1. Re: Need help auto loading a web page when Adobe Air starts up
          joe.coyle Level 1

          I found the solution I was looking for and I wanted to update my post with the solution.

           

          I now need to figure out how to add a on-screen keyboard.  I have found code that almost does what I want but thise website I am trying to load does not load correctly.  The HTML is not formatted and no images will load.  You can check out this code here: http://www.indieas.org/2009/11/onscreen-keyboard-with-air/comment-page-1/#comment-278

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                   xmlns:s="library://ns.adobe.com/flex/spark" 
                                   xmlns:mx="library://ns.adobe.com/flex/mx"
                                   showStatusBar="false"
                                   alwaysInFront="true"
                                   creationComplete="RunFunction(event)">
                    <fx:Script>
                         <![CDATA[
                                   import mx.events.FlexEvent;
          
                                        protected function RunFunction(event:FlexEvent):void
                                        {
                                               // This function was called after the application had finished being created
                                             // You could run your web page loading here
          
                                                  html.location = 'https://google.com';
                                        }
          
                                  ]]>
                    </fx:Script>
          
                    <mx:HTML id="html"
                       width="100%"
                       height="100%" x="0" y="0"/>
          
                    <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -
                    </fx:Declarations>
          </s:WindowedApplication>