A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: scripting a sliding door effect

  1. #1
    Join Date
    Aug 2000

    scripting a sliding door effect

    Hello Everyone,

    So I want to create an sliding door sort of effect to cover up a little blink that happens when I load external .swfs into an empty movie clip on the main stage of my site, but I am having trouble scripting it correctly so that the doors close, then load the movie, then open.

    To get an idea of what I am describing, you can look here:


    It seems like a pretty common tack to take, but I am having some trouble.

    Here's what I've done so far. I've created a movieclip which has the sliding door effect and placed that on the layer above my the movie clip which serves as the target for my externally loaded .swfs.

    The movie clip which contains the effect is called "wipe" -- the target clip is called "c".

    On my first navigation button which I am using to test my strategy I have this code:

    on (release) {
    _root.loader("fast", " ", 2);


    "loader" is a function on the root time line which loads different movies into the target "_root.c"

    What I can't figure out is how to make the door animation play until it is fully closed, *then* execute the loader function, *wait* until it knows the load is complete, *then* open back up.

    Does anyone have an idea how I might accomplish this?



  2. #2
    I'm dealing with the same prob...

    can ne1 give an answer 2 this old thread

  3. #3
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Second door on the right, next to the ice bear
    If it's okay with butterflies, here's one
    Attached Files Attached Files

  4. #4
    Join Date
    Aug 2000

    One Way To Do it Using MX

    I can tell you what I did, though perhaps the above .fla contains a more elegant solution.

    Essentially, instead of having a navigational element call my loader function, I had the on (release) event pass variables to that same function which was called from *inside* the sliding door movieclip.

    For example:

    on (release) {
    	_parent.closeDoor ();
    	_global.door = 1;
    	_global.nav_page = "fast";
    	_global.nav_frame = 2;
    	_root.makeList("fast", " ", 2);
    The first line of this tells the doors (which are a movieclip inapproprately named "wipe") to close. I'll explain the variables below. The last line references a function which talks to the back button, and isn't necessary to the door effect.

    In "wipe," the frame on which the doors are "closed" contains a stop action and this code:

    _root.loader(nav_page, nav_button, nav_frame);

    Which passes the values that were set on(release) to my loader function, so that the external .swf only loads when the doors are closed.

    this is that function:

    function loader(page, the_button, frame) {

    "one" in this case, is an instance of the Flash MX loadVars object, so I can use the onLoad method to trigger events only when I know I have my data.

    So, this is how I tell the doors to open:

    one.onLoad = function() {
    _global.the_button = _level0.one.button;
    _global.template = _level0.one.template;
    _global.page = _level0.one.page;
    loadMovie("generic_"+template+".swf", "_root.c");
    if (door == 1 ) {

    eleven being the frame after the one with the stop action inside the clip "wipe", which like I said is poorly named, but in fact is the sliding door clip.

    I hope that makes sense. It's been a while since I did this and I am still pretty new to actionscript.

    I'm sure there are better ways, but I have been helped out a lot in these forums, so when I can toss a tidbit on the fire, I figure I should.

    Good luck,


  5. #5
    thx a lot Ed,

    I know u won't send me ur .fla ...

    but is it be possible 2 send me a stripped down version of it, just 2 understand it more easily

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