A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Help playing multiple SWFs in order on separate timeline

  1. #1
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204

    Help playing multiple SWFs in order on separate timeline

    Ok, I have about 12 separate SWFs that are all imported and played through a separate SWF that acts as a wrapper with a menu, etc.

    I want to be able to load the SWFs continuously on the main timeline when each SWF finishes it goes to another frame label on the main timeline and loads the next SWF and continues to play.

    I am aware that I can use loadMovieNum("file1.swf", 1); but that just overlapps what just played and has no communication with the "main" SWF to trigger other actions.

    Any help is GREATLY appreciated!

    Thanks in advance!

    /zach

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    dont use loadMoiveNum...but instead use loadMovie..and load into a target instead of a _level.

    example.. you have a blank/empty movieClip on your stage. it has the instance name of "containerClip"

    you can use:
    code:

    containerClip.loadMovie("external.swf");



    to load your external.swf into a "target"...you now have more control over it..to move it..scale it..whatever you can do a regular movieClip..

    and no in the last frame of your external.swf you just loaded..you can put the same line of code...but load in your next .swf

    (may have to use _parent.containerClip though...depending on where you calling it from.)

  3. #3
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Thx Whispers!

    How would I signal a SWF change back to the "main" SWF file that contains all the "loadMovie" SWFs?

  4. #4
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285
    Hi,
    If u have loaded a movie at level 1 u can make it communicate with the the main movie in which it has been lkoaded by using level numbers.
    For example if u have a movie loaded at level1 and u want it to do something to the main movie say to make at stop at some frame label u can do it as follows

    _level0.gotoAndStop("labelName");

    I think this would work

  5. #5
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Another problem I have is that my SWF "wrapper" in not above the loaded SWFs. They appear over the menu and everything else... any ideas?!?!

    Thanks a lot for your help!!!

  6. #6
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285
    By default movie loaded at level1 will appear above and over the movie at level0 as levels follow a stacking order.
    A simple technique to avoid this prpoblem may be to place a reference image of ur wrapper in a guide layer and then deisgn the rest of the swf's accordingly so that they dont overlap each other

  7. #7
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Is there a way to just replace the swf that just finished playing with a new one?

    Or is there a way to tell the SWF to play within a MC in another SWF that contains the menu, etc?

    Your help is greatly appreciated!
    /zach

  8. #8

  9. #9
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Whispers,
    Can you help me with this with an example or anything?

    Thanks a lot!
    /zach

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    what is it you want an example of?

    you want to load an external.swf into your MAIN.swf?...right?..when this external1.swf gets done playing..you want it load the next external2.swf Is this correct?

  11. #11
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    yea! so the main.SWF acts as a wrapper with a menu overlay, etc... I am loading about 10 other SWFs into it. So I have it continuously playing with (loadMovieNum) but it's playing on top of the "wrapper" and I have no control to tell main.swf that a new movie has been loaded.

    Any insight you have is appreciated!

    Thanks!
    /zach

  12. #12
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    well, first I would use loadMovie instead of loadMovieNum.

    loadMovieNum uses _levels to load your content/.swf's which is like a stack of papers..
    1 sheet on top of another..

    "loadMovie" on the other hand..loads yoru content into a target (empty movieClip)..and hence "acts as a wrapper" itself.

    so in yoru MAIN (index) .swf you have your logo/buttons/etc..etc..
    and on a NEW layer...you have an empty/blank MC that you have dragged form yoru library...make sure you give it an INSTANCE NAME. for this example we'll use containerClip.

    So now on your buttons, you put the code of:
    code:

    on (press) {
    _root.containerClip.loadMovie("external1.swf");
    }


    this now loads that external.swf into the target clip containerClip...

    if you have another button with the code of:
    code:

    on (press) {
    _root.containerClip.loadMovie("external2.swf");
    }



    it will remove the content already in containerClip (which was external1.swf)..and place external2.swf there.. (no need to unload anything)..

    now...if you wanted to target a movieClip or variable in one of your external.swf's you just loaded... you will now need to use "containerClip" in yoru path to it. So if there was a movieClip in external1.swf that I wanted to change the _alpha of. I would do it like so:
    code:

    _root.containerClip.someClip._alpha = 25;
    }



    a common problem you will run into is, when you created your external.swf, if you used _root in any of yoru code to make things work..once you load them into the MAIN(wrapper).swf they will no longer work..as _root refers to the MAIN (wrapper) timeline.

  13. #13
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    So say if I had one SWF that was the menu, etc and I wanted to load 10 separate SWFs that continuously play under the wrapper. Would I use instanceofMConmainswf.loadMovie("file1.swf"); ?

    I tried that and it didnt work

    Thanks!
    Zach

  14. #14
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    no... if you had a MAIN.swf with your menu and stuff in it...you would need to create the containerClip as talked about above...and load into that.

    if you want to load UNDER the wrapper..which is your _root (main) movie..then you'll need to load your MAIN movie into a _level itself..and since you cant get any lower than 0 ....you have to load it into a _level higher than that.

    So you will need another .swf that just has the load action to load your (once) main movie into a _level higher than 0 so you can load yoru external.swf content under it.. (not recommended)

    heres an exmaple of the way it SHOULD be done.

  15. #15

  16. #16
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    Thx Whispers!

    After External1.swf is loaded I wanted to continuously play External2.swf > External3.swf and still have it remain under the wrapper. How would that happen?

    I really appreciate your help! Thanks a lot!

    /zach

  17. #17
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    see post #2 was my first solution/suggestion to you.

    if you put that in the last frame of the external.swf's (obviously with the correct name) it should all work fine..

  18. #18
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204
    I have attached the problem... I need all the files to play behind the main SWF and be able to change menu status on the main.SWF

    Thanks for the help!!!
    /zach
    Attached Files Attached Files

  19. #19
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    how & what is "chaning menu status" and what is it you want it to do??

  20. #20
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    also I see in yo exteral.swf's you have this code:
    code:

    loadMovieNum("v2.swf", 1);



    it should be:
    code:

    _root.mcHolder.loadMovie("v2.swf");



    when you do it like the FIRST one..you are loading on TOP of things again..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center