Loading External SWF - Problem

Hi,
Using MovieClipLoader I want to load external SWFs - and it
is working fine
if external swf doesn't have anything outside it's stage,
otherwise it shows
everything - that's the problem.
For example, external swf's stage dimensions are 100x150, but
it has some
timeline animation (some objects scrolling through the stage,
some bouncing
text animation that sometimes goes off-stage, etc..).
So when I load this external movie (banner.swf), I can see
all these objects
that were bouncing outside this 100x150 area (the stage of
banner). Even
more - the size of loaded movie is larger than 100x150px
(because of these
off-stage objects that are now visible). This way I'm getting
positioning
problems, too.
var mcl:MovieClipLoader = new MovieClipLoader();
mcl.loadClip("banner.swf", holder);
mcl.addListener(listener);
holder._x = Stage.width/2 - holder._width/2;
holder._y = Stage.height/2 - holder._height/2;
Thanks in advance,
B.

Hi kglad,
Does doing that takes only into account width and height of the stage, or also considers off stage items (as in the initial question)?
I am also looking at this issue and we can't have all the content providers modify their pre-existing flash applications to be displayed in the appropiate scale. We are looking to any of the following:
find a way to get adobe air/flash to not consider the off stage elements on the width/height we set to the movie.
find a way to get the stage size from the external movie and use that to auto calculate the resize needed.
any other alternative that allows to have the same end result, which is loading up the external content at the size we specify and displaying well. We can actually hide content outside the stage, but we still need to know the appropiate scale / size to apply to the movie so what's visible matches the are where we want to show the content.

