A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: script for playing a MC after another!

  1. #1
    registered misuser
    Join Date
    Feb 2004
    Location
    Io, Vicinity of Jupiter
    Posts
    157

    script for playing a MC after another!

    Hiya,

    This should be simple.

    I have 2 Movie Clips. MC1 and MC2. I want MC2 to start playing automatically after MC1 has finished playing.

    So far I thought about this and I'm curently testing it:
    Code:
    this.onEnterFrame = function() {
    _level0.attachMovie("MC2","MC2", 10)
    }
    This script would be placed on the last frame of MC1.

    While flash is exporting the movie, I was wondering if there was a better way to do this? Any idea?

    thanks

    p.

  2. #2
    Member
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    36
    I guess there are alot of different ways to the same result here, here are some.

    #1 At the last frame of MC1:
    Code:
    _parent.attachMovie("linkageName", "MC2", getNextHighestDepth());
    removeMovieClip(this);
    #2 Simply make the first frame of MC2 empty (with a stop()), put both MC1 and 2 on the stage. Then on the last frame of MC1 write:
    Code:
    _parent.MC2.play();
    removeMovieClip(this);
    #4 If MC1/2 are in the root, and you want to keep the script outside of the MC:s you could use an onEnterFrame function, however it would cause unnecessary cpu usage (although minimal). In the root actions layer:
    Code:
    MC1.onEnterFrame = function() {
          if(this._currentframe == this._totalframes) {
                //attachMov...
                //removeMov...
          }
    }

  3. #3
    registered misuser
    Join Date
    Feb 2004
    Location
    Io, Vicinity of Jupiter
    Posts
    157
    Thanks iONx,

    testing the movie, my method works great! So I'll stick with this one. But thanks a lot for your input because it showed me other ways to do this and this is great knowledge.

    Thanks for sharing

    Way to go for that Gold in hockey

    p.

  4. #4
    Member
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    36
    No problem.
    Yeah that gold medal was a nice surprise, didn't expect our team to do that good :P

  5. #5
    Member
    Join Date
    Feb 2006
    Posts
    62
    i have a similar problem. im using the script below to load external swf clips. the script loads "clip01.swf" by default. what i want is for the script to start loading another clip (lets say "clip02.swf") as soon as the first one finishes (which of course has to be unloaded) and so on. so basically i'd have a sequence of separate external swf clips that get automatically loaded one after another. any ideas how to do that? thanks a lot!



    MovieClip.prototype.fadeIn = function() {
    this.onEnterFrame = function() {
    if (this._alpha<100) {
    this._alpha += 10;
    } else {
    delete this.onEnterFrame;
    }
    };
    };
    ad_preloader._visible = false;
    loading_text02._visible = false;
    var empty = this.createEmptyMovieClip("container", "100");
    empty._x = 240;
    empty._y = 263;
    my_mc = new MovieClipLoader();
    preload = new Object();
    my_mc.addListener(preload);
    preload.onLoadStart = function(targetMC) {
    trace("started loading "+targetMC);
    container._alpha = 0;
    ad_preloader._visible = true;
    loading_text02._visible = true;
    };
    preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
    ad_preloader._width = (lBytes/tBytes)*100;
    };
    preload.onLoadComplete = function(targetMC) {
    container.fadeIn();
    loading_text02._visible = false;
    ad_preloader._visible = false;
    trace(targetMC+" finished");
    };
    //default image
    my_mc.loadClip("clip01.swf", "container");

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