A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: attachmovie()

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    1

    Question attachmovie()

    hi

    i'm new to flash, and i'm trying to understand a flash website from the source. what happens is, the user clicks a menu button and the page displayed animates to disappear, and is replaced by a new page, which animates to appear. if another menu button is pressed, this page animates to disappear, to be replaced by a new page, and so on.

    looking at the actionscript, i can see how the movie clips [which are the pages] do the animations, because i can scrub the timeline pointer along the timeline and watch the animations. but what i don't understand is *how* this can be done in the website movie itself, because the menu buttons do an "attachmovie()" followed by a "gotoandplay(x)", where 'x' is a frame in the MIDDLE of movie clip, not at the beginning. it seems like attachmovie() will automatically play the entire movie clip from the beginning and up to the 'x' [which frame has a 'stop()' in it] when it loads the movie, and will automatically play from wherever the pointer currently is (at the 'x' because it's stopped there) up to the end of the clip when the current clip is unloaded in order to load a new one. is this what's happening? if not, can someone explain to me what's causing this?

    thanks
    ken

  2. #2
    Senior Member
    Join Date
    Apr 2009
    Posts
    138
    First, you can try
    //for the button
    _root[nextClipToAdd].play ();
    nextClipToAdd = "movie scene 1";

    in the movieclip have your fade in animation and when it reaches the point the users will see for a while put a stop(); inside that movieclip. then when they click a button it will play and do the fade out animation. and then at the last frame of the movieclip put _parent.attachmovieclip (nextClipToAdd, nextClipToAdd+"01", ............) like that and then have a removemovieclip and remove this.

    and on your first frame when the movie starts set var nextClipToAdd:String = ""; and then use that variable in an attachmoveclip.

    Bet of luck

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