Similar Messages

  • AS3 load external swf problem, please help...

    Hey guys, I am really in need of an answer here. I would tremendously grateful if someone has the answer. I'll keep it simple and right to the point:
    1. I have created "index.swf" in AS3. Has it's own "MainClass" class.
    2. I created "holder.swf" which is the main landing page. Has 2 buttons, for the viewer to load the site in fullscreen or standard.
    3. In the timeline of "holder.swf" I have created 2 frames, 1st frame containing the buttons, second frame containing the AS3 external swf loader script.
    It does not seem to want to load my "index.swf".
    I have tested a million different ways, it load other swf's just fine, AS2 and AS3, but for some strange reason it just will NOT load "index.swf".
    This is driving me crazy, I have a feeling it has something to do with a class conflict. I have tried (import MainClass;) in the first frame of "holder.swf" and no luck.
    PLEASE GUYS, LET ME KNOW IF YOU KNOW THE ANSWER!
    THANK YOU SO MUCHO.
    Michael

    Hey kglad,
    Thanks for the quick reply!
    Well here is the problem... With the exception of a few things I need to update, as well as implementing some better preloaders etc... the site is running alright...
    About a week ago I decided that I wanted to site to start with the above landing page. A simple "holder.swf" which would give the viewer something to look at before entering the site... (ideally I want to find a script that will begin loading "index.swf" while the viewer is still on "holder.swf", but I'll figure that out later).
    Anyhow, I created "holder.swf" as I have many times before, and for some reason it does not seem to want to load "index.swf" into the second frame when instructed to do so... does that make sense?
    So... ideally I would like the site to start on the above graphic, then once the button is clicked, "index.swf" opens up...
    It's driving me crazy, because my code works on other swf's I've tested it with, just not with index.swf, which leads me to believe there is something in the MainClass.as file which is causing it not to load...
    What are your thoughts?
    Oh, and many thanks again!!!
    M

  • Loading external swf problems

    iv recently started learning as3 and have made a flash site
    using it which all works fine. iv used an online tutorial to help
    create a dynamic slideshow/photo gallery which again works fine.
    But when i try to load the external slideshow/gallery into a
    movieclip it dosnt work and i get this error:
    TypeError: Error #1009: Cannot access a property or method of a
    null object reference.
    im pretty sure its because the code used in the main flash
    file is on the timeline and the code in the external file to be
    loaded in is in an external as file.
    any suggestions on a way around this?
    the code im using to load the external flash file is:
    toload.load(new URLRequest("newfile.swf"));
    photography.buttonThumb.addChild(toload);

    no sorry forgot the 1st line
    var toload =new Loader();
    the loader works fine when loading jpegs and swfs with no
    actionscript

  • HELP PLEASE - loading external swf scale problem

    I have a Flex 3 Actionscript Project. Basically all it does it take some flash vars, set the sound volume,  and load an external swf using a loader and add the loader as a child. The problem is I want the loaded external swf to be scaled to fill the entire stage, even if it distorts it, and that doesn't seem to be happening.
    I really need to resolve this. ANY HELP APPRECIATED.
    Marcus

    Thanks for the reply!
    Here's basically what my code looks like (note: I cut some stuff out that wasn't relevant for the sake of clarity).
    private var swfLoader:Loader = null;
    public function MySwfContainer()  
        stage.scaleMode = StageScaleMode.EXACT_FIT;
        stage.align = StageAlign.TOP_LEFT;
        var request:URLRequest = new URLRequest(swfUrl);
        swfLoader = new Loader();
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,SWFLoader_Complete);
        swfLoader.load(request);       
    private function SWFLoader_Complete(event:Event):void
        addChild(swfLoader);
    What I am observing is that if a swf larger than the stage area is loaded it clips it rather than scale it down and make it fit.
    Marcus

  • Loading external swf  not complete

    Hi, I'm trying to load external swf (with more than one frame and actionscript 3 on every frame - I used there "timeline" coding) from my main swf.
    code for loading external swf into main swf:
    var loader01:Loader;
    function openGame1(evt:Event):void
    loader01 = new Loader();
    var requestSWF01:URLRequest = new URLRequest("game01.swf");
    loader01.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, processHandler);
    loader01.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
    loader01.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    loader01.load(requestSWF01);
    addChild(loader01);
    function processHandler(evt:ProgressEvent):void
    var loaded:Number=evt.target.bytesLoaded;
    var total:Number=evt.target.bytesTotal;
    var stav:Number=loaded/total;
    loaded_txt.text=(Math.round(stav*100))+" %";
    function initHandler(evt:Event):void{
    loaded_txt.text="";
    function errorHandler(evt:IOErrorEvent):void
         trace ("Error: " + evt.text);
    I found out that this works only for loading swf, which has only one frame (and all actionscript on that frame)... It seems that if there are more frames, than it will not load complete swf (hmm maybe it is caused, because not all objects on frames are export in first frame). Preloading starts but after for example 20 % the event.INIT is fired and the external swf starts to play (and crashes..).
    You can see this here http://bvyborcik.xf.cz/  If you click on the blue building on the left with blinking text "Start hry" you will see what happens - preloading is not completed and after clicking on first floor btn, the swf crashes...
    Please is there a solution for this kind of problem?  Any help or pointing is welcome.
    regards Boris

    just curious, is the file you want to load the swf into set up exactly the same way with the same stage size, fps, and layers?

  • Transition_Manager and unloading external swf problems

    Hi there
    I´m having a few problems with my project which i although it work it has some unpleasant bugs that i´m trying to solve for days.
    When i load external swf´s they show up on top of the Menu button.Maybe because the button i´m pressing is inside the same movieclip as the Menu.
    Explaining better here´s a little diagram of my site:
    con2 MC (Instance of Menu) ---> cont3 MC (Instance of subMenu) and mainButton MC (Instance of Main)
    Here´s the general code which is inside the Painel.as
    package {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        public class Painel3 extends MovieClip
            private var inFocus:MovieClip;
            public function Painel3():void
                setupClips();
                addEventListener(Event.ENTER_FRAME, loop);
            private function setupClips():void
            con2.mainButton.addEventListener(MouseEvent.ROLL_OVER, onOver);
            con2.mainButton.addEventListener(MouseEvent.ROLL_OUT, onOut);
            con2.mainButton.addEventListener(MouseEvent.CLICK, onClick);
                var len:int = con2.cont3.numChildren;
                for(var i:int=0; i<len; i++)
                    var mc:MovieClip = MovieClip(con2.cont3.getChildAt(i));
                    mc.buttonMode = true;
                    mc.loc = [mc.x, mc.y];
                    mc.addEventListener(MouseEvent.CLICK, onClick);
                    con2.cont3.visible = false;
            private function onOver(e:MouseEvent):void
            private function onOut(e:MouseEvent):void
            private function onClick(e:MouseEvent):void
                con2.cont3.visible = true;
    TransitionManager.start(con2.cont3, {type:Wipe, direction:Transition.IN, duration:1, easing:None.easeNone, startPoint:5} );                       
            private function loop(e:Event):void
                var distx:Number = mouseX / 1400;
                var disty:Number = mouseY / 1400;
                TweenLite.to(con2, 2, {
                            rotationY:(-70 +(145*distx)),
                            rotationX:(70 -(145*disty)),
                            ease:Expo.easeOut
    And then inside the subMenu.as class for the movieclip subMenu i have the buttons that load the external swf´s:
    package  {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        public class subMenu extends MovieClip {
            public function subMenu() {
                // constructor code
                menu1.buttonMode = true;
                menu2.buttonMode = true;
                menu3.buttonMode = true;
                menu4.buttonMode = true;
                 menu1.addEventListener(MouseEvent.CLICK,link1);
                 menu2.addEventListener(MouseEvent.CLICK,link2);
                 menu3.addEventListener(MouseEvent.CLICK,link3);
                 menu4.addEventListener(MouseEvent.CLICK,link4);
            function link1(e:MouseEvent) {
               function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("AugmentedReality_v1.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link2(e:MouseEvent) {
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Fotos.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link3(e:MouseEvent) {
            function link4(e:MouseEvent){
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Texto.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
    Like i said the swf´s show up on top of the Menu and i need it to dissapear.
    Also i want to unload the swf currently in scene so that when i load another one they don´t pile on top of each other.
    Pls help. Thanks

    Oh btw, i´m having an error 1069 Property TransitionManager not found in subMenu and there is no default value
    at fl.transitions::TransitionManager$/start()
        at Painel3/onClick()
    This doesn´t happen when i uncheck the Export for actionscript in the subMenu class but i can´t do that or else the buttons wont work.

  • Error 2044 when loading external swf into my site

    Ok what i have is a site made from 1 flash file where i am loading external swf files for my picture galleries. now what is happening is in Flash, dreamweaver and when i test the site, everything is working perfectly, the problem is coming when i go into internet explorer go to the site and click on the flash button to go to the picture gallery, that is when it is giving me a Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
    does anyone know why this is happening and a possible way to fix it? thanks

    See if the following link helps at all...
    http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=20453

  • Loading from library conflicts with loading external swf

    I'm very new to ActionScript, so this might be incredibly basic. However, I've Googled and read myself into a coma and I'm not finding a solution.
    I have a movie with 6 navigation buttons.  Four of them load external .swf slideshows, and they work fine - as each file loads, the previous one clears the stage, etc.  The other button that I currently have set up is loading, from the library, an image.  The problem I'm having is that the slideshows replace each other on the stage - they're not stacking, they're replacing - but when the user selects the button that loads the image, the image overlays the last-selected slideshow.  If the user selects the image first, the image is visible when two of the external files transition.  Because of that 6th button, which is not yet even started, it's not desirable to me to simply set up the single image as another external file; if it's at all possible, I need to be able to pull from a library file when I build that last button.
    What I'd like to do - because there is no logical order that the buttons should be selected in - is figure out how to tell every button to remove the image file on click.  I've tried using this in the four buttons that link to the slideshows, to deal with the image (that's the one called quoteImage):
         if(myLoader != null && contains(quoteImage)){
            myLoader.removeChild(quoteImage);
    which has the advantage of not giving me any errors, but doesn't actually fix my problem.  I've tried many, many other things, and I'm just really stumped on what exactly I need to do to make this work the way I want it to.  Based on the fact that the books and online resources I've been using don't really cover this specific example, I suspect it might be an incredibly idiot thing to do, but I'd really like it to work this way if that's possible.
    The code as it stands, with the global variables and the first two buttons (the next three are identical to the second button and the sixth button doesn't exist) looks like this:
    var myLoader:Loader=new Loader(); 
    var quoteImage:Bitmap;
    stop();
    // Loads quoteImage from library
    btnQuotes.addEventListener(MouseEvent.CLICK, showquote);
    function showquote(event:MouseEvent):void {
    var myBitmapDataObject:myBitmapData = new myBitmapData(500, 350);
    var quoteImage:Bitmap = new Bitmap(myBitmapDataObject);
    quoteImage.x=150;
    quoteImage.y=180;
    addChild(quoteImage);
    // Loads industrial.swf from external file
    btnIndustrial.addEventListener(MouseEvent.CLICK, showindustrialcontent);
    function showindustrialcontent(event:MouseEvent):void {
    var myURL:URLRequest=new URLRequest("industrial.swf");
    myLoader.x=150;
    myLoader.y=180;
    myLoader.load(myURL);
    addChild(myLoader);
    Help is very much appreciated.

    I see now how to import and display a library class object
    using:
    var MovieClipClass:Class =
    Class(loader.contentLoaderInfo.applicationDomain.getDefinition("myLibraryAsset"))
    var movieClip:Sprite = new MovieClipClass();
    addChild(movieClip)
    But this seems to only work for SWF's published for AS3 Flash
    Player 9.
    I need to do the same for SWF's published with AS2 Flash
    Player 7.
    Any ideas?

  • Loading external swf fonts created with fontswf, loaded with a Loader, compatible with iOS

    Let me immediately start out by saying that I do in fact have a current working solution for using embedded fonts, generated by fontswf and working in an AIR ActionScript mobile application, and also currently working fine with iOS.
    My current app needs CFF fonts, so I currently use the fontswf tool to pre-generate the .swfs using:
    fontswf -4 -a [SomeAlias] -o [SomeFont.swf] [SomeFont.ttf]
    and then I am currently embedding them in my app source code .as for compilation using:
    [Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
    public static var SomeFontClass:Class;
    I then have no problem registering them using Font.registerFont(SomeFontClass) and everything works fine.
    However, I would prefer to take the use of these swf fonts one step further and load them dynamically using a Loader so that I do not have to take the hit of having multiple CFF font swfs embedded in the main compiled SWF and so that I could even load an unknown future set of fonts without having to supply them as part of the app build.
    Now I have seen and read many blogs and tutorials where people have exported font swf from Flash Builder where you add an explicit 'Class' name or even made standalone .as static files compiled into standalone swfs only including the two lines:
    [Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
    public static var SomeFontClass:Class;
    so that you also have a 'Class' involved. Then people use some form of appropriate applicationDomain.getDefinition("className") as Class
    to pull out the class for the font registration.
    My question is, how does one perform the same font loading and registration of fonts using a Loader only loading the .swfs produced directly from fontswf?
    It seems only a DefineFont4 is tagged in the swf, there doesn't seem to be a 'Class' per se to call on.
    More importantly, iOS apps cannot load external swfs with code in them, so my understanding is any extra wrapped swf that would contain a custom Class technique would fail the iOS requirement of only having one main SWF with any ActionScript compiled code.
    Is there an alternative to the 'Class' technique by grabbing the DefineFont4 tagged resource from the swf and instantiating a proper working Font class from that? One that would still be compatible with the restrictions placed on AIR mobile apps running on iOS?

    Ironically, just after posting this, Adobe released AIR 3.5 beta onto labs, and added multiple SWF support for iOS.
    While this new support makes it easier to manage your content across multiple SWFs and technically allows you to use the class based separate .swfs for each font if desired, the system still requires that all these SWFs be present at compile time when making the final app .ipa for iOS.
    So this still doesn't solve trying to load fonts after the app is already built. For example, as part of a downloaded in-app purchase mechanism.

  • Loading external swf (no code)

    Hello
    i have a strange issue since update of my app for ios 8: my app is loading external swf (doesnt containing code, its just pdf converted to swf using swftools)
    while its working ok when debugging on device, these external swf don't show up since the app have been accepted on itunes. And i dont have any error message
    what i don't understand is why it's working good with the debug version and not the production version. they are supposed to be exactly the same, and i don't see why it would be a crossdomain or applicationdomain issue. Did somebody experienced the same problem ?
    the thing is its a bit hard to debug, as the prod version isnt firing any message, and the debug version is just fine...:/
    thanks !

    hello
    here is the command generated by flash builder 4.7 (flex 4.13, air 15.0.0.302)
    java.exe -jar D:\SDK\Flex4.13_air15beta\lib\adt.jar -package -target ipa-app-store -provisioning-profile C:\Users\Gabriel\Adobe Flash Builder 4.7\WeesooMobile\libs\certificates\IOS\09102014\iConfDistri_09102014.mobileprovision -storetype pkcs12 -keystore C:\Users\Gabriel\Adobe Flash Builder 4.7\WeesooMobile\libs\certificates\IOS\09102014\CertificatsProd_0910214.p12 -storepass <Value cannot be displayed> WeesooMobile3.ipa WeesooMobile3-app.xml assets [email protected] [email protected] Default-Landscape.png [email protected] [email protected] [email protected] Default-Portrait.png [email protected] Default.png [email protected] WeesooMobile3.swf
    i missed the "proloader" part...is it now mandatory to user proloader if loading external swf assets ? is it a normal behavior that the swf can be loaded with the debug version, and not the shop version ?
    thanks for your help. by the way, i'm making a small video to show you the problem,as i'm not 100% sure you understand it in my case

  • Loading external swf files in a swf - Error#1009

    I have been having trouble using a swf file within a swf file.   The external swf files all work as expected.  However when used within another swf file I get the standard TypeError #1009 for some of my swfs.   The external swf files are mainly actionscript 3 files.  A typical swf file will have an object (or objects) in the library which has an export for ActionScipt property enabled and an addEventListener(Event.ENTERFRAME, somefunction).   About four years ago when I had to do some work with AS2 I seemed to get around a similar issue with the _lockroot method but this is no longer part of AS3. I have searched various forums and note that I am not the only one with this issue but did not find any relevant solutions.   If anyone could give me any ideas on how to get around this it would be appreciated.
    Regards
    Norman

    Hi,
    I have added a download to rapidshare and its link is:
    Download link: http://rapidshare.com/files/380202712/ExtSwfs.zip
    The main file Training01.fla has been set up with links to download several swf's.   The links that do not work properly are those labelled :  Module6 and Module 8.   The first Module 6 connects to a function that is a variation of how I was trying to load external swfs using Application Domain, while Module 8 is a link to a swf that uses and external class.  Module 8 is supposed to load with rotating stars, while Module 6 loads the same file as the link called Module 1.   As soon as I use the two links Module 6 or Module 8 the whole lot ceases to work properly.  I did also follow through the examples on the Adobe site.  The examples for Module 6 and Module 8 are tutorials I have used from the Internet as part of my training from the site FlashMyMind.com but they replicate the type of work we have been doing with respect to using ActionScript3.
    Re my background, at this stage I am self-taught using tutorials on the web and whatever books I can lay my hands on here.  There is no structured training available where I live as there is insufficient demand and no books available on Flash or ActionScript at the local book stores or libraries so the books are ones I have ordered via the Internet.  The one I am currently using apart from Adobe Classroom in a Book Flash CS4 is O'Reilly's Learning ActionScript 3.0 a Beginners Guide.
    The other problem I have been trying to solve and still researching is why one loses sound in the flash player when playing flv files, if the user has selected or restarted a video (or videos) many times eg 25 to 30 times as we create video training files and serve them to the user within the flash environment using Flash Player 9 and IE6.
    Regards
    Norman

  • Unable to load external swf which has runtime sharing with another swf.

    Hi,
    I am getting issues on loading external swf say "importer.swf" file into another swf file say "loader.swf" for second time like
    ReferenceError: Error #1065: Variable testSymbol is not defined. VerifyError: Error #1014: Class testClass could not be found.
    at global$init()
    In the external swf "importer.swf", i am trying to import the symbol "testSymbol" from another swf file say "exporter.swf", which exports through runtime sharing option for the symbols.
    I am having some buttons in loader.swf file and on each button click i am loading different swf files into the loader.swf after unloading the previous one.
    I am able to load and unload different swf files but unable to load the importer.swf file which is sharing symbols from external swf and that too for the second time i.e., when i click the button twice.
    When trying to debug with flash debugger, all the other swf files are being unloaded before loading of another swf but the swf which is sharing symbols/classes with another swf is not getting unloaded.
    Output when i am trying to load two files example and importer files into loader.swf file on two different button clicks. On first button click example.swf is loaded. On second button click , example.swf is unloaded and importer.swf is loaded which is successful. On first button click again importer.swf is unloaded and example.swf is loaded. On second button click again, example.swf is unloaded and importer.swf is loaded, here i am getting issues shown above.
    Attemping to launch and connect to Player using URL D:\runtime issue\loader.swf
    [SWF] D:\runtime issue\ loader.swf - 8181 bytes after decompression
    [SWF] D:\runtime issue\example.swf - 441708 bytes after decompression
    [UnloadSWF] D:\runtime issue\example.swf
    [SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
    [SWF] D:\runtime issue\importer.swf - 441708 bytes after decompression
    [SWF] D:\runtime issue\ example.swf - 441708 bytes after decompression
    [UnloadSWF] D:\runtime issue\ example.swf
    [SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
    ReferenceError: Error #1065: Variable xxxxxx is not defined.
    Debug session terminated.
    Code i am using
    b1.addEventListener(MouseEvent.CLICK, b1Clicked);
    b2.addEventListener(MouseEvent.CLICK, b2Clicked);
    var ldr:Loader;
    function b2Clicked(e:MouseEvent)
        if(ldr != null)
            ldr.unloadAndStop(true);
        ldr = new Loader();
        ldr.load(new URLRequest("importer.swf"));
        addChild(ldr);
    function b1Clicked(e:MouseEvent)
        if(ldr != null)
            ldr.unloadAndStop(true);
        ldr = new Loader();
        ldr.load(new URLRequest("example.swf"));
        addChild(ldr);
    If i try to open the swf using IE, i am not getting any issues at all. But i need to open this loader.swf in a air application. Also when i use loaderContext for the loader instance i am able to get rid of this issue but i cant use it in my application.
    So, please help me in resolving this issue.
    Thanks

    I got my answer. I had to append the photo url to the 'movie' value of the javascript embed method. Like this:
    <script language="JavaScript" type="text/javascript">
       AC_FL_RunContent(
          'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
          'width', '550',
          'height', '400',
          'src', 'lesson2',
          'quality', 'high',
          'pluginspage', 'http://www.adobe.com/go/getflashplayer',
          'align', 'middle',
          'play', 'true',
          'loop', 'true',
          'scale', 'showall',
          'wmode', 'window',
          'devicefont', 'false',
          'id', 'lesson2',
          'bgcolor', '#ffffff',
          'name', 'lesson2',
          'menu', 'true',
          'allowFullScreen', 'false',
          'allowScriptAccess','always',
          'movie', 'lesson2?photo=http://www.flash-mx.com/images/image1.jpg',
          'salign', ''
          ); //end AC code
    </script>
    Thanks,
    srb.

  • Bring loaded external swf to the front

    Hi,
    I am now implementing to create a website using side scrolling platform game approach. Since the player/actor (character that moves according to keyborad events) should always be at the top layer, I am having difficulties to get my loaded swf on top of the player. I am currently using Flash cs6 (as3).
    Basically, in my main stage, there are 3 layers. 1 for actionscript, the scond one for player and lastly for background.
    Layer player contains player mc and background mc.
    Background mc contains visual and collisions layers.
    Anything that got to do with visual, i have to put it in visual layer.
    In visual layer i have backgroundcontainer mc
    So, as i put the button in the backgroundcontainer mc to call the external swf, the loaded external swf appears in the container.
    (I am using load/unload snippet code to call the external swf)
    I want the external swf to appear on top of the player.
    for (var fl_ChildIndex_2:int = 0;
            fl_ChildIndex_2 < this.numChildren;
            fl_ChildIndex_2++)
        this.getChildAt(fl_ChildIndex_2).addEventListener(MouseEvent.CLICK, fl_ClickToBringToFront_2);
    function fl_ClickToBringToFront_2(event:MouseEvent):void
        this.addChild(event.currentTarget as DisplayObject);
    Any help would greatly appreciated 

    If you want an object to move atop all others you can just use addChild(thatobject), where thatobject is the item you want to move atop anything else.  I don't know what object(s) your loop is attempting to act on, but it appears to be trying to change the index of all child objects rather than just one.

  • Loaded external swfs with transitions

    I need help getting my loaded swf files to play the "out" transition before the next movie loads. I have a main swf with 5 buttons (movie clips) that load external swf onto the stage.
    package
        import flash.display.MovieClip;
        import flash.display.SimpleButton;
        import flash.display.Loader;
        import flash.net.URLRequest;
        import flash.events.MouseEvent;
        import flash.events.*;
        public class V2 extends MovieClip
            private var sections_array:Array;
            private var section_buttons_array:Array;
            private var loader:Loader;
            private var sectionHolder  : MovieClip;
            private var swf:String;
            private var currentSection:int=0;
            private var nextSection:int;
            private var id:int=0;
            private var homeLoc = "./swfs/home.swf";
            public function V2()
                init();
            private function init():void
                stop();
                stage.frameRate=31;
                preloader_mc.visible=false;
                preloader_mc.fill_mc.width=0;
                sectionHolder = new MovieClip();
                sectionHolder.x = 37;
                sectionHolder.y = 42;
                addChild( sectionHolder );
                sections_array = new Array('./swfs/section1.swf',
                './swfs/section2.swf',
                './swfs/section3.swf',
                './swfs/section4.swf',
                './swfs/section5.swf');
                section_buttons_array = new Array(btn1,btn2,btn3,btn4,btn5);
                addMenuListener();
                addMenuEvents();
                loadHome();
            private function addMenuListener():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,loadSectionHand ler);
            private function loadHome():void
                swf=homeLoc;//sections_array[0];
                var request:URLRequest=new URLRequest(swf);
                loader=new Loader();
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
                id=0;
            private function changeSection(m:MouseEvent):void
                id=m.currentTarget.id+1;
                loader.unload();
                sectionHolder.removeChild(loader);
                removeListeners(loader.contentLoaderInfo);
                loadSection(m.target.parent.id+1);
            private function loadSectionHandler(evt:MouseEvent)
                id = evt.currentTarget.id;
                loadSection(id);
            private function loadSection(n:int):void
                swf=sections_array[id];
                var request:URLRequest=new URLRequest(swf);
                initListeners(loader.contentLoaderInfo);
                loader.load(request);
            private function initListeners(dispatcher:IEventDispatcher):void
                dispatcher.addEventListener(Event.OPEN,start);
                dispatcher.addEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.addEventListener(Event.COMPLETE,completed);
            private function removeListeners(dispatcher:IEventDispatcher):void
                dispatcher.removeEventListener(Event.OPEN,start);
                dispatcher.removeEventListener(ProgressEvent.PROGRESS,atLoading);
                dispatcher.removeEventListener(Event.COMPLETE,completed);
            private function start(event:Event):void
                preloader_mc.visible=true;
            private function atLoading(event:ProgressEvent):void
                var n:uint=(event.bytesLoaded/event.bytesTotal)*100;
                preloader_mc.fill_mc.width=n;
               private function completed(event:Event):void
                sectionHolder.addChild(loader); 
                preloader_mc.visible=false;
            private function stopAll():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].stop();
                    sections_array[i].stop();
            private function addMenuEvents():void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    section_buttons_array[i].mouseChildren=false;
                    section_buttons_array[i].buttonMode=true;
                    section_buttons_array[i].id=i;
                    section_buttons_array[i].isPressed=false;
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OVER,setOver);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_OUT,setOut);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_DOWN,setDown);
                    section_buttons_array[i].addEventListener(MouseEvent.MOUSE_UP,setUp);
            private function setOver(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(2);
            private function setOut(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function setDown(evt:MouseEvent):void
                nextSection=evt.target.id;
                checkState(evt.target.id);
                evt.target.gotoAndStop(3);
                loadSection(1);
                currentSection=evt.target.id;
            private function setUp(evt:MouseEvent):void
                if(evt.target.isPressed==false)
                    evt.target.gotoAndStop(1);
            private function checkState(n:int):void
                for(var i:int=0;i < section_buttons_array.length;i++)
                    if(i==n)
                        section_buttons_array[i].isPressed=true;
                    else
                        section_buttons_array[i].isPressed=false;
                        section_buttons_array[i].gotoAndStop(1);
            private function removeSWF(e:Event):void
                loader.unload();
                removeEventListener("removeMe", removeSWF);
                var request:URLRequest = new URLRequest(swf);
                loader.load(request);
            private function onClick(e:MouseEvent):void
            targetID = e.currentTarget.id;
            addEventListener("removeMe", removeSWF);
            MovieClip(loader.content).play();
            private function removeSWF(e:Event):void
            loader.unload();
            removeEventListener("removeMe", removeSWF);
    The loaded swf has a stop() an intro animation and on the last frame have.
    dispatchEvent(new Event("removeMe", true));

    your isse begins here ..
    loadSection()
    you use the same loader to not only load files but you are tyring to use it to target the movieClip you also want to play.
    The issue is loader.  The loader can only reference one load at a time.. otherwise you screw up your listeners and the ability to unload files properly.
    You should load all files in Your current system as its own variable so that while one loads you can still control a movie.
    So what type of end transitions do your files have?
    What exactly with this seems like youre getting an issue.. looking at it looks alright aside from the fact that some methods are not used at all by your class

  • Load external SWF's help

    I am using this thumbnail gallery attached but instead of loading images through the xml I want to load external SWF'S. I also want to be able to control each SWF loaded in individually apparently in order to do that I need to give the container different instance names..however I don't know how to extend the code inorder to achieve this..can anyone help?

    Hello Kglad,
    Thank you for the swift reply, I don't know how to apply this to my code. At the moment it loads in images but it will load in external SWF's I pressume this is the section of code relevant;
    function thumbnailer(k){
    total_thumbs = _global.total;
    var container = thumbnail_mc.createEmptyMovieClip("th"+k,thumbnail_mc.getNextHighestDepth());
    container._visible=false;
    container._alpha=0;
    var image = container.createEmptyMovieClip("img", container.getNextHighestDepth());
    tlistener = new Object();
    tlistener.onLoadInit = function(target_mc) {
      target_mc.pictureValue = k;
      target_mc.onRollOver = function() {
       this._alpha = 50;
      target_mc.onRollOut = function() {
       this._alpha = 100;
    image_mcl = new MovieClipLoader();
    image_mcl.addListener(tlistener);
    image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k+".img");

Maybe you are looking for