9 Replies Latest reply on Aug 25, 2011 2:12 PM by rachalmers

    StageWebView could not be found

    mattdwm Level 1

      I found an example of stagewebview in help. I just put the code on the first frame. I'm getting an error saying flash.media.StageWebView could not be found. How do I use this?

       

      using Flash Pro CS5

       

      import flash.display.MovieClip;
      import flash.media.StageWebView;
      import flash.geom.Rectangle;
      import flash.events.KeyboardEvent;
      import flash.ui.Keyboard;
      import flash.desktop.NativeApplication;
      
      var webView:StageWebView = new StageWebView();
      
      function StageWebViewExample()
      {
           webView.stage = this.stage;
           webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
           webView.loadURL( "http://www.adobe.com" );
      
           stage.addEventListener( KeyboardEvent.KEY_DOWN, onKey );
      }
      
      function onKey( event:KeyboardEvent ):void
      {
           if (event.keyCode == Keyboard.BACK && webView.isHistoryBackEnabled)
           {
                trace("Back.");
                webView.historyBack();
                event.preventDefault();
           }
      
           if (event.keyCode == Keyboard.SEARCH && webView.isHistoryForwardEnabled)
           {
                trace("Forward.");
                webView.historyForward();
           }
      }
      
        • 1. Re: StageWebView could not be found
          oscartong

          i also have this problem, maybe we need to configure the sdk for flash cs5 somewhere ?

          • 2. Re: StageWebView could not be found
            jonrustad

            Yep, wish I could help.  I dealing with the same thing.  I did download the new AIR 2.6 sdk thinking that might help, but I've tried installing it everywhere, but to no avail.

             

            It will import flash.media.* and flash.media.Video, so I think i'm missing the StageWebView which should be part of 2.6.

            • 3. Re: StageWebView could not be found
              elmonty2 Level 1

              Same problem here. The documentation for StageWebView says that it is in AIR 2.5, which is supposedly supported in CS5.  Is the documentation wrong?

              • 4. Re: StageWebView could not be found
                OMA2k Level 1

                That also happened to me, but I finally solved it. Of course, not thanks to this thread, which I found before finding the solution, but no one ever cared to reply :-(

                 

                In my case, this problem happened because I initially started the Flash Builder project as a "Flash Player" project, and then I changed the "Actionscript Settings" inside Flash Professional to "AIR", but that's not enough.

                 

                When starting an AIR project in Flash Builder it automatically adds the "airglobal.swc" library to the project. If you create a Flash Player project (FB adds "playerglobal.swf" instead) and then change the ActionScript settings to AIR, then you must add "airglobal.swc" manually.

                 

                Just go to Project / Properties in Flash Builder, and then, in the "ActionScript Build Path" section click the "Add SWC..." button and paste this:

                 

                ${FLASHPRO_APPCONFIG}\ActionScript 3.0\AIR2.6\airglobal.swc

                 

                (change AIR2.6 to whatever you have, if you don't use that version)

                 

                That's it! :-)

                 

                OMA

                • 5. Re: StageWebView could not be found
                  jonrustad Level 1

                  Aaaah! I bet that's it. I've moved on to a different project, but will try it when I get back to that one. Thanks for the reply.

                  • 6. Re: StageWebView could not be found
                    rachalmers Level 1

                    I'd say yes, because same problem here. I even pointed directly to the 2.5 version of the swc

                    C:\Program Files (x86)\Adobe\Adobe Flash CS5\AIK2.5\frameworks\libs\air\airglogal.swc

                    ... and no StageWebView

                     

                    For the price of going to CS5.5, I may as well go all out and go to Apple and develp iPhone apps in the native code.

                    • 7. Re: StageWebView could not be found
                      rachalmers Level 1

                      package twitter

                      {

                      import com.swfjunkie.tweetr.Tweetr;

                      import com.swfjunkie.tweetr.events.TweetEvent;

                      import com.swfjunkie.tweetr.oauth.OAuth;

                      import com.swfjunkie.tweetr.oauth.events.OAuthEvent;

                       

                      import flash.display.*;

                      import flash.events.*;

                      import flash.geom.Rectangle;

                      import flash.media.StageWebView;   <<<<<<<<<<<<<<<<<<<<

                      import flash.net.*;

                      import flash.net.SharedObject;

                      import flash.net.SharedObjectFlushStatus;

                      import flash.net.navigateToURL;

                      import flash.system.Capabilities;

                       

                      import org.FlepStudio.Tipper.Scroller;

                       

                      public class TwitterWidget extends MovieClip

                       

                      That's the only import missing in this.

                      However - also have another unsolved issue:

                      private function onWebViewURLChange(e:LocationChangeEvent):void

                       

                      LocationChangeEvent is throwing a 1046:type not found error

                      • 8. Re: StageWebView could not be found
                        OMA2k Level 1

                        Robert.A.Chalmers wrote:

                         

                        For the price of going to CS5.5, I may as well go all out and go to Apple and develp iPhone apps in the native code.

                         

                        StageWebView is not present in AIR 2.5. That's why it doesn't work for you.

                        But you don't really need to upgrade to CS5.5 to use the latest version of AIR.

                         

                        The AIR SDK is free, and you can download it from here:

                         

                        http://www.adobe.com/products/air/sdk/

                         

                        Current version as of now is AIR 2.7.1. The version you're using (AIR 2.5) is pretty old (from last year).

                        The easiest way to use it is renaming the "AIK2.5" folder inside your Flash program folder

                        to something else. Then create a new AIK2.5 folder and place inside the contents of the new 2.7.1 SDK.

                        • 9. Re: StageWebView could not be found
                          rachalmers Level 1

                          Thanks OMA2K,

                          I put it in AIK2.7.1, and pointed the Actionscript library to it. It's found it, but the TwitterWidger thing doesn't want to do it as in for iPhone, so now at least I can experiment with it and hopefully get it working.

                           

                          I'm actually trying to get a really simple thing going here. only the Twitter auth bit is really a handfull.

                           

                          Pseudo code:

                           

                          app is running.

                          user taps [send] button

                          .... first time, user validates login to Twitter. this is stored so not necessary any successive time.

                          ... pre-built message (tweet) is sent to twitter users timeline.

                          return and wait till user presses [send] again

                           

                           

                          I have another version of this TwitterWidger running on the iphone, which uses the PIN authorization method. However, when the web page opens to set and retrieve the authorization pin, the app closes, thus closing the page that is waiting for the pin to be entered.

                           

                          This second version, the PINLESS version - doesn't work at all. It actually just keeps looping.

                           

                          I'm beginning to think it just can't be done on the iPhone, which is a pain.

                           

                          both TwitterApp and TwitterWidget are from http://www.flashmobileblog.com/examples/

                           

                          thanks for the help. Much appreciated.