Loading external swf files

I have a Flash presentation where the chapters are made of
seperate swf files. How can I link them, so they play in the
correct order automatically? I will also need to make a clickable
version. Any help greatley appreciated.
Thanks
D.

dazzlah wrote:
> I have a Flash presentation where the chapters are made
of seperate swf files.
> How can I link them, so they play in the correct order
automatically? I will
> also need to make a clickable version. Any help greatley
appreciated.
You could have one base movie which load your first movie in
level 1.
Then on the last frame of the first movie place an action to
load next movie
in level 1 as well, what automatically will replacing the
previous loaded
content with a new one. That's probably as simple as you
could go.
Tho, take note, that's good idea when comes to any flash till
version AS3.0
player 9. Loading in AS3.0 is ridicules, so it unloading of
loaded content
The functionality is no longer the same as in early versions
so if you can
export as2.0, you can achieve it using very basic methods
like loadmovie action
attached to last frame of the timeline.
Best Regards
Urami
"Never play Leap-Frog with a Unicorn."
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>

Similar Messages

  • Loading external .swf files issue...

    Hi,
    I'm working on a simple example of loading external swf files with some ActionScript.
    I've placed an instance of List Component and gave it an instance name of loadList. Using Component Inspector, I assigned data for 4 external files as below:
    Next, I've added a UILoader component (instance name - loadWindow). The code that is supposed to load the content into UILoader is this:
    loadList.addEventListener(Event.CHANGE, selectItem);
    function selectItem(e:Event):void
        loadWindow.source = e.target.selectedItem.data;
    When I run it in a FlashPlayer, it only loads the first 2 swf files....  (I checked the files and all files are fine).
    I hope to get some light on the issue so any help will be appreciated.

    Try tracing e.target.selectedItem.data to make sure it's what you expect.
    Also, have you tried using the load() method instead of the source property?

  • Loading external swf file in a new window

    Hi,
    I've got a few .swf files with video tutorials I've created using Captivate 4.
    I wanted to link them so I've created a main screen with menu with buttons in Flash.
    I've added AS to load the external swf files but they load in the same window. How can I load these .swf files in seperate window so that you could get back to the main window after you've finished watching?
    Here's my code:
    stop();
    var myLoader:Loader = new Loader();
    button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
    function movie1_1(e:MouseEvent):void
        var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
        myLoader.load(myURL);
        addChild(myLoader);
    I'm also attaching screenshot with menu in flash

    I've deleted the line and now the code lookes like that:
    stop();
    var myLoader:Loader = new Loader();
    button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
    function movie1_1(e:MouseEvent):void
        var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
        addChild(myLoader);
    Unfortunately, it doesn't load the .swf file when you click on the button...

  • How to load External swf file in AIR

    I try this code its working in computer but when I publish this file in .apk or .ipa , my external swf file is not opening
    (I include my external file as well)
    places_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
    function newvid(event:MouseEvent) {
         trace("you clicked me");
         var loadit = new Loader();
         addChild(loadit);
         loadit.load(new URLRequest("scene02.swf"));

    thx boss its working great
    I have 3 scenes; load scene code is working great
    1. How can I unload the scene?
    2. Can I unload all scenes or one by one?
    can I unload some think like this
    Load scene 2 , unload scene 1 and scene 3
    Load scene 3, unload other all scene
    i try this
    load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
    function newvid(event:MouseEvent) {
              trace("you clicked me");
              var loadit = new Loader();
              addChild(loadit);
        var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
        loadit.load(new URLRequest("scene02.swf"), _lc);
              loadit.unload();
    load3.addEventListener(MouseEvent.MOUSE_DOWN, newvid1);
    function newvid1(event:MouseEvent) {
              trace("you clicked me");
              var loadit = new Loader();
              addChild(loadit);
        var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
        loadit.load(new URLRequest("scene03.swf"), _lc);
              loadit.unload("scene01.swf scene02.swf");

  • Loading external swf file

    Hi all,
    I am trying to load an external SWF file into my website.. but it is not working. Here is my code
    public var CD:Loader=new Loader();
    protected function application1_creationCompleteHandler(event:FlexEvent):void
    CD.load(new URLRequest("http://localhost/assets/slide.swf"));
    addChild(this.CD);
    CD.x=2;
    CD.y=170; 
    // TODO Auto-generated method stub
    Can anyone tell me what is going wrong..
    The url is correct and its working in my browser when i type 'http://localhost/assets/slide.swf' in the browser... So problem is with flex..

    I am pretty sure that Flash's security measures prevents the coder from loading swfs that are not local to the swf that is trying to load them.  So the swf that is trying to load another swf would have to be on the same system or same networked server.  From what I have experienced its best to reference the location of the files from the swf that is doing the loading.  I am not sure if you are still referencing your swf as "http://localhost/assets/slide.swf" but that might be a problem as well.
    so
    mainfolder
    movie.swf
    assets
    slide.swf
    so in movie.swf
    //Start: Put in desired function
    var swfLoader:Loader = new Loader();
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    swfLoader.load(new URLRequest("assets/slide.swf"));
    //End
    Also add this function
    public function loadComplete(e:Event):void
         stage.addChild(e.target.content);
    This might help explain it
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
    the first set of bullet points highlight the security options
    ps. I got this working on my end, copy and pasted the code, of course i had to recreate the file system structure and slide.swf

  • 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

  • Load external SWF file into another SWF

    Hello all.
    I've tried loading a .swf file externally into another .swf file on my  local drive, and it works. Now, when I try to Simulate Download, the  preloader in the 2nd file doesn't get played and the images in there  take a while to get displayed.
    I need to load a .swf file from a server into the parent .swf file(I'm  working on using a "thin flash file" for added security for the company I  work for - blank file which loads the content from another file on  their server).
    So far, I have:
    try
        var myLoader:Loader = new Loader();
        addChild(myLoader);
        var url:URLRequest = new URLRequest("newBook.swf");
        myLoader.load(url);
    catch (e:Error)
        trace("ruhroh");
    When I replace the "newBook.swf" with the URL of another .swf, there's just a blank page.
    I'm not too sure how to proceed, and I hope you will be able to help me out. I'd greatly appreciate the help.
    Many thanks,
    -Nazgul

    What happens is...when I set the speed to DSL(32.6kbps), the screen is blank and the preloader doesn't show up. It just goes directly to the Main screen. And then, the pages inside don't get loaded properly.
    This only happens when I try to Simulate Download.
    But that's not really the problem. I need to load a .swf file from a server into another .swf file, and just adding the link to the child .swf isn't working.
    Anyway, thanks for your help
    -Nazgul

  • Is it possible to Load External SWF files into Flex Mobile projects?

    Hi Guys,
    I'm trying to load an external asset in this cse (a SWF file) into my flex project (Apple IOS IPAD), don't get any luck. Can any one suggest a solution ?

    In Apple's words, "No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple's Documented APIs and built-in interpreter(s)".
    Hence external swfs cannot be loaded in iOS.

  • Loading external SWF fila and accessing variables/functions

    Hello everybody!
    My first post here. Actually I do search google for answers all the time, but now - it's tough one.
    public function loadScreen(swf:File):void {
         _content = swf;
         var swfBytes:ByteArray = new ByteArray();
         var file:File = _content;  
         var loadStream:FileStream = new FileStream();
              loadStream.open( file, FileMode.READ );
              loadStream.readBytes( swfBytes );
              loadStream.close();
         var loader:Loader = new Loader();
         var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
              loaderContext.allowLoadBytesCodeExecution = true;
              loader.loadBytes( swfBytes, loaderContext);
              loader.contentLoaderInfo.addEventListener(Event.INIT, accessSWF);
              loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    public function errorHandler(e:Event):void {
         trace("PROBLEM LOADING BYTES");
    public function accessSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.content.addEventListener(Event.INIT, readyHandler);
    public function readyHandler(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
    The problem is that application loads the external swf with loadBytes, but it's not executing the script. Actually, I'm not able to use the loaded swf. I'm not able even to add it to Stage. But message in output still shows, that the swf file is loaded "[SWF] file.swf/[[DYNAMIC]]/1 - 2746 bytes after decompression"
    There are many solutions for this problem on the internet, but they're old (written in 2008 most of all) and not working either, because those solutions work only in older AIR versions
    Any help?

    Well I got a bit further:
    public function loadScreen(swf:File):void {
         var loadStream:FileStream = new FileStream();
         with(loadStream) {
              openAsync( swf, FileMode.READ );
              addEventListener(ProgressEvent.PROGRESS, loadProgress);
              addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
              addEventListener(Event.COMPLETE, loadComplete);
    public function loadProgress(e:ProgressEvent):void {
         trace("Loading " + e.target.bytesAvailable);
    public function errorHandler(e:IOErrorEvent):void {
         trace("Error ");
    public function loadComplete(e:Event):void {
         var swfBytes:ByteArray = new ByteArray();
         FileStream(e.target).readBytes( swfBytes );
         var loaderContext:LoaderContext = new LoaderContext();
         with(loaderContext) {
              allowLoadBytesCodeExecution = true;
         var loader:Loader = new Loader();
         with(loader) {
              loadBytes( swfBytes, loaderContext);
              contentLoaderInfo.addEventListener(Event.INIT, completedSWF);
    public function completedSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.addEventListener(Event.COMPLETE, initiatedFinally);
    public function initiatedFinally(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
         var loader:Loader = e.target.loader;
         loader.addEventListener(Event.ADDED_TO_STAGE, irAdded);
         _window.stage.addChild(loader);
    public function irAdded(e:Event):void {
         trace(e.target.content.vars); // Object Dictionary
    At this point ( function irAdded ) I'm able to retrieve external SWF's variables. But stil, it's not visible on the stage. And yet - there's another problem - rendering the same script , every second time application unloads the external swf movie.

  • AS3 loading external swf files with buttons from inside a movieclip

    In my main .swf I have labels on the timeline, navs for those btns are on the first frame of the AS layer and each button sends the playhead to a different frame.
    On one frame called fr1 there is an mc called mc_1 that appears on stage when the playhead stops there. Inside mc_1 are a set of navigation buttons that need to call external .swfs.
    Do I add event listeners on the last frame of mc_1 for each button?
    how do I call the loaders for the swfs on the buttons since the swfs will load on the main timeline NOT the mc_1 timeline?
    So label on main timeline called fr1 will load external1 swf , on fr10 external 2.swf will load and so on.
    any help?

    The code for that button's event listener needs to be placed wherever it has direct access to the button.  Not necessarily on the same timeline, but in a place where both the button and the code are present at the same time.
    The code could be placed at the frame in the main timeline where the movieclip with the button(s) is, targeting the buttons via the movieclip (mc.button.addEvemtListener...) , unless the buttons are somewhere down the timeline of that movieclip.
    If they are down the timeline of that movieclip, then you would need to have the event listener also inside the movieclip, down its timeline where the buttons are finally settled in... being sure to assign instance names to the buttons at every keyframe.

  • Trouble in loading external swf file and embedded font dynamically

    I have developed a flex application doing something like this: it loads A.swf from somewhere and show it on the stage
    sometimes A uses fonts not installed on users' machine, so at this time my app will load B.swf with needed fonts embedded in it from another place
    I have working it out that fonts in B.swf can be detected and shown in my app stage, but when I use SWFLoader to show A.swf, it still fails in showing the fonts properly...
    Some of my codes pasted here:
    // load fonts
    private function onFontBytesLoadComplete(e:Event):void {
    var data:ByteArray = e.target.data as ByteArray;
    swfLoader.addEventListener(Event.COMPLETE, onSWFLoadComplete);
    swfLoader.source = data;
    private function onSWFLoadComplete(e:Event):void {
    loadSM = SystemManager(swfLoader.content);
    loadSM.addEventListener(FlexEvent.APPLICATION_COMPLETE, onFontLoadComplete);
    private function onFontLoadComplete(e:FlexEvent):void {
    var clazz:Class = loadSM.loaderInfo.applicationDomain.getDefinition(fontName) as Class;
    var fun:Function = clazz.getFont as Function;
    var fontClazz:Class = fun();
    var font:Font = new fontClazz() as Font;
    trace(getQualifiedClassName(new fontClazz()));
    Font.registerFont(fontClazz);
    if(loadFinishedHandler != null) {
    loadFinishedHandler(fontName);
    Anyone has idea about this? 3x~

    Hm, yes, I remember there being some challenges in this regards, with Modules loading fonts at runtime.
    If you take a look at the section "Using run-time style sheets with modules," they describe the basic approach where everything has to be loaded and registered in the primary application domain.
    I think it should work fine the way you have it, provided you are registering both the font and the loaded SWF in the primary application domain. If not, you may need to push the font registration down into the application domain being used by the loaded SWF.
    Something like this perhaps:
    childApplicatonDomain.getDefinition('flash.text.Font').registerFont(fontClass);
    Where childApplicatonDomain is the application domain of the loaded SWF.

  • Loading External SWF Files: Making Things Simple...

    Hello everyone! This is my first post and I'm learning AS3 =)
    I didn't know about this forum but now I hope to have the time to come hear a lot, to help and be helped!
    Well, I'm trying to import some external files to my main flash file with buttons. Yes, this is a newbie question, but I'm learning... I click button 1 and content 1 is loaded, click button 2 and content 2 is loaded, and so on. So, I got two ways for doing it:
    **various buttons with listeners to run the function "loadCity"
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    function loadCity (Event:MouseEvent):void {
    var currentCity=Event.target.name;
    var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load(swfRequest);
    box.addChild(swfLoader); }
    The problem with this first option is that the content to the box is not renew with each click but it stacks one over each other, so I can't use it =/
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    var cityLoader:Loader = new Loader();
    var cityURL:URLRequest=new URLRequest("montreal.swf");
    cityLoader.load(cityURL);
    box.addChild(cityLoader);
    **various buttons with listeners to run it's own functions, like "montreal.addEventListener(MouseEvent.CLICK, loadMontreal);"
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    function loadCity (Event:MouseEvent):void {
    var currentCity=Event.target.name;
    var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
    var swfLoader:Loader = new Loader();
    swfLoader.load(swfRequest);
    box.addChild(swfLoader); }
    The problem with this first option is that the content to the box is not renew with each click but it stacks one over each other, so I can't use it =/

    Thanks Andrei!
    The "while statement" did the trick! =D
    Just one little problem. This first thread was opened involuntarily and I don't know how to delete it. The other topic, above this one, is more complete and has more details in what I'm trying to do. I still want to use tweens. =/ Could you check my other topic?
    Well, thanks again Andrei and I'm leaving the finished code here, just in case anyone else needs to do the same thing. =)
    montreal.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    dublin.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    sydney.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    function loadCity (event:MouseEvent):void {
        var currentCity = event.target.name;
        // remove all the children of the box
        while (box.numChildren > 0) {box.removeChildAt(0);}
        var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
        var swfLoader:Loader = new Loader();
        swfLoader.load(swfRequest);
        box.addChild(swfLoader);}

  • Loading External SWF Files: Making Things Simple... Still need help here =)

    Hello everyone! First of all, sorry for my english... I'm Brazilian and english is not my first language.
    This is my first post meant to be my first post and I'm learning AS3. Didn't know about this forum but now I hope to have the time to visit it a lot to help and be helped! =)
    Well, I'm trying to import some external files to my main flash file with buttons. Yes, this is a newbie question, but I'm learning... I click button 1 and content 1 is loaded, click button 2 and content 2 is loaded, and so on. So, I got two ways for doing it:
    edit: The code below is working fine now...
    montreal.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    dublin.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    sydney.addEventListener(MouseEvent.MOUSE_UP, loadCity);
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    function loadCity (event:MouseEvent):void {
        var currentCity = event.target.name;
        // remove all the children of the box
        while (box.numChildren > 0) {box.removeChildAt(0);}
        var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
        var swfLoader:Loader = new Loader();
        swfLoader.load(swfRequest);
        box.addChild(swfLoader);}
    The problem with this first option is that whenever I click a button, it don't renew the content of the "box"... instead, the content loaded is stacked over the last one and I don't know how to clean it... The user Andrei did the trick with the "while statement" so the above code is working but I don't know how to use tween with it...
    So here comes the second option:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    montreal.buttonMode=true;
    dublin.buttonMode=true;
    sydney.buttonMode=true;
    rio.buttonMode=true;
    paris.buttonMode=true;
    london.buttonMode=true;
    home.buttonMode=true;
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    var cityLoader:Loader = new Loader();
    var cityURL:URLRequest=new URLRequest("montreal.swf"); //I use this to show a city when the site is opened
    cityLoader.load(cityURL);
    box.addChild(cityLoader);
    **Here I add the listeners to button, each one calling its own function like:
    montreal.addEventListener(MouseEvent.CLICK, loadMontreal);
    function cityTweens():void {
        var cityIn:Tween = new Tween(box, "y", Strong.easeOut, -350, 20, 1, true);}
    function loadMontreal(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("montreal.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadDublin(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("dublin.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadSydney(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("sydney.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadRio(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("rio.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadParis(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("paris.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadLondon(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("london.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    function loadHome(event:MouseEvent):void {
        var cityURL:URLRequest=new URLRequest("home.swf");
        cityLoader.load(cityURL);
        cityTweens();}
    Well, the second option "is" working but I have some problems with the Tween... I have to wait the tween to finish before clicking another button or the tween will bug... I don't know how to disable the buttons until the tween is finished =/
    Now, I used to have one tween for each function but now I got it inside a function and just call it inside each function. Simple for you but I was like WOW when I had the idea and put it to practice! But I'm still repeating a lot of codes here with the "cityLoader.load(cityURL);" but when I try to put it inside the function "cityTweens" it will just open the Montreal City, maybe because I'm calling it as soon as the site opens...
    I'm almost sure I can make things simple, like mixing the idea of the first code (currentCity+".swf") so I don't need to call a function for each button. I just don't know how to do it...
    Could anyone help me? I'll also be VERY happy if you point me to any tip like good practices that I'm not following.
    Thanks in advance!
    Message was edited by: newToAS3

    As I said in your previous post, removing the child would not do the trick. Technically, you need to remove it after the tween is finished.
    In any case there are several issues with how you approach the whole thing. First of all, if you target your application to be on Internet - swf loading will not happen instantly - thus you, perhaps, need to consider waiting for swfs to be loaded before you doing anything with them. But if you just do it on local machine - you don't really need for them to show up. On the other hand, even with local environment it makes sense to take into account asynchronous/unpredicatable nature of external file loading.
    Also, your code can be more comact and the same functionality delegated to a single function. The code below demonstrates one of the ways. This is not the bes way though because it forces to load objects again although they were loaded already. But this is another story. I did not check code in action, of course (this is just an idea) - it is up to your to work out bugs:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    import flash.display.DisplayObject;
    import flash.display.Loader;
    import flash.events.Event;
    montreal.buttonMode = true;
    dublin.buttonMode = true;
    sydney.buttonMode = true;
    rio.buttonMode = true;
    paris.buttonMode = true;
    london.buttonMode = true;
    home.buttonMode = true;
    var box:MovieClip = new MovieClip();
    addChild(box);
    box.x=20;
    box.y=20;
    var cityLoader:Loader = new Loader();
    // this line will allow to wait untill content is loaded
    cityLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
    var cityURL:URLRequest = new URLRequest("montreal.swf"); //I use this to show a city when the site is opened
    cityLoader.load(cityURL);
    // don't need the following line
    // box.addChild(cityLoader);
    // make it a single listener
    montreal.addEventListener(MouseEvent.CLICK, loadSWF);
    dublin.addEventListener(MouseEvent.CLICK, loadSWF);
    sydney.addEventListener(MouseEvent.CLICK, loadSWF);
    rio.addEventListener(MouseEvent.CLICK, loadSWF);
    paris.addEventListener(MouseEvent.CLICK, loadSWF);
    london.addEventListener(MouseEvent.CLICK, loadSWF);
    home.addEventListener(MouseEvent.CLICK, loadSWF);
    // the single function handles all the loading
    function loadSWF(e:MouseEvent):void {
         switch(e.currentTarget) {
              case montreal:
                  cityURL = new URLRequest("montreal.swf");
              break;
              case dublin:
                  cityURL = new URLRequest("dublin.swf");
              break;
              case sydney:
                  cityURL = new URLRequest("sydney.swf");
              break;
              case rio:
                  cityURL = new URLRequest("rio.swf");
              break;
              case paris:
                  cityURL = new URLRequest("paris.swf");
              break;
              case london:
                  cityURL = new URLRequest("london.swf");
              break;
              case home:
                  cityURL = new URLRequest("home.swf");
              break;
         cityLoader.load(cityURL);
    function onLoadComplete(e:Event):void {
         loadedContent = e.target.content;
         // assuming that previous content will be moved out -
         // place new content behind previous one
         box.addChildAt(e.target.content, 0);
         // now you can start tweening
         // if there are more than one child
         if (box.numChildren > 1) {
              cityTweens();
    function cityTweens():void {
         // tween the topmost object
          var cityIn:Tween = new Tween(box.getChildAt(box.numChildren - 1), "y", Strong.easeOut, -350, 20, 1, true);
         // wait until motion finished
         cityIn.addEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
    function tweenFinished(e:TweenEvent):void {
         // make Tween instance eligible for arbage collection
         e.target.removeEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
         // now you can remove tweened object from the box
         box.removeChild(e.target.obj);
         e.target.obj = null;
    Edited some code.

  • External SWF file load problem

    I'm loading external SWF file which has motion tween.After
    the loading progress bar finished to load than calls SWF file.If I
    test the movie locally works fine but when simulate the download it
    seems it jumps end of the timeline.Is anyone could tell me why is
    this??
    Thanks

    k, never mind..... finally figured it all out.

  • Can not load an external swf file from my site

    Hi ...
    I have a fla file which is loading external swf files from my local folders.
    I inserted some of the swf files to a web site and tried to load them from the site, not from my local folder...
    So it gave me a security error like below:
    *** Güvenlik Sanal Alanı İhlali ***security domain-area violation
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi -- security domain element, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı - tried to reach this incompatible url
    SecurityError: Error #2070: Güvenlik sanal alan ihlali -- security area violation: http://www.celiktek.com.tr/KIRIL.swf arayanı - searcher of this can not reach stage in file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor. -
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    so in my computer, I can load this swf , but how from a website ?
    thnx ...

    Thnaks ...
    I tried to use the securiyt panel that is openede and I added there my site
    www.celiktek.com.tr/KIRIL.swf
    but I still take the error
    *** Güvenlik Sanal Alanı İhlali ***
    http://www.celiktek.com.tr/KIRIL.swf' SecurityDomain öğesi, 'file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf' uyumsuz bağlamına erişmeye çalıştı
    SecurityError: Error #2070: Güvenlik sanal alan ihlali: http://www.celiktek.com.tr/KIRIL.swf arayanı file:///C|/Users/Acer/AppData/Local/Temp/Untitled%2D1.swf içindeki Stage'e erişemiyor.
    at flash.display::Stage/requireOwnerPermissions()
    at flash.display::Stage/get numChildren()
    at KIRIL_fla::MainTimeline/frame1()
    from my code
    var req:URLRequest=new URLRequest("http://www.celiktek.com.tr/KIRIL.swf");
    var lod:Loader=new Loader();
    lod.load(req);
    addChild(lod);
    lod.x=0;
    does this code works on your computer ... I know it is a weird question ... you dont have to try ...

Maybe you are looking for

  • How do you unreject a "Reject" file in Bridge?

    I have a batch of photos in Bridge, some of which are marked as "Reject" Is there a way to unlabel these so that they are no longer marked Reject? It seems like it should be so simple...

  • Canon S100 and Camera RAW 6.6

    I upgraded from Photoshop Elements 9 to Elements 10 for the Canon S100 RAW compatability. I installed the Elements 10 and then updated the Camera RAW to 6.6 from the Help Menu. When I try to open a file folder with a S100 RAW CR2 file I get the follo

  • Error 3331 happening all of a sudden in production environment.

    Using APEX 3.0 running on Oracle Web server ( apache 1.3 ) and oracle 10.2.0.1 There have been no recent changes or releases (for months). I've cleared down session state globally, restarted the service, all to no avail. Shift CTRL-R doesn't work( ie

  • AIX Monitoring works for 6.1 and not if 6.1.0.0 even if I manually install

    I pushed scom 2012 agent to a list of AIX servers wherein it got successfully installed for sever it discovered version as 6.1 and failed with the message ( Signed certificate verification operation was not successful )for the servers it discovered a

  • Error message when attempting to activate Genius

    I am trying to use Genius, but get the error message: This person record must be harvested, when logging in. Does anyone know what that means? And how to address it so I can log on? Thanks