Welcome to TalkGraphics.com
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33
  1. #1
    Join Date
    Nov 2004
    Location
    Israel
    Posts
    2,538

    Default Assigning Actions Withing a MovieClip

    Hello,

    Is it possible to create an action withing a movie clip that, when it reaches it's final frame will play another the next frame withing the scene, OUTSIDE the movie clip?

    I mean that instead of making one long frameset file, or using the LoadMovie command, I want to place several movie clips on my scene on different frames (example: MC1 on frame 1, MC2 on frame 2 etc...) and I want to create a code withing each MC (for example each will have animation of 25 frames) that when it reaches it's final (25th) frame it will stop and go to the second frame on the scene which contains MC 2. I want it to be without user interaction.

    I've tried to use the string:

    onClipEvent (enterFrame) {
    gotoAndStop ("scene1", "instanceframe");
    }

    OR

    onClipEvent (enterFrame) {
    gotoAndStop (_root.2);
    }

    Something like that. But it doesn't work.... any ideas?

    Regards,


    Availor
    IP

  2. #2
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Assigning Actions Withing a MovieClip

    It's not usual to do what you are trying, because the best way to approach this would be to set an interval on the main timeline,which would move the time line on after a set period (when the nested movieClip has played to the end). Your current method makes every nested movieclip responsible for controlling the parent.

    Anyway, try using _parent.nextframe() .

    Let me know how you're getting on. If it proves difficullt I'll make an example.

    Paul
    IP

  3. #3
    Join Date
    Nov 2004
    Location
    Israel
    Posts
    2,538

    Default Re: Assigning Actions Withing a MovieClip

    Hello pauland, thanks for your reply.

    The _parent.nextframe (); synthax does not seem to work. The whole idea was to create as few frames as possible. For example, Make a project out of 4 frames while each frame on the scene will contain a movie clip. Now if I have a large file with several movie clips, if I decide to shorten the MC then I need to delete frames in the main scene. Moreover the timeline becomes too long and clumsy to work with. It's like giving a keyframe it's name, so instead of using gotoAndStop (1) it's better to use an instance name, so if you decide to move this frame it will no longer be 1 and we are into a long find&replace...

    Anyway, I am sure it is possible. I've searched in the help file with no use.
    It can be done inwards, so there must be a way to do so outwards as well....

    Thanks again,

    Availor.
    IP

  4. #4
    Join Date
    Mar 2006
    Posts
    1,570

    Default Re: Assigning Actions Withing a MovieClip

    Sounds like a game function with animated sprites. Will have to ponder that bit.
    IP

  5. #5
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Assigning Actions Withing a MovieClip

    Hi Availor

    This is easy using Pauls setInterval example.

    There's a great example of using setInterval on learnflash.com/ this week. You have to register, but it's an excellent resource that sends yo a free tutorial every week. They don't seem to mind if you never purchase their courses, just keep sending you a tutorial a week.

    You could also place each MC on an individual frame on the main time line (as you've alreadty suggested) but give each frame a stop action.

    Now in each individual MC, on the last frame of the mc

    _root.play();

    I think this should work, but I haven't checked it out.

    EDIT: Yes that does work, just tested it.


    Pauls next frame should work as well, but the syntax should be

    _parent.nextFrame();

    With an uppercase F


    onClipEvent (enterFrame) executes as soon as the mc is loaded so it's not the way to go here.
    Last edited by Egg Bramhill; 04 June 2006 at 02:00 AM.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  6. #6
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Assigning Actions Withing a MovieClip

    IP

  7. #7
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Assigning Actions Withing a MovieClip

    Paul

    The only problem with the setInterval technique is it only works with mc's of equal timelines. If one mc had a timeline of 60 secs and another a timeline of 5 secs they would quickly get out of kilter.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

  8. #8
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Assigning Actions Withing a MovieClip

    Egg, you are right. You could compensate by having an array of frame counts for the individual MCs , and use that to adjust the nextFrame timing, but then it's getting fiddly.

    Thanks for spotting my lowercase 'f', the _parent.nextFrame() should do what Availor wanted.

    Paul
    IP

  9. #9
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    533

    Default Re: Assigning Actions Withing a MovieClip

    I know you mentioned not using LoadMovie, but that's a simple way I might choose to do what you mention. Although I would use LoadMovieNum. Not that Egg and Paul don't have something with what they where showing. You could have a master movie with one frame. Have it load the intial movie when it starts at a certain level, then have the LoadMovieNum command on the last frame of the loaded movie that loads the next movie into the same level. Flash automatically unloads the first movie. It can only have one movie per level. Just a thought.

    Red

    Big Plan Creative - Napoleon had one . . . Einstein had one . . . Do you have one?
    IP

  10. #10
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Assigning Actions Withing a MovieClip

    Red

    I've no argument with what your saying apart from the fact that you may need to come back to a fla file in 12 months and edit it.

    One of the big problems with Flash A/S is that very soon you can find yourself knitting spaggettii.

    How often have you placed an MC on the stage with no content on the first frame, returned a few months later and searched endlessly for it?

    Red, your idea is as good as Paul's & mine, it's just which is the best way to follow it in the future.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
    IP

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •