Load SWF inside naviteWindow [AIR]

Hello,
I have an AIR application where I have to load a SWF from a server.
At some point the user will click on a button and that button will create a new nativeWindow.
Inside that nativeWindow we have a stage reference.
I just want to load a SWF, addChild it to the stage and be happy!  :-P
But I'm getting this error:
SecurityError: Error #2070: Security sandbox violation: caller http://somewhere.com/swfapp.swf cannot access Stage owned by app:/Teste.swf.
at flash.display::Stage/get stageWidth()
at com.swfapp::MainClass/initApp()
at flash.display::DisplayObjectContainer/addChild()
at flash.display::Stage/addChild()
at NativeWindowSWFLoader/loadSWFURLComplete()[C:\Users\hats\Desktop\teste\NativeWindowSWFLoader.as:93]
I'm using a normal Loader:
private function loadSWFFromURL():void
          var context:LoaderContext = new LoaderContext();
          context.applicationDomain = ApplicationDomain.currentDomain;
          context.securityDomain = SecurityDomain.currentDomain;
          context.allowLoadBytesCodeExecution = true;
          context.allowCodeImport = true;
          loaderSWFURL = new Loader();
          loaderSWFURL.contentLoaderInfo.addEventListener(Event.COMPLETE, loadSWFURLComplete);
          loaderSWFURL.load(new URLRequest(urlSWF));
private function loadSWFURLComplete(e:Event):void
              //var loaderInfo:LoaderInfo = LoaderInfo(e.target);
              //var byteArray:ByteArray = loaderInfo.bytes;
               this.stage.addChild(loaderSWFURL);
Can someone hep me on this?
Thank you.

Hi,
I've recently come across the same problem. I really need some advice and help.
I was able to load a swf with htmlLoader in a nativeWindow. The swf is a URL base.
On Windows works without any problem but on mac it doesn't show anything.
I ran scout to check if the traces on the swf appear and for my surprise they show on scout but the native window screen in totally white. I really have search everywhere and i can't find an answer.
Any ideas?
I'm running with a retina mac (latest model).
Best regards and thanks.

