A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: General scripting question

  1. #1
    Member
    Join Date
    Aug 2005
    Posts
    36

    General scripting question

    Hi I am creating a circular interface that rotates around to specific points for the menu options. i have the circle key framed out to one complete rotation. when an option is selected i want the cirlce to rotate to that frame the stop. I dont want it to jump to the frame i want it to play the movie then stop on the frame. I have been trying scripts using the "if action" but i still can not get it to stop on the frame i want.

    is there such an action like...

    play
    if (framenumber = 9) {
    stop ();
    }

    Please let me know if anyone has any ideas i have been stuck on this for two weeks.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I guess you have several buttons , and each one would make the wheel stop at a unique place in the timeline ?

    I suggest you have something like this on a button

    on(release){
    whereToGo="gallery";
    play();
    }

    ...and on the frame where the wheel should stop for that button you have ...

    if(whereToGo=="gallery"){
    stop();
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Member
    Join Date
    Aug 2005
    Posts
    36
    Quote Originally Posted by pellepiano
    I guess you have several buttons , and each one would make the wheel stop at a unique place in the timeline ?

    I suggest you have something like this on a button

    on(release){
    whereToGo="gallery";
    play();
    }

    ...and on the frame where the wheel should stop for that button you have ...

    if(whereToGo=="gallery"){
    stop();
    }

    Is whereTOGO an actuall script or am i suspose to put info in this area. also what is gallery is it a frame lable or the name of a movie clip?
    thanks for the response

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    "whereToGo" is just a variable with a temporary value set by each button. I used this name of the variable just to describe its function ( where to end up in the timeline ). The value ( gallery ) is just a name , it could as well be "toasterbunny", but its more logical to use a name that corresponds to a section, button or whatever.

    The principal is that you press a button, and the whereToGo variable gets a value. Each possible stop in the timeline should have the IF statement checking if the whereToGo variable has the value of that particular frame. And if it has, it should stop the playing.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Member
    Join Date
    Aug 2005
    Posts
    36
    I have tried this script and it is working to an extent. This first button i click on goes to the correct frame exactley how i wanted it to. but each button after that just stops on the next key frame with a script. its weird though because what ever button you click first works perfect but then the second click just stops at the next script even if it is not the one that pertains to it. here is the code i have on the the first two buttons....

    Button 1
    on(press){
    whereToGo="gallery";
    play();
    }
    Coresponding frame
    if(whereToGo1=="gallery1"){
    stop();
    }

    Button 2
    on(press){
    whereToGo2="gallery2";
    play();
    }
    Coresponding frame2
    if(whereToGo2=="gallery2"){
    stop();
    }

    Is this how this is meant to be set up? also should gallery be the name of a movie clip too? please let me know what you think. i can e-mail you this file if you like.

    thanksk alan

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    What the movieclip is called does not matter , as its the tweening that is moving the wheel.

    the variable is general, so its called the same thing wherever its used. Its just its value that should change.

    Button 1
    on(press){
    whereToGo="gallery1";
    play();
    }
    Coresponding frame
    if(whereToGo=="gallery1"){
    stop();
    }


    Button 2
    on(press){
    whereToGo="gallery2";
    play();
    }
    Coresponding frame2
    if(whereToGo=="gallery2"){
    stop();
    }

    You can use a more descripte value for the variable if you want. Like stop1 stop2 stop3 and so on.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Member
    Join Date
    Aug 2005
    Posts
    36

    woking but stopping on every frame with the script

    the rotation is working now but on the the variables are set the are causeing the movie to stop on every frame where the variables were set. i think that we need to rest them back to nothing after the frame is exited. but im not sure what i can set them to .

    If I set them like this

    on(press){
    whereToGo2="gallery2";
    play();
    }

    Can I unset them like this with a frame action?
    {whereToGo2="null";
    play();
    }

    Is there a sucf script as "on exit frame"? Let me know what you think.

    alan

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I think you are doing this wrong. The variable name whereToGo should be the same all over. Dont number them . Its just the value that should change. Look at my example.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

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