A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: From one MC to another to another…

  1. #1
    HUH? pea3698's Avatar
    Join Date
    Mar 2001
    Location
    Greenville SC
    Posts
    1,771

    From one MC to another to another…

    Wow! It has been a while since I asked an AS related question here, but that's what I love about FK, If in need go to the ol' faithful yellow.

    I am starting to dive into AS3, phew seems different/more difficult on so many levels, and have hit a wall. Usually Google is my friend but it seems I am not the only one with issues and I am having a hard time finding an answer in the sea of questions.

    I have a timeline that I would like to keep simple and just have movieclips per frame. At the end of each movieclip I would like the timeline to progress one frame on the main/root timeline.

    So far in the root file I have stop(); actions on each frame, on its own actions layer, and a layer per MC. Each MC has an instance name, lets just say 1, 2, 3. I have tried several methods by adding AS to the final frame in the MC but keep getting errors. I don't even think it is worth showing those due to the nature of the methods, pretty much just taking stabs in the dark.

    Can anyone point me in the direction of a tutorial or provide me with an example of how to do what I am trying to accomplish?
    ------------------

    Sometimes we are the windshield. . . But, most of the time, we are just the bug. (c;
    My cycling themed designs Pats Design Portfolio

  2. #2
    Junior Member
    Join Date
    Feb 2011
    Posts
    16
    Well, if I understand correctly, you're trying to have each of the root timeline's frames contain one (or more?) MCs which in turn have their own timelines? If that is what's got you stumped, I suppose you could just add something along the lines of:

    Actionscript Code:
    stop();
    if(testClip.currentFrame == testClip.totalFrames) play();

    on each frame of the main timeline, because where you really want the code to be here is not on the movie clips (except for a stop statement on the final frame).


    I'm not sure if that's what you were asking for or not..
    Last edited by Profusion; 08-01-2011 at 09:41 AM.

  3. #3
    HUH? pea3698's Avatar
    Join Date
    Mar 2001
    Location
    Greenville SC
    Posts
    1,771
    You are right about my set-up. I have a timeline that has movieclips with their own timelines. I do have a stop(); on the final frame of the movieclips. I added the AS you provided and the first MC played but it did not advance to the next frame of the main movie timeline when the MC finished.

    Am I doing something wrong below? The first MC's instance name is intro which I need to go to the next which is productPan.

    Actionscript Code:
    stop();
    if(intro.currentFrame == intro.totalFrames) play();
    ------------------

    Sometimes we are the windshield. . . But, most of the time, we are just the bug. (c;
    My cycling themed designs Pats Design Portfolio

  4. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    16
    Oh wow, sorry about that... you put exactly what I told you to put but I failed to realize that that code doesn't even make sense! *facepalm* In fact, you barely need ANY code.

    Here's an actual solution (tested):



    The picture is above shows the main timeline. On the first keyframe, I placed an instance of Square1 called sq1 and created 19 frames to follow it (since the Square1 movieclip has 20 frames all together in its timeline).

    Next, I placed an instance of Square2 called sq2 at frame 21 (which is a keyframe, as you can see, that does not contain sq1) and kept it on the timeline for 19 more frames as it too has 20 frames all together in its timeline.

    Finally, I added a blank keyframe at the end on which I dropped a stop() statement. I know this works and I attached the .FLA to prove it yet I'm not entirely sure that this is the best solution. However, I am pretty tempted to say it is, seeing as matching the timeline frames to the movieclip keyframes seems logical enough.
    Attached Files Attached Files
    Last edited by Profusion; 08-01-2011 at 12:48 PM.

  5. #5
    Junior Member
    Join Date
    Feb 2011
    Posts
    16
    Haha, hope this works for you now. Good luck!

    ~ Profusion
    Last edited by Profusion; 08-01-2011 at 12:49 PM.

  6. #6
    HUH? pea3698's Avatar
    Join Date
    Mar 2001
    Location
    Greenville SC
    Posts
    1,771
    Hmm I can't open it, I am running CS3, seems to have issues opening newer versions.

    That will make for a cleaner timeline and it does work but I was hoping for a more condensed solution. One keyframe for each MC with no frames in between. That is why I figured there would be code in the MC telling the main timeline to progress by one frame. I am just having issues figuring that part out.
    ------------------

    Sometimes we are the windshield. . . But, most of the time, we are just the bug. (c;
    My cycling themed designs Pats Design Portfolio

  7. #7
    Junior Member
    Join Date
    Feb 2011
    Posts
    16
    Yes, I see what you mean. I suppose you could try stopping each keyframe on the main timeline that contains a movieclip (MC A) whose timeline you want to play. But to have it resume and move on to the next keyframe, where MC B is located, I guess you'd have to code it to tell its parent ("root", in this case, but you can type parent as well) to gotoAndStop at the next frame (ex: frame #2).

    To be honest, I don't know if that's possible, but it's worth trying (place on the final frame of the MC):

    Actionscript Code:
    MovieClip(parent).gotoAndStop(2);

    EDIT: Yep, this works and it's condensed, as you wanted it to be! Is this what you were looking for?
    Last edited by Profusion; 08-02-2011 at 08:58 AM.

  8. #8
    HUH? pea3698's Avatar
    Join Date
    Mar 2001
    Location
    Greenville SC
    Posts
    1,771
    That worked perfectly. Thank you!
    ------------------

    Sometimes we are the windshield. . . But, most of the time, we are just the bug. (c;
    My cycling themed designs Pats Design Portfolio

  9. #9
    Junior Member
    Join Date
    Feb 2011
    Posts
    16
    Sorry for not seeing this!

    No problem

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