Problems loading Flex3 swf into AIR app

This is a challenging problem that I have reduced down to the
bare minimum and it is still reproduceable. I have built a minimal
AIR application and added a SWFLoader to it which loads a SWF file
named "Junk.swf" using an absolute path.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" title="Hello World">
<mx:Style>
WindowedApplication {
background-color:"0x999999";
background-alpha:"0.5";
</mx:Style>
<mx:SWFLoader
source="C:/myProjectFolder/renderers/Junk.swf" width="100%"
height="100%" />
</mx:WindowedApplication>
This works fine if I run the application from within Flex3,
however when I build an installer, install the application to my
windows vista system and execute it from the desktop the Junk.swf
will not display. If I replace the Junk.swf with another SWF of the
same name created in Flash CS3 then it will display properly when
my test app is executed from either Flex or the desktop.
The contents of the loaded SWF don't appear to be an issue
since even the simplest of Flex3 SWFs fail to display.
Interestingly when I add listeners to the SWFLoader to
determine if any errors are happening no error events are sent, but
I do receive both the INIT and COMPLETE events which tells me that
the Junk.swf is found and loaded, just not displayed.
Any assistance or even ideas that I could try would be
appreciated.

that's why i added those comments about the swf's domain.  for locally loaded swfs, use:
SFMltd wrote:
Hi Kglad, Thanks for the Example.
if i run my class with securityDomain = SecurityDomain.currentDomain; then it throws this error: SecurityError: Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property.
The swf file im trying to load is stored locally so i guess this error makes sense. However if i comment out that line i get the same "cannot access Stage owned by app" error?
See below for class:
package  {
  import flash.display.MovieClip;
  import flash.filesystem.File;
  import flash.events.Event;
  import flash.net.FileReference;
  import flash.events.MouseEvent;
  import flash.display.Loader;
  import flash.net.URLRequest;
  import flash.system.LoaderContext;
  import flash.system.ApplicationDomain;
  import flash.system.SecurityDomain;
  public class assetPreview extends MovieClip {
  private var loader:Loader;
  private var mainSWF:MovieClip = new MovieClip();
  public function assetPreview() {
  addEventListener(Event.ADDED_TO_STAGE, initialise);
  public function initialise(e:Event):void
  removeEventListener(Event.ADDED_TO_STAGE, initialise);
  var allowSWF:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain);
// allowSWF.securityDomain = SecurityDomain.currentDomain;
  loader = new Loader();
  loader.load( new URLRequest(settingsXML.pathToSWF),allowSWF);
  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, viewPreview);
  public function viewPreview(e:Event):void
  addChild(mainSWF);
  mainSWF.addChild(loader);

Similar Messages

  • Loading external swf into Air App

    Hi All,
    I'm building an Adobe Air App for desktop and am having problems loading an external swf. Every time i try to load i get:
    SecurityError: Error #2070: Security sandbox violation........ cannot access Stage owned by app....blah blah
    The file that is being loaded is in a local directory, but as i understand its in a different 'sandbox' which is a security risk.
    Is there any way around this?!
    Any help would be much appreciated
    Many Thanks
    Matt

    that's why i added those comments about the swf's domain.  for locally loaded swfs, use:
    SFMltd wrote:
    Hi Kglad, Thanks for the Example.
    if i run my class with securityDomain = SecurityDomain.currentDomain; then it throws this error: SecurityError: Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property.
    The swf file im trying to load is stored locally so i guess this error makes sense. However if i comment out that line i get the same "cannot access Stage owned by app" error?
    See below for class:
    package  {
      import flash.display.MovieClip;
      import flash.filesystem.File;
      import flash.events.Event;
      import flash.net.FileReference;
      import flash.events.MouseEvent;
      import flash.display.Loader;
      import flash.net.URLRequest;
      import flash.system.LoaderContext;
      import flash.system.ApplicationDomain;
      import flash.system.SecurityDomain;
      public class assetPreview extends MovieClip {
      private var loader:Loader;
      private var mainSWF:MovieClip = new MovieClip();
      public function assetPreview() {
      addEventListener(Event.ADDED_TO_STAGE, initialise);
      public function initialise(e:Event):void
      removeEventListener(Event.ADDED_TO_STAGE, initialise);
      var allowSWF:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain);
    // allowSWF.securityDomain = SecurityDomain.currentDomain;
      loader = new Loader();
      loader.load( new URLRequest(settingsXML.pathToSWF),allowSWF);
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, viewPreview);
      public function viewPreview(e:Event):void
      addChild(mainSWF);
      mainSWF.addChild(loader);

  • Problem loading one SWF into another in Flash AS3

    I am trying to load an SWF file in another SWF file. The child SWF file works fine when run standalone like if I set visibility of an item to true or false, it works fine. But when the SWF is loaded into a parent SWF, I am not able to execute such commands, neither I get any errors...

    are both swfs as3 swfs?
    is the code in the loaded swf and is that code referencing objects in the loaded swf?

  • Can I load a swf into my Flex app that loads other swf's?

    The code below loads an AS2 swf into my Flex mobile for IOS app and it works.  If that AS2 swf has like a circle in it that runs across the stage, it loads and displays properly when run in FlashBuilder.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     initialize="init()">
              <fx:Script>
                        <![CDATA[
                                  import mx.core.UIComponent;
                                  private var request:URLRequest = new URLRequest("http://PATH_TO_AS2_SWF");
                                  private var loader:Loader = new Loader();
                                  private var myComponent:UIComponent = new UIComponent; 
                                  private function init():void{
                                            myComponent.percentHeight = 100;
                                            myComponent.percentWidth = 100;
                                            loader.load(request);
                                            myComponent.addChild(loader);
                                            player.addElement(myComponent);
                        ]]>
              </fx:Script>
              <s:Group id="player"
                                   height="100%" width="100%"/>
    </s:Application>
    But if that AS2 swf loads other swf's, they don't load or display.  My FlashBuilder debugger reports no errors or security sand box violations.   I'm using the most elemental code in my AS2 swf so as to not cause problems.  This is it in its entirety:
    this.onLoad = function(){
              _root.loadMovie("http://[PATH_TO_REMOTE_SWF]");
    The paths to the remote content are fine because swf's load and display fine from AS2 swf when run on it's own - not embedded in Flex app.  They also load and run fine if I cut out the AS2 swf and access directly from my Flex code.  So I know there isn't a path issue.  More likely not accessing the right layer in the AS2 swf from Flex or something.  Or maybe security sandbox violation but I don't see anything reported in the FlashBuilder debug console.  When run console just reports:
    [SWF] SwfMobile.swf - 2,639,761 bytes after decompression
    [SWF] assets/swf/AS2.swf - 1,470 bytes after decompression
    Is there something inherently wrong with loading swf's that load other things?  Even if I have the AS2 swf load jpgs they don't load so the format of the target content at the end of the chain doesn't seem to be the issue.  Just the act of embedding a swf that loads other things seems to be the problem.

    Ah, yes. Using an AVM1 SWF could prove difficult...
    I'm going on about 3 hours of sleep at the moment, but let me toss out a few thoughts I have and hopefully something will stick...
    Ok, so my first thought what to try and cast the loaded content as a MovieClip and call methods on that, but the fact they are AVM1 throws that out the window.
    That leaves LocalConnection, as you mentioned. But this would require you to have code on the receiving end to handle the connection... no good either.
    But what if you created a "bridge" in AS2 that holds all the code for the receiving end of LocalConnection (or has the control logic itself, perhaps even eliminating the need for LocalConnection all together!). I think maybe this is what you were trying to do already by loading a SWF into a SWF? Well instead of loading your bridge at runtime, what if you statically linked it into your project as a class?
    *a few moments later*
    Well it looks like you can in fact link in a a symbol created for AVM1, but it will only come in as a SpriteAsset, and will not include any custom code (which makes sense, since they use entirely different class constructs).
    To do the test, I created a symbol exported for actionscript (AS2/Flash8), then linked it in with a CSS style embed. I then instantiated the class and called describeType on it.
    So in summery, it looks like calling custom code on the bridge is out (I did not test this extensively, that was just my first impression with this simple test). However, if you may be able to perform the actions you need by attempting to cast the loaded content into something AVM2 can recognize. Apparently it does this automatically when linked in statically, so maybe there is something there worth looking into... mainly, can you do what you need using only the base class and no custom code?
    Keep me posted!

  • Load AS2 swf into AS3 swf problem

    I have a flash with AS3 and inside this swf i load in a AS2 swf.
    to load swf works just fine, but the problem is when i load this i want to go to
    a specific part of it, for example i want to go to frame 3 in the loaded swf.
    i must control this from the AS3 swf, does someone know if this is possible?
    thanks in advance

    so can i do like this then to go to frame 3 in my loaded swf?
    MovieClip(ldr.content).gotoAndStop(3); ?
    sorry for being such an airhead
    thanks for helping me out =)
    Date: Sun, 7 Jun 2009 10:25:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: load AS2 swf into AS3 swf problem
    no.
    if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
    MovieClip(ldr.content).f1();   // to call f1() in the loaded swf
    >

  • Loading external swf in AIR

    In AS3 this would load loadme.swf into my holding mc
    (contentmc) provided both the holding swf and loadme.swf are in the
    same directory
    var loaderMC:Loader=new Loader();
    loaderMC.load(new URLRequest("loadme.swf"));
    contentmc.addChild(loaderMC);
    But it does not work in AIR. Any reason why? what am i
    missing out or is there a new way to do it?
    thanks
    Murtaza Topiwalla

    What if you don't want the external swf to be packaged in the
    air file? I want the air file to pull the swf from the http, as it
    does with jpegs:
    Yay, this displays the jpeg
    loaderMC.load(new URLRequest("
    http://mywebsite.com/loadme.jpg"));
    Same code but it doesn't display the swf:
    loaderMC.load(new URLRequest("
    http://mywebsite.com/loadme.swf"));

  • How to Load an SWF into the Parent SWF

    Hi all,
    I have 3 SWFs.
    X.SWF - Parent application. Contains an empty movie clip for
    loading external swfs using loadClip() method.
    B.SWF - Has some text and pics. Gets loaded into the empty
    movieclip on X.SWF. Also has a button saying 'Load A.SWF'.
    A.SWF - Similar to B.SWF with a button saying 'Load B.SWF'.
    When I start the main application (X.SWF) and load B.SWF into
    it all is fine.
    But would like to click on the 'Load A.SWF' button on B.SWF
    and load A.SWF into X.SWF. And visa-vesa.
    The problem is I'm not able to refer to the parent container
    (X) from these child (A and B) SWFs.
    Is there any way to do this?
    Thanks

    First if you use
    Button.onPress=function(){
    this._parent.loadMovie();
    the movie try to load swf into B.swf because "this" mean the
    button.Try with more ._parent or just if you X.swf is into the one
    MovieClip in 1st stage _level0.SWF.loadMovie();.Also if you want to
    load the A,B.swf into the stage simultaneously just create two
    movieclips into the X.swf mcA and mcB and the path has gone to
    _level0.SWF.mcA.loadMovie("A.swf"); :)

  • Converting the web app into AIR app leads errors

    Hi all,
    I am new to flex, i am trying to convert a web app into air app.
    I changes the tags and when i complie i get the below 3 error popups with dismis and continue buttons on the bottom right..
    Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
    Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    Any help would be greatly appreciated.
    Thanks in advance.

    Thanks peter.
    commenting those lines avoids the first 2 errors but still i am getting the below errors.
    this is a microstrategy flex project.
    Error #1009: Cannot access a property or method of a null object reference.
    at com.microstrategy.web.vf.viewer::MstrWindowedApplication/handleCreationComplete()[Z:\Flex \projects\VisFrameworkAIR\src\com\microstrategy\web\vf\viewer\MstrWindowedApplication.as:9 9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
    at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as :1169]
    at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:718]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
    at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]

  • Flash player 10.3.181.14 broke my site, loading multiple swfs into an array

    I load multiple swfs into an array, I add and remove the objects on the stage, this is for a rotating carousel.
    All the items locations are established in xml. If I only have one item loaded into the array it works fine, if I have more then one it will not a) play the swf, or b) show the swf.
    The swfs themselves contain code that fire events in the main container. Which cause other items to play or load.
    Is anyone else having this issue?

    Hi howet,
    EDIT:
    I've opened a flash bug in their bug system as I found I could reproduce the issue: https://bugs.adobe.com/jira/browse/FP-7071
    There are some workarounds I found on there.
    ORIGINAL MESSAGE:
    I was having a similar issue using a loading component which i've been using for several years with no issues. As with you the issue arose when loading multiple swfs (or even one swf and then a jpg) on 10.3 and above. It works fine on 10.2 and below still.
    I found a workaround whilst I look for a proper answer and that is to delay subsequent loads using a hacky setTimeout.
    For example:
    protected function manageLoaded (p_event : Event) : void {
    setTimeout(loadNext, 1);
    // following line breaks the gotoAndStop of loaded swfs.
    // loadNext();
    I hope this helps you too, let me know.
    Cheers,
    Dan.
    Message was edited by: Dan Wilkinson, 01/06/2011 11:37am BST (GMT + 1)

  • Weird Problem trying to sign into my App Store Account ?  Please Help !!

    Im having a very weird problem trying to sign into my App store account to update my apps and to purchase new Apps. Ive tried to search the net but I cant seem to solve my problem.
    Here is whats happening
    My Email address is correct in my iTunes Account and also my App Store account. (which is basically the same anyway)
    The problem I am having Is that when I try to download an App my old email address still shows up when it requests my password.
    The weird part is that my email address is correct in my itunes and also at the bottom of my app store. Yet my old email is showing up when I try to sign into the App store.
    Here are the steps Ive taken already to fix this problem and have failed.
    I have signed out of my itunes and app store and signed back in..FAILED.
    I went into my setting -STORE and signed out and back in..FAILED.
    I dont understand why my old email is still showing up when I try to sign in to update or download an App !!!!
    PLEASE HELP !!!

    I dont understand why my old email is still showing up when I try to sign in to update or download an App !!!!
    Apps are DRM protected & tied to the account that was used to originally purchase them. Were these apps purchased using your old account details?

  • There is problem loading the outline into the memory, error # 1,250,005

    Hello,
    I am getting error message when opening ASO outline on edit mode in EAS 7.1.5 version. EAS server using weblogic and MYSql.
    Error Message:
    There is problem loading the outline into the memory, error # 1,250,005.
    Please let me know if any have experienced same issue or any suggestions.
    Regards,
    DS

    That error is documented as:
    ##1250005 Error [%s] Creating Environment For Outline Paging File: %s
    It sounds like it may be an issue with your temp directories (disk space?) as I believe it is going to copy the outline to a temp directory locally before opening it. That is where I would start looking..
    Tim Tow
    Applied OLAP, Inc

  • I am having problems loading sampler patches into the exs24 sampler, when i got into edit menu and load multiple samples all the samples r greyed out and i cannot slect them, any help with this would be much appreciated

    I am having problems loading sampler patches into the exs24 sampler, when i got into edit menu and load multiple samples all the samples r greyed out and i cannot slect them, any help with this would be much appreciated

    It is very difficult to offer troubleshooting suggestions when the "os version" you are using is unknown as each os has their own troubleshooting solutions. 
    How large is your hard drive and how much hard drive space do you have left? 

  • [ISSUE] Load external .swf into an AIR for iOS app

    I want to load an external .swf which is included theme objects of the application. The loader class finishes loading but after this when I try to get objects in the swf I get this error.
    Device is iPad v.2 iOS v5.1.
    ReferenceError: Error #1065: Variable MenuHome is not defined.
        at adaptive.controls.thememanager::ApplyTheme/applyStyle()[D:\ConsumerProductInterface\Consu merProductBusiness\src\adaptive\controls\thememanager\ApplyTheme.as:41]
        at adaptive.controls.thememanager::ApplyTheme/apply()[D:\ConsumerProductInterface\ConsumerPr oductBusiness\src\adaptive\controls\thememanager\ApplyTheme.as:54]
        at adaptive.controls.thememanager::ThemeManagerSystem/checkIfAllLoaded()[D:\ConsumerProductI nterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeManagerSystem.as: 139]
        at adaptive.controls.thememanager::ThemeManagerSystem/backgroundImageLoadHandler()[D:\Consum erProductInterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeManager System.as:119]
        at adaptive.controls.thememanager::ThemeManagerSystem/backgroundImageLoadHandler()
        at flash.events::EventDispatcher/dispatchEvent()
        at adaptive.controls.thememanager::ThemeManagerImageLoader/loadImageCompleteHandler()[D:\Con sumerProductInterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeMana gerImageLoader.as:60]
        at adaptive.controls.thememanager::ThemeManagerImageLoader/loadImageCompleteHandler()
        at flash.events::EventDispatcher/dispatchEvent()
        at adaptive.controls.imageloader::ImageLoader/imageCompleteHandler()[D:\ConsumerProductInter face\ConsumerProductControls\src\adaptive\controls\imageloader\ImageLoader.as:32]
        at adaptive.controls.imageloader::ImageLoader/imageCompleteHandler()
    Steps are:
    1- Create a .fla file and one object in it (like below):
    2- In Flash Builder 4.6
    Load the external swf:
                    var swfLoader:Loader = new Loader();
                    var url:URLRequest = new URLRequest("themes/DefaultTheme/DefaultTheme.swf");
                    var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
                    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                    swfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
                    swfLoader.load(url, loaderContext);
            private function completeHandler(event:Event):void
                var evt:LoadThemeSWFEvent = new LoadThemeSWFEvent(LoadThemeSWFEvent.COMPLETE);
                if (AdaptiveHelper.getInstance().platform == PlatformType.DESKTOP)
                    evt.swfLoader = SWFLoader(event.currentTarget);
                else
                    evt.loader = Loader(event.currentTarget.loader)
                dispatchEvent(evt);
              // load is OK
            private function ioErrorHandler(event:IOErrorEvent):void
    After load is complete I tried to get the object from the swf file and use it as a skin class of a button.
    cssSelector.setStyle(property, Class(content.loaderInfo.applicationDomain.getDefinition("MainMenu")));
    I am stuck here. Any ideas what the problem is?
    My Best,
    Suat

    Hi Suat,
    Can you send me a sample application  @[email protected] with which I can reproduce your problem and can look into the issue?
    Thanks,
    Nimisha

  • Loading a Flex3 SWF into an AS3 SWF

    I have an AS3 shell project which bootstraps my application
    by loading several other AS3 and Flex3 SWFs. The problem I am
    seeing is that tooltips in the Flex3 SWFs never show up. The events
    trigger properly but they simply never appear. Anyone know how I
    can get this to work?

    Anyone?

  • Load external swf into a specific _level

    Hi there,
    I am loading an external swf into the mc 'image' using:
    image.loadMovieNum("portfolio/100_design/1.swf", 1);
    Every time a new image loads, I want it to load the level above, ie:
    image.loadMovieNum("portfolio/100_design/1.swf", 2);
    Is there a way this can be done dynamically. For example, "current level + 1"
    Many thanks

    is the first frame of your loaded swf's empty?  if yes, then no problem using _levels.
    if not, do you mind a momentary flash when your next swf loads and before its _alpha is assigned 0 and then faded-in?  if you don't mind, then no problem using _levels.
    if you do mind that momentary flash, then using _levels will be more complex than using empty target movieclips.  is there some good reason to use _levels instead of target movieclips?

Maybe you are looking for

  • Exporting direct from FCP vs. sending to Compressor?

    I've done both, but the choice ends up being a coin toss. So I'm curious if there's any accepted wisdom as to the Pros & Cons of each workflow (using the current versions of each app, and in a hypothetical All Things Being Equal scenario)? In other w

  • How to get MenuBar's size?

    I need to set the position of components on a page that contains a MenuBar, but MenuBar does not provide a getPreferred size method. How can I get the MenuBar's size? Thanks.

  • Can I use iPhone 5 in Bangladesh?

    All over the Bangladesh, only sim cards are available for communications but i've heard that iPhone 5 does not work in sim cards. therefore I can not use it in Bangladesh. I want to get a clear idea about this.

  • Applet using sockets works perfectly under Netscape but not under IE

    I have setup a java applet compiled with Sun Forte which implements a connection with a server application with sockets. The applet works perfectly on the same machine when it is loaded from netscape communicator but I receive an com.ms.security.Secu

  • Webservice Issues

    Hi all, I did a scenario, Integrating webservices to that of a data base, and it is working fine which is pretty straight forward scenario. I just want to know the usual/common/typical problems we face when we are making use of the webservices and th