dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: movie clips and action script.

  1. #1
    Member
    Join Date
    Jul 2004
    Posts
    76

    movie clips and action script.

    I'm using flash MX 2004 and am a newbie...

    I've created a sort of television that has three buttons to play, go back to the beginning and stop the television from playing. I saved it as a movie clip to use for other scenes. In the first scene it was not a movie clip and worked fine. However when I saved the television as a movie clip and imported it into another scene the actionscript for the buttons is no longer functional...

    Why is that?

  2. #2
    Senior Member Shotsy247's Avatar
    Join Date
    Apr 2001
    Location
    Be there in a minute!
    Posts
    1,386
    Could be a path problem, but it's hard to say without looking at the code.

    _t
    I don't feel tardy.

  3. #3
    Member
    Join Date
    Jul 2004
    Posts
    76
    the code is simple such as

    on(release){
    gotoAndPlay(1); //rewind button
    }

    on(release){
    stop(); // pause button
    }

    on(release){
    play(); // stop button
    }


    this television is a movie clip with the three buttons using this code. I want the television to stop the main timeline scene it is on. Do I have to reference the specific scene to do that? I'm just too new to understand how to get the path correct. Whatever scene this movie clip is loaded onto none of the buttons will function correctly. The buttons are part of the movie clip that is put on the stage of various scenes...

  4. #4
    Junior Member
    Join Date
    Apr 2004
    Location
    Manchester (England)
    Posts
    27
    may be able to help, but am releatively new myself. If you converted your television into a movieclip then the code on your buttons will be referring to the timeline of that movieclip. to refer to the main timeline you would need to do this:-

    on (release) {
    _root.gotoAndPlay(1);
    }


    that would then refer to any information you were storing on your main timeline. I hope thats right anyway, if its not then I am sure someone will correct me.
    obvs:USR

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Add _root?

    on(release){
    _root.gotoAndPlay(1); //rewind button
    }

    ...for example.

  6. #6
    Member
    Join Date
    Jul 2004
    Posts
    76
    I believe that is what the movie clip was doing. Since the television had buttons they were trying to stop the television and not the timeline so it didn't work. I also found out that if you break up the movie clip it will work, or if you convert it to a graphic the buttons become functional again. My problem is the television has to be animated, i.e. moveable and also interactive controlling the main timeline.

    But now I have a new problem. This is probably easy for you and my book doesn't say too well. And my code here doesn't work. Anyway I want the TV rewind button to only go back to the currect scene and not the beginning of the movie as it is doing now. I used this code.

    on(release){
    gotoAndPlay("intro2", 1);
    }

    intro2 is the scene I want to return to the beginning of but the code returns all the way to the beginning of the movie. Another path problem maybe?

  7. #7
    Member
    Join Date
    Jul 2004
    Posts
    76
    nevermind...

    if you want to stop on multiple sceens use frame labels...

    thank you.

  8. #8
    Junior Member
    Join Date
    Apr 2004
    Location
    Manchester (England)
    Posts
    27
    you need:

    on release {
    _root.gotoAndPlay("intro2",1);
    }

    dont forget your paths, if you are referring to the timeline of a movieClip use :
    this.gotoAndPlay

    if u r referring to the main time line use:
    _root.gotoAndPlay

    alternatively if you named the movieclip you can rerer to it by name eg.

    television_mc.gotoAndPlay
    by using this method you can talk to any movielip/button globally from your root timeline.
    obvs:USR

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