A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: (Flash 8) Removing Snowflakes

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    26

    (Flash 8) Removing Snowflakes

    Code:
    for (var i = 0; i<amount; i++)  { thisFlake =
    this.attachMovie("snowflake1", "snowflake1"+i, i);
    It places the movie snowflake1 on the stage in my Pre-Load Scene.

    Then when I play the movie the snowflakes work right, but when the pre-loading is done there are falling snowflakes on my next scene (I understand that there aren't actually scenes when the flash runs). I have tried numerous ways to remove the clip:
    Code:
    this.removeMovieclip("snowflake1")
    delete "snowflake1"
    this.removeAll
    Please help as I am getting tired of flakes where they don't belong. Thanks.

    Sincerely,
    Greg

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    repeat your initial code, removing instead of attaching -

    for (var i = 0; i<amount; i++) {
    this["snowflake1"+i].removeMovieClip();
    }

    hth

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    26
    Yeah it worked - it doesn't make much sense to me though - I though if I put:

    this.removeMovieClip("snowflake1");

    that the rest wouldn't matter since there is no movie clip to create snowflakes from. If you could explain a little I would appreciate it.

    --
    Greg

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    run the file and (before you destroy the snowflakes)
    use List Variables to display what you have created.
    you should see something like -

    Variable: _level0.snowflake10
    Variable: _level0.snowflake11
    Variable: _level0.snowflake12

    this is the result of looping with - "snowflake1"+i

    so simply removing snowflake1 has no effect

    hth

  5. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    26
    Thanks for the help - but that makes absolutely no sense.

    "snowflake1" + i = looping??

    anyways, sorry about the duplicate movies, no one was answering my question, I would have deleted the post if I had the power. Sorry to everyone that did waste their time.

    --
    Greg

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    but that makes absolutely no sense

    your code-
    for (var i = 0; i<amount; i++) {
    thisFlake = this.attachMovie("snowflake1", "snowflake1"+i, i);
    }

    you are increasing variable i each time around the loop

    1st iteration - i=0 - you make - "snowflake1"+i = _level0.snowflake10
    2nd iteration - i=1 - you make - "snowflake1"+i = _level0.snowflake11
    3rd iteration - i=2 - you make - "snowflake1"+i = _level0.snowflake12
    and so on....

    makes sense now ???
    always use List Variables to display what you have created.

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