A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 53

Thread: loading in and out external swf's

  1. #21
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    1) you *can* use the same technique (with the gotoAndPlay('framelabel'); instruction);
    2) you are now loading externals inside movieclips. you are NOT working with levels anymore (all your stuff is on _level0, which is the basic and only level);

    Anyway you just need to place a button, on the main movie, on the main timeline, with the following code:
    Code:
    on(release) {
        gotoAndPlay('exit');
    }
    if you compare the code in this button and in the previous ones you should understand how it basically works.
    You can point to any referrable element through coding by using paths.

    Cheers
    Altruism does not exist. Sustainability must be made profitable.

  2. #22
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    when I do this, it plays the 'exit' frame anim but at the same time loads in external movies, the exit outro on main movie gets cut short when the external starts to load in, is there some way I can get it to play the full 'exit' outro in the main movie before the other external movies load in??

    this is what I put on the buttons:

    on(release) {
    gotoAndPlay('exit');
    initMovieLoad('technology.swf'); // you must put your paths to movies to be loaded
    }

    so its playing and loading the anim and external swf at the same time??? doh!

  3. #23
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    I'm sorry, I don't undestand what you are trying to do here.
    I though you wanted an exit animation for the main movie...

    In the meantime you should go through the Flash Help menu and look at the basic samples and lessons to gain the basic knowledge required to develop things in Flash.
    It will be much simpler for you to advance your skills if you (at least at the very beginning) learn in a linear way.
    Flash is made of a bunch of simple things put together, but you need to know how they work to put them together.
    Just trying to make your life easier, I don't think we'll go very far by giving you the specific code for your needs, if you don't understand how and why it is made like that (mostly because Flash is extremely flexible, giving you a variety of solutions for most problems.. in this way you will be biased on my method, instead of understanding the problem and choosing a solution for yourself!)

    In other words, it is better for you if you ask "why does this go like that", instead of "how do I do this". Once you gaind the knowledge, you can figure out for your self the "why"!

    Always keep some headeach pills with you, it's a rough job but it will give you satisfactions after a while!
    Altruism does not exist. Sustainability must be made profitable.

  4. #24
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    thats correct just so I can fade out any images that are loaded in the main movie area so that when the external swf loads in, in the same place the image thats in the main movie animates away, hence the 'exit' anim for the main movie

    cheers for all your help!

  5. #25
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    We'll have to do a dirty trick here, to keep mods cheap.

    In this case, the only way to interfere the least with what has already been done is using a "jolly" value for the movieToBeLoaded path.

    The main exit button will so have the same code as the other buttons, but the path to the movie to be loaded will be exactly "mainExit".

    At this point, the only thing you need to change is the following function:
    Code:
    _global.loadNewMovie = function() {
    	if(movieToBeLoaded == "mainExit") {
    		gotoAndPlay('exit');
    	} else {
    		monkey.loadMovie(movieToBeLoaded); // change pathToContainer to the INSTANCE NAME of the empty movieclip used as container;
    	}
    }
    Cheers
    Altruism does not exist. Sustainability must be made profitable.

  6. #26
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    i can see what we are trying to do, but I cant seem to get it working I change to code

    from:

    function initMovieLoad(path) {
    trace("initMovieLoad");
    movieToBeLoaded = path;
    if(!initializedExternalMovies) {
    trace("initializing");
    initializedExternalMovies = true;
    _global.loadNewMovie();
    } else {
    trace("calling playback animation..");
    monkey.gotoAndPlay('exit'); // the loaded movies need to have a frame labeled "exit", which will be the first frame of the out animation
    }
    }
    _global.loadNewMovie = function() {
    //trace("loadNewMovie: " + monkey._target);
    //monkey.loadMovie(movieToBeLoaded); // change pathToContainer to the INSTANCE NAME of the empty movieclip used as container;
    }

    to:

    function initMovieLoad(path) {
    trace("initMovieLoad");
    movieToBeLoaded = path;
    if(!initializedExternalMovies) {
    trace("initializing");
    initializedExternalMovies = true;
    _global.loadNewMovie();
    } else {
    trace("calling playback animation..");
    monkey.gotoAndPlay('exit'); // the loaded movies need to have a frame labeled "exit", which will be the first frame of the out animation
    }
    }
    _global.loadNewMovie = function() {
    if(movieToBeLoaded == "mainExit") {
    gotoAndPlay('exit');
    } else {
    monkey.loadMovie(movieToBeLoaded); // change pathToContainer to the INSTANCE NAME of the empty movieclip used as container;
    }
    }

    is this correct, can't seem to get it working, changed the frame to 'mainExit' on the outro animin the maain movie, mmmhhhh! am I missing something???

  7. #27
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    is because I need the same script

    _global.loadNewMovie();

    at the end of the outro anim in the main movie ???????

  8. #28
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    no, not that : (

  9. #29
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    you must call the frame "exit".

    the code in the button for the main exit:
    Code:
    on(release) {
        initMovieLoad('mainExit');
    }
    Altruism does not exist. Sustainability must be made profitable.

  10. #30
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    hey dude

    one thing I notice with all this is because the menu buttons are in a drop down, if you notice the external movies that load in, load over the top of the drop down menu, (press the 'how it works' button in the first section then rollover 'saferisk' section you can see the blue square overlapping the menu drop down??)
    is there a way I can get them to load behind the navigation drop down menus?

    I tried loading the navigation section into a higher level but no joy! does this make any sense......got some pain killers before, going stir crazy here. AARRRRHHH!!!

    just added the

    on(release) {
    initMovieLoad('mainExit');
    }

    so I now have on all buttons:

    on(release) {
    initMovieLoad('mainExit');
    initMovieLoad('technology.swf'); // you must put your paths to movies to be loaded
    }

    nothing seems to happen, not sure whats happening there???

  11. #31
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    hey dude

    I know I probably peppered your head with all these questions, if would just help with the over lapping thing , that will be my last cry for help

  12. #32
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    hey dude

    I got the over lapping sorted, any chance you could help me with that final outro in the main movie

    on buttons:
    on(release) {
    initMovieLoad('mainExit');
    }

    and frame:
    global.loadNewMovie = function() {
    if(movieToBeLoaded == "mainExit") {
    gotoAndPlay('exit');
    } else {
    monkey.loadMovie(movieToBeLoaded); // change pathToContainer to the INSTANCE NAME of the empty movieclip used as container;
    }
    }

    no joy, what am I doing wrong???

  13. #33
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    look at the function declaration:

    it's:

    _global

    not:

    global



    _global is a keyword, for the global scape of variables.
    Altruism does not exist. Sustainability must be made profitable.

  14. #34
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    sorted that out, still no joy with it running the "mainExit" frame in the main movie to play out the outro???

    this is on the button at the mo

    on(release) {
    initMovieLoad('mainExit');
    initMovieLoad('technology.swf'); // you must put your paths to movies to be loaded
    }

    N.B is the 'mainExit' this is refering to a marker in the main movie, for the outro anim, yes?
    I think this is where I'm a little confused?

  15. #35
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    no, on the main exit button you must just give the following actions:
    Code:
    on(release) {
        initMovieLoad('mainExit');
    }
    'mainExit' is just a keyword we defined for the function that controls the loading of new movies, to tell it to behave in a different way.
    The function will determine if it has to execute the mian exit with this:
    Code:
    ....
    if(var=='mainExit') {
    ....
    Altruism does not exist. Sustainability must be made profitable.

  16. #36
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    so I have on my buttons:

    on(release) {

    initMovieLoad('mainExit');
    initMovieLoad('technology.swf');
    }

    if I leave

    initMovieLoad('technology.swf');(^as above^)

    on the button , it plays the external movie, but not the outro anim in main movie! if take it out it plays the outro anim in main movie, but now doesn't play the external movie, mmmhhh!?


    this is on frame function:

    function initMovieLoad(path) {
    trace("initMovieLoad");
    movieToBeLoaded = path;
    if(!initializedExternalMovies) {
    trace("initializing");
    initializedExternalMovies = true;
    _global.loadNewMovie();
    } else {
    trace("calling playback animation..");
    monkey.gotoAndPlay('exit'); // the loaded movies need to have a frame labeled "exit", which will be the first frame of the out animation
    }
    }
    _global.loadNewMovie = function() {
    if(movieToBeLoaded == "mainExit") { <<is this part correct???
    gotoAndPlay('exit');
    } else {
    monkey.loadMovie(movieToBeLoaded); // change pathToContainer to the INSTANCE NAME of the empty movieclip used as container;
    }
    }

  17. #37
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    Why did you do this?
    Code:
    on(release) {
    
        initMovieLoad('mainExit');
        initMovieLoad('technology.swf');
    }
    You are calling the main exit, but just after that you're calling the external movie...
    You must do it like this:
    Code:
    on(release) {
        initMovieLoad('mainExit');
    }

    You are getting too confused, I think you should really step back and learn the basic stuff, there is no way you can organize your knowledge without it! I tell you, it will be MUCH easier, if you do things in the right order.
    Altruism does not exist. Sustainability must be made profitable.

  18. #38
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    thats correct, thats what I'm trying to do!

    let Me explain:
    once a button is pressed
    first :
    I would like to play out the outro anim from the main movie that we all already in

    second:
    once played out the outro, then I would like it to load the selected external movie.

    so I thought by putting

    initMovieLoad('technology.swf');

    on the button it would play that particular external movie, so for example if a different button was click it would then load that particular movie whether it be lets for example, technology, history and so....

    sorry if this is a little unclear, kinda hard to explain

  19. #39
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    Well, usually the best way to organize things is to avoid putting any graphics and animations on the main timeline.

    Think about your projects as modular structures. Try to put everything in it's own little box that can be controlled via script.


    What is the purpose of the main animation? Does it have to play before you load any external movie?

    Anyway what I mean is that it really looks like you are missing fundamental knowledge about movieclips, loading external movies, nesting movies etc.. you should digest a bunch of tutorials before going on. Attack one problem at a time. The stuff you are trying to do is at intermediate-to-advanced level. Ok I won't bug anymore on this, it's your choice! :P

    Just try to be more specific. Describe me some use-case-scenarios.
    Altruism does not exist. Sustainability must be made profitable.

  20. #40
    Senior Member
    Join Date
    Jun 2006
    Posts
    136
    yeah I totally understand where your coming from, you now when you've got something in your head and you get so far you just wanna see it through. just bought some more headache pills when I nail this I'm going to breaj it down and go back to basics and do what you suggested and get a better understanding/knowledge of movieclip etc!

    ok here we go : )
    purpose of main animation. Its not really a main anim is just a little outro. all it is, is an animated line that moves down so that the external can load in!

    can I send you the demo fla, and you can see the outro anim and what it does, might be easier than trying to explain through text???

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