A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Trouble attaching movie

  1. #1

    Trouble attaching movie

    I have a movie that has pictures on individual frames. I am trying to attach a movie that fades in frame1, waits a specified period of time then moves to frame 2. Unfortunately, I can't get the movie to work right. When I place a stop(); in the actions pane the fader doesn't work. However, the setInterval(); function moves to the next frame. If I remove the stop(); the attached fader movie works on the second frame instead of the first frame.

    Here is my code:

    stop();
    onEnterFrame = function(){
    _root.attachmovie("fader", "fader", 1); //Loads a fader movie over the pic
    this._y = 0;
    this._x = 0;
    }


    function wait() { // a function called 'wait'
    _root.nextFrame();
    clearInterval(myTimer);

    // the action you want, in this case a trace.
    }
    myTimer = setInterval(wait, 7000); // calls the function after 1 second


    How do I get the Fader movie to play on frame 1, then move to frame2?

  2. #2
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    Are you having a "fade animation" happening inside your "fader" clip? if yes, then i am assuming that your fade animation ends in the last frame of your "fader" clip.

    Code:
    stop();
    _root.attachMovie("fader","fader",1);
    fader._x=fader._y=0;  // This will place your "fader" to postion Zero
    this.onEnterFrame=function(){
    if(fader._currentframe==fader._totalframes){
    myTimer = setInterval(wait, 1000); // Note: its 1000 and NOT 7000
    delete this.onEnterFrame;
    }
    function wait(){
    _root.nextFrame();
    clearInterval(myTimer);
    }

  3. #3
    Yes, the fade ends on the last frame of the fader movie. Excellent. I had to move the my time line to the bottom so the frame would wait a set amount of time before it moved to the next frame.

    On a separate note, now that I am attaching the fader movie, there is a mask on layer four and I would like this fader movie to attach under the mask. I tried using the following code:

    fader_mc.setMask(newMask_mc);

    where I am attaching the fader_mc movie and using newMask_mc which is not attached but part of the main movie. What am I doing wrong?


    Thanks for your help.
    Rick
    Last edited by rickaclark; 10-12-2008 at 08:03 AM.

  4. #4
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    is it fader or fader_mc?

    The above code uses "fader". So you must be using :

    Code:
    fader.setMask(newMask_mc);
    Make sure both fader and newMask_mc are "present" when you are using setMask

  5. #5
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    ^^

  6. #6
    The adobe live docs says both movies must have the *_mc extention in order for the mask to work. So, I renamed fader to fader_mc and checked to see the original movie still works. I then tried getting the setmask script to work, with no such luck.

  7. #7
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    did you try :

    fader.setMask(newMask_mc); // name your masking movieclip "newMask_mc"


    And let your attachMovie be the same as before:

    _root.attachMovie("fader","fader",1);

  8. #8
    I found out that the movie and the mask must be loaded before declaring the setmask line, ie:

    Code:
    stop();
    
    _root.attachMovie("fader_mc","fader_mc", 10, {_x:0, _y:0});
    _root.attachMovie("newMask_mc", "newMask_mc", 20, {_x:0, _y:0});
    
    this.onEnterFrame=function(){
    if(fader_mc._currentframe==fader_mc._totalframes){
    delete this.onEnterFrame;
    }}
    fader_mc.setMask(newMask_mc);
    function wait(){
    _root.nextFrame();
    clearInterval(myTimer);
    }
    myTimer = setInterval(wait, 7000); // Note: its 1000 and NOT 7000

  9. #9
    Banned deepakflash's Avatar
    Join Date
    Aug 2007
    Location
    [Object not found]
    Posts
    1,160
    On a separate note, now that I am attaching the fader movie, there is a mask on layer four
    You did not tell me that you are attaching your masking clip from library.

  10. #10
    Quote Originally Posted by deepakflash
    You did not tell me that you are attaching your masking clip from library.
    Originally, I wasn't attaching my my masking clip from the library. After reading more about it, I noticed several people were attaching both movies. I also discovered that where you placed the setMask line made a difference.

    So, I thought I would try attaching both movies and placing the setMask after attaching the movies and it worked.

    Thanks for your help.

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