Similar Messages

  • Controlling loaded SWF inside a child

    Hello to everyone, may this question be too obvious to
    everyone, but I've been googling for hours without any luck.
    Have seen examples but they are not exactly as my scenario...
    Please, I need some help.
    I have loaded a SWF and attached to a MovieClip which exist
    in my current movie using the following code, and now I just want
    to access the loaded SWF to send it orders like play() or
    gotoAndPlay(); I have tried also: container=
    MocieClip(loader.content); instead adding child, but it trhows an
    error

    //this is your minimum code to load a file
    var url:String = "put your url here ";
    var request:URLRequest = new URLRequest(url);
    var loader:Loader = new Loader();
    loader.load(request);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadComplete);
    function loadComplete(event:Event):void {
    addChild(loader.content);
    //you don't need all that code just concentrate on the bit
    you need; when this work then you can start putting the rest

  • Loading SWF's in AIR for iOS

    Hi,
    I am working on a project in AIR for iOS.  It's great that we as flash developers are now able to compile our actionscript code for iOS.
    The project i'm working on is divided in different SWF-files.  There is one master SWF file that loads the others when needed.
    Now i can't get loading of a swf file actually working.  The only thing i see is the background of the child being displayed, but then the program freezes and no actionscript code of the child gets exectuted.
    The children swf's are loaded with a simple Loader:
    var loader:Loader = new Loader();
    childLayer.addChild(loader);
    var url:URLRequest = new URLRequest("child.swf");
    loader.load(url);
    When i publish the master swf file i include the children swf files in the package.
    Is it actually possible to use multiple swf's in your iOS projects?
    And what are the limitations for this?
    Thanks.
    greeting,
    Bert

    You can control your external swf from your main.swf in the following method:
    loadswf(clips[0]);
    function loadswf(tmp:String):void{
        passedString=tmp;
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(animPath+tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        switch(passedString){
            case clips[0]:
                if (num==1) mcExt.play();
                if (num==9) {
                   mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                    function skipfn(e:MouseEvent):void{
                        mcExt.stop();
                       mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                        gotoAndStop("help");
                if (num==mcExt.totalFrames){
                   mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
                break;

  • Load SWF file from AIR library module.

    Hi,
    I am writing a testing agent (record and playback agent) for Flex applications.
    Here, I am required to load a SWF object (in a new window) from a AIR module library.
    And then I need a handle to the newly opened SWF so that I can perform testing operations on it.
    How can I accomplish this. Any links or sample code is welcome.
    Thanks,
    Pradeep.

    10.0.1 is very old, we're on 11.2 now.  Do you know about when this started breaking for you?  I'd suggest two things.  First, you might want to post over on the Flash Pro forums as there's a larger developer audience there and someone might have a quick answer for you.  Next, you might want to open a new bug at bugbase.adobe.com.  Please include detailed steps to reproduce, along with a link to your site and / or sample code so we can test this internally.

  • CPU/Memory Usage increases when loading SWF files in AIR.

    Hi,
    We face the below mentioned problem. Would be great if someone could help us.
    Due to problems with uploading the attachment here, please send a email to the following email-id ([email protected]) and I shall send the attachment in response.
    CPU/Memory usage increases drastically while moving the SWC components and loading the SWF Files.
    "Problem Description" - On executing the sample application, a window with multiple objects is shown. The loaded SWC components in flex consume too much Memory and CPU cycles. This is visible in TaskManager. On dragging one of the object, CPU  / memory usage increases drastically.
    "Steps to Reproduce" -
    Draggable window is placed at the bottom in the sample application with Text indication.
    Drag the indicated window.
    "Actual Result" - System's CPU usage increasing drastically  around 50% to 60 %.
    "Expected Result" - Drastical increase in memory\CPU should not occur.
    "Any Workarounds" - No"
    Thanks in advance.

    You can control your external swf from your main.swf in the following method:
    loadswf(clips[0]);
    function loadswf(tmp:String):void{
        passedString=tmp;
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(animPath+tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        switch(passedString){
            case clips[0]:
                if (num==1) mcExt.play();
                if (num==9) {
                   mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                    function skipfn(e:MouseEvent):void{
                        mcExt.stop();
                       mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                        gotoAndStop("help");
                if (num==mcExt.totalFrames){
                   mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
                break;

  • Loading flash 8 SWF in adobe AIR, loses the stage width in flash 8 SWF

    Currently i am using a CS3 IDE to compile AIR application.I
    am trying to load the flash 8 SWF inside my AIR application.After
    loading the SWF, when i try to trace the stage width inside the
    flash 8 SWF , it says undefined.Not sure why..
    Googling few hours not able to get the solution.
    Please help me on this, urgently needed.
    Thanks in advance

    This is a fairly common question on these forums. Basically,
    AS2 and AS3(Flex/AIR) can't communicate directly. You will either
    need to use LocalConnection or use ExternalInterface and javascript
    to pass info between the 2.

  • SwfLoader cause Browser to crash when we change loaded swf multiple times..

    Hi Everyone,
    I'm developing a Flex application now, and inside my application I am using SWFLoader which will be used to load other .swf file.
    The SWFLoader is working, but after I change the .swf file so many times(around 20 times), the application always cause the browser to crash and shutdown automatically.
    I suspect this is because of the SWFLoader. If we change the loaded swf inside SWFLoader, it won't remove the old one from memory automatically.
    This is my simple code to change the loaded swf inside SWFLoader :
    public var applicationLoader : SWFLoader;
    public function loadApplication(appName : String) : void {
         if(loadedApplSysManager != null) {
              var currentApplication : AppInterface = loadedApplSysManager.application as AppInterface;
              if(currentApplication != null) {
                   currentApplication.applicationStateComplete(); // do something inside small app before unload
         // try to set everything to null, so GarbageCollection is called ..
         applicationLoader.source = null;
         applicationLoader.load(null);
         var applicationUrl : String = applicationDict[appName];
         var urlApp : String = path + applicationUrl + "?noCache=" + version;
         applicationLoader.source = urlApp;
    btw, I am also using Cairngorm command in every small application and some RSL..
    Has anyone ever experience the same thing and have any suggestion?
    How can we handle the SWFLoader properly, the loading and unloading process?
    Any suggestions will be appreciate..
    Thanks,
    Andre

    Here are four links related to this topic:
    http://blogs.adobe.com/aharui/2007/03/garbage_collection_and_memory.html
    http://blogs.adobe.com/aharui/2008/09/using_the_flex_builder_3x_prof.html
    http://blogs.adobe.com/aharui/2009/05/more_on_finding_memory_leaks.html
    http://blogs.adobe.com/aharui/2009/08/what_we_know_about_unloading_m.html

  • [advance question] loading a swf in adobe Air, which loads an image with "componentloader"

    Good evening all,
    I think this is a complex issue.
    I have adobe air application which loads a SWF I made.
    Inside this SWF I have used the "component LOADER" to load
    something with "ContentPath=image.jpg" for example.
    But the swf loaded in the Adobe air works, but does not load
    the "ContentPath image"...
    (it does load and display it when it this swf is run outside
    adobe Air)
    I need it to be dynamic like this, so if eventually I Include
    it in the package it won't help much...
    I just intend to replace an image background from this loaded
    swf file!
    Thanks!
    Edit:
    At this time of the editing, I fear and realize
    something....I have been using Actionscript2 for the .SWF file,
    could it be why it does not works???
    If its problematic, is there a simple way like telling it to
    read actionscript2, rather than transforming everything??
    edit2:
    I found this on the official AIR FAQ:
    Will Flash version 8 and below SWF files run in Adobe AIR?
    Yes. However, the Adobe AIR APIs are only exposed to Flash
    content via ActionScript 3 / AVM2, and thus Flash 8 / AVM1 SWFs
    will be able to run, but they will not have direct access to the
    Adobe AIR APIs.
    source:
    source
    faq Adobe
    it seems it should works!!??
    Edit3:
    nope I confirm at least some code made in Actionscript2
    works.
    I am sure this code needed to be changed for working in
    actionscript3, so "actionscript2" code works in Adobe Air.
    The problem of not loading my image must come from something
    else!!??

    Good Morning all!
    Hilarious....
    I tried so much to think maybe Adobe Air does not like a SWF
    using actionscript2, or it does not load any "external image from a
    swf", etc...
    None of that!
    I just in FLASH in the ComponentLoader....I did put simply
    the ContentPath at "myimage.jpg"....
    Of course I had to use the absolute path like
    "c:\\myfolder\\myimage.jpg"
    Of course aswell it works now!!!

  • Load and resize a SWF inside a MC

    Hi,
    I'm using AS2 to load an SWF inside an MC. The MC measures
    800x600, while the SWF (which can vary in size) measures in this
    case 14x60, even though, looking at it, it seems to be about half
    the size of the hosting MC. This makes me think that the dimension
    scales are different. I'm loading the SWF using MovieClipLoader and
    I'd like to resize it so that it fits as proportionally snug as
    possible within the MC. How can I do this? If I try to resize the
    SWF to the MC's dimensions, it become way too large and goes off
    screen. If instead I try to rescale the hosting MC to fit around
    the SWF, the SWF itself rescales as well. I'm going nuts! How can
    accomplish this?
    Thank you,
    Tatiana

    To make things simple, I'd like to take an existing SWF (the
    picture) and load it into a FIXED SIZED MC (the frame) and I'd like
    to rescale the SWF so that it fits perfectly into the frame.
    By all means, I know that what you said should work and I
    admit my inexperience with AS2, but somehow the SWF's I'm loading
    in, have scales that are totally different with respect to my
    Stage. I even tried loading the SWF directly onto the stage and
    then I loaded the frame separately onto the stage and tried to
    resize it to the SWF's _width and _height. The frame became a tiny
    dot on the screen, while the SWF filled half of my Stage.
    Thanks again for your help.

  • Loading a SWF inside another SWF question

    Hello friends,
    1. (IMPORTANT) As all we know when putting some Flash SWF
    inside an HTML page, normally it starts playing as soon as its
    first frame is loaded.
    Now in my case I have to load a SWF (let call it Flash A)
    inside another Flash, I used mx.controls.Loader control to do this.
    But this internal loaded SWF (Flash A) doesn't display untill it is
    completely loaded. Although what is interesting is that if it
    contains a sound track I can hear it while it is being loaded.
    I wana know is there any way that we can make this Flash
    display while being still loaded.
    2. Is there anyway to change a Flash playback FPS at runtime?
    Thank you so much for any note and help.
    - M

    damatrixhasu wrote:
    > i want to know how i can load a flash inside another
    flash container
    go to help - search for 'loadmovie'
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Using Webkit inside of AIR to load in PHP

    Hello,
    We have a game that we are developing for tablets that we are porting over from a browser based Flash game. In that game, there is a link to a PHP script that loads in player information and displays it on a web page. We would like to be able to reuse this functionality without having to rebuild it all in Flash for AIR. I know that AIR has Webkit support built in but I'm having a hell of a time finding out if it can display a web page from inside the application, rendered with PHP. Also I'm having trouble finding any information on how to actually use Webkit inside of AIR, other than an old mx:HTML component. Any help on this would be much appreciated.

    While it is possible to serve local html files to an instance of a StageWebView, it is not running as a server. Thus, your PHP code will NOT execute. You can display the html that lives on your server, since you are haing the user sign, some form of network access is need. You could look at using the SQLite DB to save the user information, so you could enable offline playability, then sync the data once there is a connection.
    Here is something I wrote on using SWV and Google Maps. Maybe you can find it useful: http://chrisgriffith.wordpress.com/2011/01/04/integrating-maps-into-your-mobile-applicatio n/
    Good luck,
    Chris Griffith

  • Loading swf files from an iPhone Air App

    Although the faq says its possible ( http://bit.ly/gyxmCo  )  I can't seem to load .swf files from my app.
    There's no .AS code in the .swf file I'm trying to load.
    PNG files load with no problems, swf's fail.
    A working example would be appreciated instead of suggestions, I've spent the entire day trying out suggestions
    regards,
    Martijn

    Because I can't see any library assets in an as2.0 file.
    I've discovered that the swf fails to load as soon as you make a symbol 'export for actionscript'
    probably because it will then create a class. So you can only load SWF's as simple pictures or animations, you cant use it as an asset library with multiple animations/images/sounds in it..
    As for you other questions:
    it doesnt matter if the file is local or on the web. same results
    I created the swf file from a fla in CS4,  and I'm compiling my air project that loads the swf  with FlashDevelop.

  • AIR crashes on loading swf with 'Imported for runtime sharing' fonts

    Hello everybody,
    I have a trouble with an AIR application developped with Flex but the error seems to come from the Flash/AIR, after some searches a staff member (Flex harUI) said me that I could find more help for my trouble here.
    I'm developping an AIR application which loads an external swf. This swf contains 'Imported for runtime sharing' fonts from another swf to reduce its size.
    When the AIR application has finished to load (see message below) the whole application crashes without giving any error message except the usual "Process terminated unexpectedly" error message.
    End Loading: [SWF] C:\Users\dev02\myProject\index.swf - 83,930 bytes after decompression
    Error Message:
    Process terminated unexpectedly.
    Launch command details:  "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.6.0\bin\adl.exe" -runtime "C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.6.0\runtimes\air\win" "C:\Users\dev02\Adobe Flash Builder 4\Languages_Editor\bin-debug\Language_Editor-app.xml" "C:\Users\dev02\Adobe Flash Builder 4\Languages_Editor\bin-debug"
    I use Flash Builder 4 (build 272416) with sdk 4.6.
    Full discussion here.
    I tried to load the external swf with the most basics codes, it works with a Flash web app but not with a Flex/AIR app or a Flash/AIR app.
    Thanks for the help !

    Thanks for the anwser.
    In fact, I cannot specify a swc because my main application is an editor of sub-applications where each one has its own library.
    The bug remains when sharing a simple MovieClip too.
    Maybe, if I explain my project it will be a little more clear.
    I'm developping a multi-languages module / application.
    For each module, I have an external xml for texts. So in order to add a new language we don't need to recompile, just to change texts in the xml. But, I had to externalize my fonts, (imagine if each swf contains the whole characters set like latin, cyrillic, etc.).
    And then, I have my main text editor application above the module, which loads texts xmls and a preview of the page where we need to change the text. (This is where it crashes, during the process of loading the preview).
    My editor works great for translating, changing texts, modify images but without the preview, what is really frustrating.
    (not so ergonomic, I know...)
    I hope it will help you to understand my trouble.
    regards

  • Load swf file in html based air?

    1. The start window opens up a transperant window in an iframe.
    2. Then the transperant window loads an external asp file from my server (content.asp) in an iframe.
    3. In the content.asp file i try to load an swf file, but nothing is visible?
    I use the following code in content.asp to show the swf file:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="300">       
    <param name="movie" value="flashtest.swf" />
    </object>
    I have uploaded a testpage with this code to the server and it works fine, but not in the air application!?
    What Im I doing wrong?

    No, nothing with HTML.
    I have 2 SWF applications. One is the Gallery, and the second is my Main Page.
    My Main Page must integrate the Gallery module in one of its page.
    The problem is when I try to integrate it, I think I must give de future loaded SWF some parameters like this :
    (My Main SWF loading in HTML)
    var so = new SWFObject("WebSite.swf", "flashcontent", "520", "700", "10", "#111111");
    so.addParam("allowfullscreen","true");
    so.addParam("allowScriptAccess","always");
    so.addParam("menu","false");
    so.addParam("wmode","opaque");
    so.addParam("bgcolor","#000000");
    so.setAttribute("id","flash");
    so.write("flashcontent");
    It was for the Main App. For my Gallery SWF I had to load it like this (in HTML) :
    var so = new SWFObject("Gallerie.swf", "gallery", "249", "249", "10", "#111111");
    so.addVariable("xml_path","Galerie/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
    so.addParam("allowfullscreen","true"); 
    so.write("flashcontent");
    So at the beginning I had 2 different projects with an HTML page for each.
    Now I wan't to directly integrate the Gallery SWF into the Main SWF. And as you have seen I must give it some parameters such as the "xml_path" and "allowfullscreen". This must be done in ActionScript 3 and I don't know how...
    I think I have to use FlashVars but I don't know how. As I said before, I have tried using the loaderinfo.parameters, but it is in read-only...
    Do you have an idea of how I can make it work ?

  • Scrollpane all screwy  inside loaded swf

    I have had this problem using both the scrollPane component
    from Flash 8 and an open source code scrollpane that I found in
    Flashkit. I have an swf in which I'm using a scrollPane which works
    fine when I test the movie. However, I'm loading this swf into
    another master swf using loadMovie. When I do this, the scrollpane
    inside the loaded swf gets really buggy. First, the scrollbar will
    not stop scrolling when I release the mouse. Also, the whole
    scrollPane gets a green highlight around the edges (except in the
    open-source code scrollpane). HELP!! Does anyone know how to load a
    scrollPane into another swf without it getting all weird?

    //below is the code for the "slideshow.swf"
    //For the main movie.. I'm doing....
    button_btn.onRelease = function() {
    myMovieClipLoader_mc.loadMovie("slideshow.swf")//
    this.createEmptyMovieClip("container_mc",this.getNextHighestDepth());
    this.createEmptyMovieClip("buttons_mc",this.getNextHighestDepth());
    //loader//
    this.attachMovie("loader2","loader_mc",this.getNextHighestDepth());
    loader_mc._x = (Stage.width - loader_mc.width)/2;
    loader_mc._y = (Stage.height - loader_mc.height)/2;
    var myMCL:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();
    myMCL.addListener(myListener);
    myListener.onLoadProgress =
    function(target,bytesLoaded,bytesTotal) {
    loader_mc._alpha = 100;
    var pct = Math.round(bytesLoaded/bytesTotal*100);
    loader_mc.bar_mc._xscale = pct
    myListener.onLoadComplete = function(target) {
    loader_mc._alpha = 0;
    //button movies//
    buttons_mc.attachMovie("prev","prev_mc",buttons_mc.getNextHighestDepth());
    buttons_mc.attachMovie("next","next_mc",buttons_mc.getNextHighestDepth());
    buttons_mc.next_mc._x = Stage.width -
    buttons_mc.next_mc._width;
    buttons_mc.next_mc._y = 10;
    buttons_mc.prev_mc._x = 10;
    buttons_mc.prev_mc._y = 10;
    //variables//
    var numPics:Number = 5
    var picArray:Array = new Array();
    var currentElement:Number = 0;
    for (i=0;i< numPics;i++) {
    var location:String = "pics/pic0" + (i+1) + ".jpg";
    picArray.push(location);
    myMCL.loadClip(picArray[currentElement],container_mc);
    //next button//
    buttons_mc.next_mc.onRelease = function() {
    if (currentElement < picArray.length-1) {
    currentElement++;
    else
    currentElement = 0;
    myMCL.loadClip(picArray[currentElement],container_mc);
    //prev button//
    buttons_mc.prev_mc.onRelease = function() {
    if (currentElement > 0) {
    currentElement--;
    else
    currentElement = picArray.length-1;
    myMCL.loadClip(picArray[currentElement],container_mc);
    }

Maybe you are looking for

  • Need Help in Cross Platform Migration

    Hi Gurus, can you please tell me best way to do Corss Platform Migration with minimum down time and we are planning to do from AIX TO HP-UX. oracle version is 10g and can we do the data sync using streems if it is can you give the steps to configure

  • ESS Personal Profile - Employee photo show as 'x'

    Dear experts I'm trying to find a conf. table the difference between Dev & QA to display employee photo in ESS personal profile. An image like hide photo (Not a actual employee photo) is display in Dev portal where as it show 'X' in QA. I'm trying to

  • ADF Faces : How to set the selection button in a managed bean

    I am looking for a way to select the selection radio button of a specific row in a Table when using af:tableSelectOne. I am using the tableModel to manage row but I did not find a way to select the row.

  • HR Resigned Employee Report

    Dear All, I need to make out a report to list all resigned employees and the position which they held while they resigned. IN sap the last position is marked as default position when they resign . So how will i fetch the position before the Default p

  • JTextArea word wrapping

    I know I can use a method to word wrap a JTextArea, but is there any simple way so that word wrapping does not cut words in half in order to fit? In other words, the current word wrapping will break a word at any position once the max line length has