Loading two swfs and playing them sequentially

Hello Team,
           I have searched, but can't seem to find an answer to my question.  I'm working in Flash cs6 on Windows platform. I do not understand how to load two external swf files into another swf file(Main swf) and have them play sequentially. I certain that this task is extremely small to a lot of members of this forum, but if someone could be so kind to assist me with this inquiry I will be over-joyed.
I am able to load one swf with the following code:
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swf/gallery.swf");
loader.load(defaultSWF);
addChild(loader);

AS3 - Dispatch Event
Example:
Add something to trigger the event in the child:
dispatchEvent(new Event("eventTriggered"));
(if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
The listener for this event has to be added to the main file AFTER the external file has been loaded.  In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo. 
yourLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
In the complete event handler, add a listener for the event on the loaded swf.
// event handler triggered when external swf is loaded
function loaderCompleteHandler(event:Event) {
    MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
Then just create the event handler for the dispatched event listener that was created in the loaderCompleteHandler function.
function eventHandler(event:Event):void {
    trace("event dispatched in loaded swf");
    // load/play your second swf now

Similar Messages

  • Loading multiple SWFs and storing them (code not working under Firefox 23 and Chrome)

    Hey guys,
    Anyone has any idea why this code suddenly don't work anymore? (It works under internet explorer but not firefox and chrome
    The code under is placed on my main swf to preload all my external swfs and store them for not having to wait too long to access them.
    Thx guys.
    I took the code from here btw: http://www.beautifycode.com/the-finer-art-of-loading-2-handling-multiple-swfs#snippet
    I'm running flash player 11.8.800.94... It used to work under Firefox and Chrome
    var _swfLoader:Loader;
    var _swfRequest:URLRequest;
    var _swfPathArr:Array = new Array("00.swf", "01.swf", "02.swf");
    var _swfClipsArr:Array = new Array();
    var _swfTempClip:MovieClip;
    var _loadedSWFs:int;
    startLoading(_swfPathArr);
    function startLoading(pathArr:Array):void {
    _swfLoader = new Loader();
    _swfRequest = new URLRequest();
    loadSWF(pathArr[1]);
    function loadSWF(path:String):void {
    setupListeners(_swfLoader.contentLoaderInfo);
    _swfRequest.url = path;
    _swfLoader.load(_swfRequest);
    function setupListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.COMPLETE, onSwfComplete);
    function onSwfComplete(event:Event):void {
    event.target.removeEventListener(Event.COMPLETE, onSwfComplete);
    _swfTempClip = event.target.content;
    _swfTempClip.customID = _loadedSWFs;
    _swfClipsArr.push(_swfTempClip);
    if(_loadedSWFs <_swfPathArr.length - 1) {
    _loadedSWFs++;
    loadSWF(_swfPathArr[_loadedSWFs]);
    } else {

    Hi kglad,
    The problem was coming from my server.
    I recently played with some settings  from a "cache control tool" offered by my hosting but i thought i had it back at default. Turns out i must've missed something. Now i have the .html caching on and everything works good on all browser.
    I have another question tho...
    I'd like to know if there's a way to cache an html file without having to ask my hoster to cache all of my htmls...
    I'm using this code now but maybe there's a way to add something that will cache this page specifically?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>title</title>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="fluid_site.js" language="javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen"/>
    </head>
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!-- saved from url=(0013)about:internet -->
    <script>
        if (AC_FL_RunContent == 0) {
            alert("This page requires fluid_site.js.");
        } else {
            AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '100%',
                'height', '100%',
                'src', 'index',
                'quality', 'medium',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'showall',
                'devicefont', 'false',
                'wmode', 'window',
                'id', 'index',
                'name', 'index',
                'menu', 'false',
                'allowFullScreen', 'false',
                'allowScriptAccess','sameDomain',
                'movie', 'index',
                'salign', ''
                ); //end AC code
    </script>
    <body>
    <noscript>
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="index" align="middle">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="false" />
        <param name="MENU" value="false">
        <param name=wmode value=window>
        <param name="movie" value="index.swf" /><param name="quality" value="medium" /><embed src="index.swf" quality="medium" width="100%" height="100%" wmode="direct" name="fluid_site" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </object>
    </noscript>
    </body>
    </html>
    Thanks

  • Load swf and play movieclip inside it

    I want to load  a swf and play a moveclip inside it, but the SWFLoad.content always is null. Does sombody know how to resolve this problem?
      private var SWFLoader:Loader;
      public function myApp3()
       SWFLoader = new Loader();
       var request:URLRequest = new URLRequest("FlashAS3_2Flex.swf");
       SWFLoader.load(request);
       this.addChild(SWFLoader);
       var currentSWF = MovieClip(SWFLoader.content);//SWFLoader.content is null
       currentSWF.myClip.gotoAndPlay(1);

    The code you show works fine for me.  How is btn1 created/named in the second swf file?  If you create it dynamically and do not assign a name property to it, it does not have the name you think it does.

  • Using a container to load several swf files and play them

    I need some help. I want to use several swf files and have them be called upon in a container file and play them in sequence. It's a presentation that needs to play thru but still have the ability to stop, click on items, open a popup and then continue on in the presentation. I am building all the individual "chapters" and their "sub-chapters" as swf files, with the hope that I can load them in order. I am relatively new to AS3. Help?

    If you will be loading swf files into a container then you will use the Loader class to accomplish that, so give that a looking over in the help documents and see what you can do.  If you have a problem getting it to work, post your code and describe what you have done.

  • Loading multiple swf's in runtime and playing them one after other

    Hi,
    I am looking for help in loading multiple swf's as a playlist and playing them one after other on top of the other, so here even we have to play with display list for the visiblity.
    Tried to load single files but not getting for multiple files, what will be the event with which the dynamically loaded swf switch to other.These file names will be mentioned in XML file.
    Please let me know your thoughts and will be greatfull if anybody can help with the script or any kind of tutorials.

    Hi,
    First of all am thanking you for showing your kind intrest towards this thread, and appreciate for spending time to work out this issue.
    I will explain you in deatil the issue what am facing,I am working on a project where basically dealing with flv player and videos, am trying to play multiple flv videos of a 3d human character who is speaking out a number like 3550.
    Here we are using multiple video files and joining them like videos where character says 3 then 1000 then  5 then 50.
    The issue here is after every video there is a fraction of second where the character is disappearing from the stage which we can't afford because all the numbers have to be played at once to show it as one single digit.
    So thought of trying swf's instead of flv so that we can omit the gap between the numbers, but even in this swf's also having same issue for a fraction of second the character is missing from the stage.
    I am looking for a solution to this, either the way can work out as flv or swf.For flv am trying to edit some player where we can remove the delay between the clips.
    I am attaching new swf where the character is speaking 3 numbers like 3,1000,40.You can notice there is a flicker between the swf's.
    Can we use Display list with which we can omit that gap.
    Looking for your thoughts and help.
    Thank you

  • My itouch mail keeps loading old emails and displaying them as unread.  If I delete them it just loads 50 more older ones

    My itouch mail keeps loading old emails and displaying them as unread.  If I delete them, 50 more load....old ones that I have long since read and discarded.  Any suggestions.  It appears to be only 1 of my email accounts that does this.  I have deleted the account and resynced to get it back in use, but 50 old emails come up as if they are new unread ones.  Thanks for any help.

    I am having the same issue and it started the same day.  My other mac does it as well but has been an issue for two years.  I just gave up on it and stopped using email from that mac.  I just spend 4 days trouble shooting ti myself when i had time and now spent 2 hours with apple on a chat and screen share and they couldnt solve it either.

  • 18000 and 200gb of iCloud storage how do i up load to iCloud and view them across my iPhone iPad and apple tv?

    I have 18000 photos and i have to signed up to 200gb of iCloud storage how do i up load to iCloud and see them across my iPhone iPad and apple tv?
    I have dragged my entire library over to the iCloud icon on the left side menu bar on my iMac iPhotos.
    i have also signed into iCloud.com but can only see recent few photos taken today on my iPhone and when i have gone to import i can not import for my iPhotos app?
    How do i get these to the cloud to view across my devices?
    What settings do i need to use on my iPhone and iPad?
    Or is iCloud not the best way to store and view my library?
    Thanks Spud

    You are a bit early.
    Wait for a few month.  iCloud Photo Library (Beta) and the Photos.app for Mac are being beta tested now and will be available soon on your Mac. Then you can store your photo library in iCloud and keep optimised versions of your photos on your Mac locally, with the full sized versions in iCloud. And all your devices will be able to access the photos in iCloud.
    See Apple's preview of the new Photos for Mac:  http://www.apple.com/osx/photos-preview/
    Fill your library, not your device.
    iCloud Photo Library can help you make the most of the space on your devices. When you choose "Optimize Mac Storage", it stores all your full-resolution photos and videos in iCloud in their original formats, while keeping storage-saving versions on each device. When you make an edit, the original image will download automatically. You get 5GB of free storage in iCloud — and as your library grows, you have the option to choose a plan for up to 1TB.
    and also:  Photos for the Mac Is Clean, Fast, Connected — and Unfinished
    The iPads and iPhones can already do it, but the Mac can only access this library using the web interface,  see:  iCloud Photo Library beta FAQ
    Use the time, till Photos will be released, to consolidate your photo library. Get all places and faces tagged, all keywords, titles,  and ratings ready, duplicates removed, events and albums well structured, and when Photos will be released, you can simply let it migrate the iPhoto or Aperture library to iCloud Photo Library.  Enable "Optimize Storage" and you will be able to have the bulk of your photos in iCloud.

  • I am trying to use imovie and i have never had this problem before. All of my videos are completly grey and when you try and play them all i get is a black screen but i still hear audio.  Can you please help and tell me what i need to do. Thank you

    I am trying to use imovie and i have never had this problem before. All of my videos are completly grey and when you try and play them all i get is a black screen but i still hear audio.  Can you please help and tell me what i need to do. Thank you

    Make sure all of the videos used in the project that is having that problem are from the same event. If they are from multiple events, move them all into one event.

  • HT1498 can i down mp4 movies and play them on my apple tv from my itunes on my computer

    can i download mp4 and play them on my apple tv from my itunes on my computer

    Welcome to the Apple Community Greglut.
    Yes, but only one at once.

  • I'm having trouble with custom ringtones.  I have downloaded the free software "makeTones" and have created some ringtones.  I then copied those to Mac and played them in ITunes.  My Itunes does not have a ringtone tab.  I can not sync the ringtones.

    I'm having trouble with custom ringtones.  I have downloaded the free software "makeTones" and have created some ringtones.  I then copied those to Mac and played them in ITunes.  My Itunes library does not have a ringtones tab.  I can not sync the ringtones (or I don't know how)!  Please help.

    Yes, the file extension is M4R.  Does it matter where I save these files on my Macbook?  I then opened them in Itunes and played them.  I did find the Tones folder in Itunes but the Tones or Ringtones tab does not show up when I select Iphone (within Itunes).  When I open the Tones folder in the Library, it is empty.  Thanks in advance for your help.

  • New and stupid. I need to capture video clips and play them on an iPad2.

    I've been searching the internet for hours and I can't find an easy way to do this.  I am working on a project for my boss so this is crucial. 
    I have three large video files.  I need to several capture portions of each video and get them onto his iPad so he can view them. 
    The video files are currently in .asf format.  I downloaded Windows Live Movie Maker and can edit the videos in that program, but I cannot convert them into a proper format with this program.  So, I found a program online that will convert the clips into mpeg4 format.  I can convert them, view and play them in iTunes but I can't transfer them to his iPad.
    Personally, I have an iPhone 4 and I am fairly computer literate so I have an understanding of the iPad and can function quite well on my computer.  But, I just can't get this to work. 
    Please help. 

    I am sorry about the VLC suggestion.They do have an Ipad version(http://www.videolan.org/vlc/download-ios.html) but probably for Jailbroken units only.
    In my defense of poor research i have to say that some time ago it was actually possible to download it from the app store which is why i have VLC on my old Ipod.
    If you have to convert i can recommend "handbrake" which is actually a free ripper but it will convert many file formats into predefined settings for different gadgets amongst them Ipad.

  • Does it exist a way to attach sound (and play them) directly from 3d ?

    Hi all,
    I want to know if there is a way to attach sound and play them directly from 3D, like image for background for insteance ?
    see an example >>here<<

    found :
    doc level :
    rm = getAnnotsRichMedia(this.pageNum)[0]; //sound
    JS 3d level :
    host.rm.activated=true;
    host.rm.callAS("multimedia_play");

  • Hello I have problome with YouTube on my apple tv. When I add playlist on my Mac I can see the movies and play them but I can't see the movies on my appletv only the name of the playlist and I am can't watch the movies. Anyone know the problome? Please..

    Hello I have problome with YouTube on my apple tv. When I add playlist on my Mac I can see the movies and play them but I can't see the movies on my appletv only the name of the playlist and I am can't watch the movies. Anyone know the problome? Please..

    Geesh - all this information and no  one has any clue to this? Not even someone from Apple?
    Can someone at least point me in the right direction?

  • Is there any way to download music videos from You Tube and play them on a 2nd generation Nano?

    I want to play you tube music videos on my IPod. I can download them as MP4 but it will not accept them. Does anyone know what file format I could use to get music and video? I know I can convert them to MP3 and play them on IPod. I want to play the music videos too.
    Does any one know? JEKjoy

    Have you been able to successfully import these videos into iTunes?  If so, use iTunes built in converter to convert it to a more iTunes friendly format. To do this, highligh the video and choose "Create iPhone or iPod version" from the Advanced drop down menu in iTunes.
    When it has finished converting, try syncing the new version to your Nano.
    B-rock

  • Is it possible to transfer apps from my macbook to a windows computer and play them

    Is it possible to transfer apps from my macbook to a windows computer and play them?

    Click here and request assistance.
    (76022)

Maybe you are looking for