Play external swf

I've got some existing swf movie that i want to load into a
another swf as external swf. my problem is that these existing swf
doesn't have stop() at the end of the movie, it plays in a loop.
but i want only want it play once per button release, what should i
do.

Ok I followed your instructions and when I play the main swf
(I call - load_swfs) file it plays part1.swf fine but then it gets
to the first frame of part2.swf (which is blank) and just stops and
doesn't go any farther! Did I put something in the wrong place?
I've written what I did and where below.
// In my main file (load_swfs) it's just a single blank frame
with this code in it :-
tl=this;
swfA=["part1.swf","part2.swf","part3.swf"];
dep=0;
numLoaded = 0;
totalLoad=3;
lo=new Object();
lo.onLoadInit=function(target){
numLoaded++;
checkIfAllLoaded();
function checkIfAllLoaded(){
if(numLoaded==totalLoad){
holder1.play();
} else {
mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
mcl.loadClip(swfA[numLoaded],mc);
mcl=new MovieClipLoader();
mcl.addListener(lo);
mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
mcl.loadClip(swfA[numLoaded],mc);
// In part1.swf in the last frame is :-
tl.holder2.play();
this.removeMovieClip();
// In part2.swf frame 1 is blank with a stop(); and in the
last frame is:-
tl.holder3.play();
this.removeMovieClip();
// In part3.swf frame 1 is blank with a stop();
Let me know where I went wrong!
Thanks

Similar Messages

  • Load and consecutively play external swf's

    Hi,
    I have three external swf files - part1, part2 and part3. I
    know how to load one clip but I would like to know how to
    dynamically load them into an empty MC and then play them in full
    consecutively without any fancy transitions so that it plays like
    one big movie using Actionscript (no button triggers!).
    I have some very BASIC actionscript knowledge but am not sure
    which way is best. If someone could give me some "simple" step by
    step advise it would be grately apreciated.
    Danielle

    Ok I followed your instructions and when I play the main swf
    (I call - load_swfs) file it plays part1.swf fine but then it gets
    to the first frame of part2.swf (which is blank) and just stops and
    doesn't go any farther! Did I put something in the wrong place?
    I've written what I did and where below.
    // In my main file (load_swfs) it's just a single blank frame
    with this code in it :-
    tl=this;
    swfA=["part1.swf","part2.swf","part3.swf"];
    dep=0;
    numLoaded = 0;
    totalLoad=3;
    lo=new Object();
    lo.onLoadInit=function(target){
    numLoaded++;
    checkIfAllLoaded();
    function checkIfAllLoaded(){
    if(numLoaded==totalLoad){
    holder1.play();
    } else {
    mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
    mcl.loadClip(swfA[numLoaded],mc);
    mcl=new MovieClipLoader();
    mcl.addListener(lo);
    mc=this.createEmptyMovieClip("holder"+(numLoaded+1),dep++);
    mcl.loadClip(swfA[numLoaded],mc);
    // In part1.swf in the last frame is :-
    tl.holder2.play();
    this.removeMovieClip();
    // In part2.swf frame 1 is blank with a stop(); and in the
    last frame is:-
    tl.holder3.play();
    this.removeMovieClip();
    // In part3.swf frame 1 is blank with a stop();
    Let me know where I went wrong!
    Thanks

  • Play external swf in sequence

    I am new in Flash and have this little stupid question. I
    have made 3 .swf files and I want to play them one by one in
    sequence automatically. What's the best way to do it?

    Here's a nice trick that Andrei1 taught me  a week ago or so that should sort out your problem:
    On the last frame of partA.swf, you could dispatch an event, like so:
    dispatchEvent(new Event("advanceParentTimeline"));
    Then, in your parent movie on the frame that partA gets loaded, you can listen for the text, like so:
    stage.addEventListener("advanceParentTimeline", onTextRequest, true);
    Add the following function to the same frame with the listener mentioned above, and if your parent movie hears that text, send your movie to frame 2, like so:
    function onTextRequest(e:Event):void {
         gotoAndStop(2);
    Hope that helps,
    ~Chipleh

  • Buttons to play external swf files

    Hello
    I know what to do but I do not know how to do it.
    I want to make some tutorial movies available to users. I
    have about 12 little swf files that were created in camtasia, I
    would like to make them available though a single player instance.
    Here is some AS2 I understand:
    var btnLoadM1:mx.controls.Button;
    //I know I can set the lable of the button, so I must be able
    to set other attributes
    btnLoadM1.label = "Name of Button";
    var mcHolder:MovieClip;
    var oLoader:Object = new Object();
    oLoader.click = function(){
    mcHolder.loadMovie("learning.swf");
    mcHolder._x = btnLoadM1.width + 5;
    mcHolder._y = 0;
    mcHolder._xscale = 90;
    mcHolder._yscale = 90;
    btnLoadM1.addEventListener("click", oLoader);
    This defines one button and loads a movie into a movie clip
    when the button is selected. I want to take all of the specific
    references in the oLoader out, but to have it play a movie which
    has all of its parameters sent by the button which references the
    movie.
    I would like to extend this to include a link to a pdf file
    which could also be made available at the same time as the relevant
    movie was being played.
    any help much appreciated

    Yes...I have published the app and have tested with the same
    result. I am relatively new to flash but have used the getURL
    function in another app which worked. For some reason neither the
    getURL function nor the MovieClip window object worked. Could this
    be a scope problem? The code is included in a datagrid object
    inside a slide of a multi-slide application.

  • External Swf on Android Air and IOS Air

    Hello
    Can android AIR and IOS AIR app download and play external SWF with code inside?
    I have created android AIR app(SDK version 4.0) which load external swf with simple movie clip on the scene.
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
    loader.load(new URLRequest("2.swf"));
    function onLoaded(e:Event):void
         addChild(loader);
    I have installed this android AIR app on device but i do not see external swf on the scene.
    Thanks in advance

    So for ios as3 code must be like this one.?
    var _urlRequest:URLRequest = new URLRequest("2.swf");
    var _loader:Loader = new Loader();
    var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
    _loader.load(_urlRequest, _lc);
    addChild(_loader);
    One more question: How exactly  i can add the external swf to the included files?
    Can you give link with information or some sample? Also, does it work on Android Air?
    If you have sample for ios Air or for Andoid Air i will be very appreciative.
    Sorry for my english.

  • Button from External SWF to Play Movie in Main SWF

    Hi Guys,
    Ok I'm working in Flash 8, Action Script 2;
    I'm building a website, in which the 'Gallery Page' has a link to an external swf file, which is a scrolling clip of thumbnails.
    What I want to do, is create each thumbnail into a button, which will then play a Movie Clip from a frame located in the Main swf file.
    (So basically, each thumbnail button is a small photo, will play that photo in a large scale as a movie)
    eg.
    thumbnail1_btn  needs to go to main swf and play movieclip1.mc, frame 1
    thumbnail2_btn nends to go to main swf and play movieclip1.mc, frame 2
    I'm unsure of the code for this? Or if I've built this up wrong?
    If someone could help me out, that would be great!

    If you haven't set _lockroot on the loaded SWF, than a simple _root call from the loaded SWF will talk to the main SWF.
    IE:
    on(release){
    _root.gotoAndPlay(1);
    If you did set the lockroot, then call the level directly, via:
    on(release){
    _level0.gotoAndPlay(1);
    Once on the root level, you can access a movie clip as normal.
    So:
    on(release){
    _level0.movieClip1.gotoAndPlay(1);
    will call the movie clip "movieClip1" which resides on the timeline of _level0 (which is main.swf in your instance), and tell it to jump to the first frame and start playing.

  • Play - Pause button for external .swf?

    I'm trying to create buttons so a viewer can pause and then play an externally loaded swf. My project can be accessed at the linke below. This is how I want the project to function
         -Click a room on the building (choose Accounting for this discussion)
         -Click one of the demo options (choose Ending a Period for this discussion)
         - Now that the demo plays, I want the user to be able to play and pause the demo swf.
    The demo .swfs were created in Captivate so I don't have access to their timeline. They are loaded into an empty Loader component using the MovieClipLoader Class. Can anyone post some possible solutions to this problem? Thanks!
    http://distribution.activant.com/demos/prophet21-on-demand/

    What would that look like? Right now they're loading using the following code:
    btnCashCollect_btn.onRelease = function () {
          mcLoader.loadClip("CashCollections.swf",myLoader);
          btnEndPeriod_btn.enabled = false;
          btnCashCollect_btn.enabled = false;
          btnFinancialMGMT_btn.enabled = false;
          _root.btnHome_mc._visible = false;
    So would I use something like:
    btnPause.onRelease = function() {
         myLoader.content.pause();
    Actually I just tried that and it didn't work...I need the buttons to work for multiple external swfs that will be loaded into myLoader

  • Play exit animations on multiple external SWF's?

    Hi,
    Here is what I would like to do: I have some buttons, then 2
    movie clips named container and container2. When I click on a
    button, an external SWF is loaded into container. I have it working
    so that when another button is clicked, it plays the exit animation
    of the current SWF, then loads the new one. Here is the code that I
    used for that:
    on a button:
    Code:
    on (release) {
    if (_root.currMovie == undefined) {
    _root.currMovie = "who";
    container.loadMovie("who.swf");
    } else if (_root.currMovie != "who") {
    if (container._currentframe >= container.midframe) {
    _root.currMovie = "who";
    container.play();
    In who.swf frame 1:
    Code:
    midframe = 114;
    In who.swf last frame:
    Code:
    _root.currMovie = undefined;
    stop();
    Frame 114 is where the exit animation starts.
    What I would like to do, is have a button in who.swf, that
    will load another external swf into container2, while leaving
    who.swf in place. Then, when one of the main buttons is clicked, I
    would like it to play the exit animation of the swf that is
    currently in container2, then play the exit animation of the swf
    that is currently in container, then load the new swf into
    container. Can someone please help me out with the code for that?
    Thanks!

    the thing is that i had to keep a reference to my Loader.
    if you dont keep a reference to the Loader who is processing the loadBytes(), the Garbage Collector could close the Loader, wich causes the loader to unload.
    i tried this with a test, i load 1 swf binary with an urlloader, and in the complete-event i create 100 loaders wich do a loadBytes on the loaded bytes.
    the FlashBuilder console traces 100x [SWF] <path> 1000 bytes after decompression, and sometimes i get a whole bunch of [Unload SWF]
    this is because i dont keep any reference to the Loader. if i would keep a reference to the loader stored in an array, i dont get the unload. when the loader is done, you can store the content in a variable, and remove the loader, but as long as its loading, you should keep a reference to the loader.
    Hope this helps others.
    p.s.  i keep seeing [SWF] Main.swf instead of [SWF] <loaded swf file> is because i load the swf with an URLLoader (wich gives no trace), but when i do a loadBytes, it doesnt know its path anymore, so you get the root-swf, Main.swf in this case.

  • Call a external SWF by press the button within another SWF file but the second SWF file play Externely

    Hello Guyz.
    i am working on Macromedia Flash 8 and i just want to call a external SWF when i press the button within another SWF file.......but the second SWF file play Externely............can any one knows the code.... AS2

    try this
    http://www.actionscript.org/forums/showthread.php3?s=&threadid=28123

  • Preload external swf before play

    i have a project i am working on...but for some reason the solution i went with is not satisfying my instructor......
    so....here is my new code ( which is incorrect but i cant figure out how to arrange the preloader at the end )
    var Xpos:Number=0;
    var Ypos:Number=0;
    var swf:MovieClip;
    var bgloader:Loader = new Loader();
    var bgURL
    if(page==1){
    bgURL=new URLRequest("pages/home.swf");
    else if(page==2){
    bgURL=new URLRequest("pages/about.swf");
    else if(page==3){
    bgURL=new URLRequest("pages/projects.swf");
    else if(page==4){
    bgURL=new URLRequest("pages/experimental.swf");
    else if(page==5){
    bgURL=new URLRequest("pages/contact.swf");
    bgloader.load(bgURL);
    bgloader.x=Xpos;
    bgloader.y=Ypos;
    bg.addChild(bgloader);
    stop();
    var percent:Number = bgURL.bytesTotal;
    if(percent==100){
    gotoAndPlay("start");
    first off, i dont even know if what i am being asked to do is possible...but, what i am being requested to do is obviously load in the external swf BUT, the external swf cannot play until the MAIN swf is directed to "start"......
    i have done this numerous times in as1 and 2....but back then things were totally written different and if you do it the same way you run into migration issues....
    i thought this was solved already, but my instructor will not accept the method of using an event to be dispatched in the external SWF to tell the main swf when to play "start"....im not sure if there is any other way to do this?
    he wants the external swf to contain NO code other than what is necessary for its internal functions....
    everything is to be coded in the MAIN swf.....
    so im trying to use bytesTotal, and the percent==100 is just a number i threw in for example purposes.....i am just not figuring this out....
    any help is greatly appreciated

    From what I could gather based on your description, your instructor wants you to start playing when external swf is loaded completely.
    If my understanding is correct, what you need to do conceptually is:
    1. Instantiate Loader
    2. Add event listeners that you are interested in.
    3. Execute code corresponding to these listeners in their corresponding handler functions.
    As for No 2 - Usually there are at least 3 events that are of interest when dealing with Loaders:
    1. Event.COMPLETE - dispatched when entire target is loaded
    2. ProgressEvent.PROGRESS - dispatched when a new bytes packet arrives.
    3. IOErrorEvent.IO_ERROR - dispatched when something goes wrong with loading (say, wrong url, etc.)
    In your particular case it is supposed to be something like this (may not work because you did not describe what is the point of different swfs loading and how it affects entire application). SEE COMMENTS:
    stop();
    var swf:MovieClip;
    // always specify datatype
    var bgURL:URLRequest;
    if(page == 1) {
         bgURL = new URLRequest("pages/home.swf");
    else if (page == 2) {
         bgURL = new URLRequest("pages/about.swf");
    else if (page == 3) {
         bgURL = new URLRequest("pages/projects.swf");
    else if (page == 4) {
         bgURL = new URLRequest("pages/experimental.swf");
    else if (page == 5) {
         bgURL = new URLRequest("pages/contact.swf");
    var bgloader:Loader = new Loader();
    configureListeners();
    // now you are ready to load
    bgloader.load(bgURL);
    * Adds listeners.
    function configureListeners():void {
         // NOTE!!! Listeners are added to contentLoaderInfo - not Loader itself
         bgloader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
         bgloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
         bgloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    * Removes listeners.
    function removeListeners():void {
         bgloader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
         bgloader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
         bgloader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    function onLoadComplete(e:Event):void
         // depeneding on the situation
         // you may want to add loaded swf
         // but before if swf exists - you need to remove it
         if (swf && this.contains(swf)) {
              removeChild(swf);
              swf = null;
         swf = bgloader.content as MovieClip;
         addChild(swf);
         // now play
         this.gotToAndPlay("start");
         // dont't forget to remove listeners
         removeListeners();
    function onLoadError(e:IOErrorEvent):void
         // deal with the error
    function onProgress(e:ProgressEvent):void
         // here you update preloader if you have one
         trace("Progress", e.bytesLoaded, e.bytesTotal);
    On a side note, the way you deal with instnatiating URLRequests is not the most efficient or scalable. A better approach would be to keep them in an array and call by index. Note, conditionals are gone.
    var bgList:Array = [
              "pages/home.swf",
              "pages/about.swf",
              "pages/projects.swf",
              "pages/experimental.swf",
              "pages/contact.swf"];
    var bgURL:URLRequest = new URLRequest(bgList[page]);

  • Simple AS3 external swf playing code?

    Hi
    I'm after some REALLY simple code, and am happy to pay someone via Paypal to do this for me.
    I want to have a one frame piece of AS3 code that loads in external swfs from an array.
    I want external swf 1 to play, and when it's finished, swf 1 unloads from memory, and then external swf 2 starts playing and so on through the array.
    When the end of the array is met, it loops back to the first swf and starts again.
    I don't need transition effects or anything like that.
    This is to be used for an offline project, so it's not connected to the web.
    I've been playing with it for a while myself, but can't get this to work.  It should be a simple and quick job for someone out there.  Just load a new swf into the child holder and play.  When that swf's finished playing, dump it, and load in and play the next one.
    Thanks for your help.
    Shaun

    Nothing at this stage - I'm still experimenting to figure out the best way to do it.  I found something like what I want at http://www.flashandmath.com/intermediate/externalclips/ext_clip2.html (without button control though - there's a code addition at the bottom to add in to make the swfs play by themselves).
    The problem with the above example is I can't get any external swfs besides the example ones to play.  I even tried renaming my as3 swfs to clip0 etc, but still nothing.
    If someone can make it for me, and it means I have to add some code to the end of each external swf, if they can include the code to add, I can incorporate it no probs.
    Cheers
    Shaun

  • Dling external .swf files while main movie is playing

    Does anybody know a command to have your flash movie download
    external .swf movies within the "main" movie while playing. I have
    about 8 .swf's that are all linked together but the problem is the
    loading of each one seperatly (kinda lags a bit b4 each movie is
    loaded, because you have to download each and everyone) PLEASE help
    me out I'm working on a big project here at work :yikes: Thank
    you!!

    jsns wrote:
    > Does anybody know a command to have your flash movie
    download external .swf
    > movies within the "main" movie while playing. I have
    about 8 .swf's that are
    > all linked together but the problem is the loading of
    each one seperatly (kinda
    > lags a bit b4 each movie is loaded, because you have to
    download each and
    > everyone) PLEASE help me out I'm working on a big
    project here at work
    > :yikes: Thank you!!
    >
    check help files for details and usage of "loadmovie" and
    "loadmovienum" actions.
    Best Regards
    Urami
    !!!!!!! Merry Christmas !!!!!!!
    Happy New Year
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • External .swf files not playing, or showing up

    Hello All,
    I'm a bit confused. I have created a video interface (vidPlayer.swf) file, and am calling on external .swf's (movieName.swf), which contain paths to the original .flv files (movieName.flv) that are to play. The navigation lives on the the main interface file (vidPlayer.swf). This works fine when I'm publishing locally from my system, or if I upload it to a remote server, and play it on my computer. When another individual attempts to either (a.) play it from the server on their system, or (b.) publish it to the web for it's intended use, the interface appears and the loader performs when video track is selected, but the video never plays. Only on my system does it work. Even from a remote server, it plays on my system.
    I have not wrapped my head completely around AS3 yet, so I'm using deprecated script. On the main interface swf (vidPlayer.swf) I have the following script controlling the loader ( I also use this same loading script for the external video swf's):
    stop();
    myInterval = setInterval(preloader, 10);
    function preloader(){
    if (getBytesLoaded()>=getBytesTotal()){
    play();
    clearInterval(myInterval);}
    loadBar_mc._xscale = (getBytesLoaded()/getBytesTotal())*100;
    loader_txt.text=Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
    On the navigation buttons (tracks), I have the following script (there are 14 tracks total, so the content varies between load and unload content):
    on (release){
    mc_videoPlayer.unloadMovie("02-systemAdministration.swf");
    mc_videoPlayer.unloadMovie("03-gatewaySetUp.swf");
    mc_videoPlayer.unloadMovie("04-homePage.swf");
    mc_videoPlayer.unloadMovie("05-addUser.swf");
    mc_videoPlayer.unloadMovie("06-changePasswordOrPermission.swf");
    mc_videoPlayer.unloadMovie("07-inventorySetUp.swf");
    mc_videoPlayer.unloadMovie("08-storageContainer.swf");
    mc_videoPlayer.unloadMovie("09-addDeicingOperator.swf");
    mc_videoPlayer.unloadMovie("10-orderCryotechProducts.swf");
    mc_videoPlayer.unloadMovie("11-recordDelivery.swf");
    mc_videoPlayer.unloadMovie("12-adjustInventory.swf");
    mc_videoPlayer.unloadMovie("13-deicingLog.swf");
    mc_videoPlayer.unloadMovie("14-PTOCClog.swf");
    _root.gotoAndStop(11);
    mc_videoPlayer.loadMovie("01-firstLogin.swf");
    I have all the .swf's (movieName.swf), .flv's (movieName.flv) and main interface .swf (vidPlayer.swf) in the same folder, so there shouldn't be any missing directory paths.
    I don't know what's going on! I have this set up exactly as a previouse project, using the same interface, scripting and file directory, and it words perfectly from any system, being hosted from anywhere.
    Can anyone help????
    [ I'm working with Flash, CS3 - actions script 2 ]
    Thanks in advance,
    James

    problem solved. Solution? Redo the entire f&%#ing thing. For what ever reason, it now works.
    Thanks anyways.
    James

  • How can I stop timeline sounds in external swf files from playing during loading?

    I am having a problem with timeline sounds in external swf files playing during loading in a main swf. Can anyone help me?
    Here is some of the code from the main swf. I hope I have included enough.
    Thanks.
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
                    tl["loader_"+index] = new Loader();
                    tl["loader_"+index].name = index.toString();
                    tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
                    tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
                    tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
                    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
                    preloader_mc.fill_mc.scaleX = fractionLoaded;
                    preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
                    tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
                    SoundMixer.stopAll();
                    var mc:MovieClip = MovieClip(tl["loader_"+index].content);
                    mc.gotoAndStop(1);
                    frameA.push(mc.totalFrames);
                    index++;
                    if(index<swfA.length){
                                    loadNextF();
                    } else {
                                    // all loads complete.  start play.
                                    restart_mc.buttonMode = true;
                                    restart_mc.alpha = 1;
                                    tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
                                    tl.removeChild(preloader_mc);
                                    preloader_mc = null;
                                    play_slider.enabled = true;
                                    playpause_mc.alpha = 1;
                                    currentLoader = tl["loader_0"];
                                    tl.addChild(currentLoader);
                                    MovieClip(currentLoader.content).play();
                                    sliderParamsF();

    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.ProgressEvent;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.SliderEvent;
    import flash.media.SoundTransform;
    preloader_mc.fill_mc.scaleX = 0;
    var swfA:Array = ["part1.swf","part2.swf"];
    var frameA:Array = [];
    var currentLoader:Loader;
    var swfTotalFrames:int;
    var tl:MovieClip = this;
    var st:SoundTransform = new SoundTransform()
    var index:int = 0;
    loadNextF();
    play_slider.enabled = false;
    function loadNextF():void{
        tl["loader_"+index] = new Loader();
        tl["loader_"+index].name = index.toString();
        tl["loader_"+index].contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressF);
        tl["loader_"+index].contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);
        tl["loader_"+index].load(new URLRequest(swfA[index]));
    function progressF(e:ProgressEvent):void{
        var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);
        preloader_mc.fill_mc.scaleX = fractionLoaded;
        preloader_mc.tf.text = (100*fractionLoaded)+"% Loaded";
    function completeF(e:Event):void{
        tl["loader_"+index].contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,progress F);
        tl["loader_"+index].contentLoaderInfo.removeEventListener(Event.COMPLETE,completeF);
        SoundMixer.stopAll();
        var mc:MovieClip = MovieClip(tl["loader_"+index].content);
        mc.gotoAndStop(1);
        frameA.push(mc.totalFrames);
        index++;
        if(index<swfA.length){
            loadNextF();
        } else {
            // all loads complete.  start play.
            restart_mc.buttonMode = true;
            restart_mc.alpha = 1;
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            tl.removeChild(preloader_mc);
            preloader_mc = null;
            play_slider.enabled = true;
            playpause_mc.alpha = 1;
            currentLoader = tl["loader_0"];
            tl.addChild(currentLoader);
            MovieClip(currentLoader.content).play();
            sliderParamsF();
    ///////////////// start sliders /////////////////////////////////
    sound_slider.addEventListener(SliderEvent.CHANGE,soundSliderF);
    function soundSliderF(e:SliderEvent):void{
        st.volume = e.value/100;
        tl.soundTransform = st;
    play_slider.addEventListener(SliderEvent.CHANGE,playSliderF);
    play_slider.addEventListener(MouseEvent.MOUSE_DOWN,playSliderDownF);
    //play_slider.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderDownF(e:MouseEvent):void{
        tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
        stage.addEventListener(MouseEvent.MOUSE_UP,playSliderUpF);
    function playSliderUpF(e:MouseEvent):void{
        tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
    function playSliderF(e:SliderEvent):void{
        SoundMixer.stopAll();
        var frameNum:int = Math.ceil(swfTotalFrames*e.value/100);
        var partialTotalFrames:int = 0;
        for(var i:int=0;i<frameA.length;i++){
            partialTotalFrames += frameA[i];
            if(partialTotalFrames>=frameNum){
                break;
        partialTotalFrames -= frameA[i];
        //trace(i,frameNum,frameNum-partialTotalFrames);
        if(currentLoader!=tl["loader_"+(i)]){
            tl.removeChild(currentLoader);
            MovieClip(currentLoader.content).stop();
            currentLoader = tl["loader_"+(i)];
            tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(frameNum-partialTotalFrames);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(frameNum-partialTotalFrames);
    function sliderUpdateF(e:Event):void{
        var playedFrames:int = 0;
        for(var i:int=0;i<Number(currentLoader.name);i++){
            playedFrames += frameA[i];
        playedFrames += MovieClip(currentLoader.content).currentFrame;
        play_slider.value = Math.round(100*playedFrames/swfTotalFrames);
    function sliderParamsF():void{
        swfTotalFrames = 0;
        for(var i:int=0;i<swfA.length;i++){
            swfTotalFrames += MovieClip(tl["loader_"+i].content).totalFrames;
    ///////////////// end  sliders //////////////////////////////////
    ///////////////// start playpause restart ///////////////////////
    playpause_mc.addEventListener(MouseEvent.CLICK,playpauseF);
    playpause_mc.alpha = .2;
    restart_mc.addEventListener(MouseEvent.CLICK,restartF);
    restart_mc.buttonMode = false;
    restart_mc.alpha = .2;
    function playpauseF(e:MouseEvent):void{
        if(!e.currentTarget.toggle){
            MovieClip(currentLoader.content).stop();
            tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(2);
        } else {
            MovieClip(currentLoader.content).play();
            tl.addEventListener(Event.ENTER_FRAME,playUpdateF);
            e.currentTarget.gotoAndStop(1);
        e.currentTarget.toggle = !e.currentTarget.toggle;
    ///////////////// end playpause //////////////////////////////
    function playUpdateF(e:Event):void{
        sliderUpdateF(e);
        var playingFrame:int = MovieClip(currentLoader.content).currentFrame;
        if(playingFrame==frameA[Number(currentLoader.name)]){
            // next loader
            MovieClip(currentLoader.content).stop();
            SoundMixer.stopAll();
            MovieClip(currentLoader.content).mute();
            var nextIndex:int = Number(currentLoader.name)+1;
            if(nextIndex<swfA.length){
                tl.removeChild(currentLoader);
                currentLoader = tl["loader_"+nextIndex];
                tl.addChild(currentLoader);
                MovieClip(currentLoader.content).gotoAndPlay(1);
            } else {
                tl.removeEventListener(Event.ENTER_FRAME,playUpdateF);
                playpause_mc.gotoAndStop(2);
                playpause_mc.toggle = !playpause_mc.toggle;
                //playpause_mc.alpha = .2;
                // all swfs have completed play
    function restartF(e:MouseEvent):void{
        MovieClip(currentLoader.content).stop();
        tl.removeChild(currentLoader);
        SoundMixer.stopAll();
        MovieClip(currentLoader.content).mute();
        currentLoader = tl["loader_"+0];
        tl.addChild(currentLoader);
        if(playpause_mc.currentFrame==1){
            MovieClip(currentLoader.content).gotoAndPlay(1);
        } else {
            MovieClip(currentLoader.content).gotoAndStop(1);

  • External swf plays to fast

    I am fairly new to using Actionscript and am having trouble
    figuring out what I need to do. I have a main document that calls
    modular .swf movies that I have set up. After I have audio play it
    loads up a .swf with a powerpoint that I converted to flash. When I
    play it in my main document it plays way to fast. I've tried
    "document.frameRate = 0.3" in the powerpoint flash, but that
    doesn't work. I need someone to point me in the right direction
    please.

    Your main loader swf ( the one you are loading all other
    external swf's into) controls the frame rate of all "Child" swf's.
    So, if you are loading a swf that runs great at 25 frames a sencond
    into one that is set to 50 frames a second, if will run twice as
    fast.
    IM assuming here that you are loading one into another. IF
    this is not the case and are loading single swf's into a basic html
    page, then you need to look at the expert settings in the PP
    application. Im pretty sure that once you have set the frame rate
    within the swf, there is nothing you can do externaly to control
    the rate.
    I would be interested myself if there is a way but Im pretty
    sure theres not.

Maybe you are looking for

  • Af:fileDownloadActionListener picks wrong filename for the first time after row selection.

    Hi, I am using Oracle Jdeveloper 11g release 1. In one of my jspx pages i have a table, i can select one of the row and click on a button which invokes fileDownloadActionListener. The code of jspx is as below: <af:commandMenuItem text="#{coregccompli

  • Partial payment to vendor...

    Dear All,    Is it possible to give partial payment to vendor through APP, if so, where it is to be configured... Regards, Suresh Patipati.

  • Ipod freezing repetitively

    My ipod (a 30 gig color with photo capacity but before they added video) likes to freeze up around every 15 minutes or so. I've looked all over these pages, and tried the reset tactics listed. After reseting a couple of times, it will work again for

  • N8 and wireless router connectivity

    I have a problem with my new N8. If I use the N8 at home it interferes with my broadband wireless router (BT Homehub) resulting in my losing a wireless internet connection on my laptop.  The laptop tells me I have Limited Connectivity. I must thenkee

  • JDialog unknown compiler error?

    Hello, I wrote this basic code to learn the use of JDialogs, the problem is when I tried to add the model and title to the Dialog class constructor, I got this compiler error: TestGUI.java:24: cannot resolve symbol symbol : constructor TestDialog (Te