A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Stopping a Function "init" ?

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Location
    London
    Posts
    4

    Stopping a Function "init" ?

    Hello!

    Im working on a personal animation using lots of different action scripts and effects I have found on the net. I want the animation all to be based within 1 scene.

    On my main "time line" Frame (20) I have a script for snow to fall,

    init = function () {
    //This is where the rest of the script is.
    }
    init();

    The main "time line" then stops on frame (50) with a "stop();" where their is also a movie clip that contains the next part of the animation.

    It's within this movie clip that I want to be able to tell the original

    init = function () {

    To stop!

    I have been trying things like this but I really dont know what else to do other than making another scene. ):

    onEnterFrame;
    _root.init = function (stop) {
    }

    or

    onEnterFrame;
    _root.init;
    stop;

    And a whole load of others! I'm totaly off the mark on this and could really do with some help.

    Cheers Guys and Girls!

    JOe
    Last edited by joe_design9; 04-07-2006 at 07:10 AM.

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    try:
    delete init;
    on frame 50
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Junior Member
    Join Date
    Apr 2006
    Location
    London
    Posts
    4
    Hi Kortex, Thanks for looking,

    I have tried that but it doesnt seem to work, I have attached a copy of a .fla that has the snow action on frame 1 and now the "delete init;" action on frame 50, Ideally I'm gonna need to be able to stop the init function from inside a movie clip but getting it to work on the main timeline would be a good start! (:

    Thanks again, JOe
    Attached Files Attached Files

  4. #4
    An Average User warpdesign's Avatar
    Join Date
    Apr 2002
    Location
    Southern California
    Posts
    331
    Hi,

    You need to delete each individual piece of snow, not just the function. Place this script where you want the snow to go away:
    code:

    snowflakes = 100;
    for (i=0; i<snowflakes; i++) {
    removeMovieClip ("snow"+i);
    }

    You know what they say:
    Teach a man to fish and you feed him for a lifetime.
    Unless he doesn't like sushi—then you also have to teach him to cook.

  5. #5
    Not Real since 1985
    Join Date
    Feb 2002
    Location
    Netherlands
    Posts
    229
    I would suggest either to put the as inside a movieclip on your stage and remove this movieclip at frame 50 (just let it's timeline go from 1 to 49). Or, better, attach the snow movieclips not to root but to some other movieclip on stage (call it 'winter').
    I think I'm right to say you only have to remove this movieclip winter to get rid of all the snow. Which means: let the timeline with the winter clip stop on frame 49. Or do it more elegant, make this movieclip using actionscript on frame 1 (something like createemptymovieclip) and delete it on frame 49.
    I'm not sure though if some onEnterFrame keeps running as a ghost process after the movieclip has been deleted, but I think not.
    Last edited by Louis van Laarhoven; 04-07-2006 at 05:55 PM.
    Never accept the first 'impossible' unless it comes from a lady.

  6. #6
    Junior Member
    Join Date
    Apr 2006
    Location
    London
    Posts
    4

    Problem Solved . Thanks Guys!

    Thanks very much too warpdesign and Louis van Laarhoven.

    Firstly warpdesign your code works fine!. Thanks for taking the weight of that prob of my sholders! Secondly cheers for the ideas Louis van Laarhoven. I will be utalizing them.

    Okies,, thanks guys! Keep an eye out when it's completed I will post it on my site, their are some on it now..

    www.joe-graphics.com

    goto html version then go to portfolio and www.

    CHEERS!!!!!

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