A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: on Rollover scene problem

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    23

    on Rollover scene problem

    Another problem that i'm experienicing while dealing with button menus and other things involving rollover states,hope you guys will hepl me

    Here is a sketch of what i want.




    I have 4 different buttons.And what i want is this-when someone goes over each of them,this circle in the middle with an arrow must go and point to that button.Now there are couple of problems.

    So, for example,if I roll over on btm4,the circle goes around in a speed let's say 12fps and on rollout that circle goes the same way back.And for each button the same action.

    I have problems with tweening more then two buttons don't know why.So is there an easy way or some sort of tutorial or an example to follow.

    I need help!!!

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Posts
    23
    anyone?

  3. #3
    Senior Member
    Join Date
    Aug 2009
    Location
    Scotland & England
    Posts
    117
    Still need help on this Bear?

    If you upload and link to your .fla of what you have done so far I will edit it and make it do what you're after.

  4. #4
    Junior Member
    Join Date
    Sep 2009
    Posts
    23
    Hi Beakers!

    http://www.2shared.com/file/7874420/a6102dd/tryout.html

    Here's the uploaded file,where have i gone so far...
    (images used and the buttons used do not represent the real thing which i will make when i finally figure that out and how it is done )

    so, i made this thing only for one button but still as you can see it does not return to its side when you roll out of it and also i must state in actions code that when i rollover the circle image it does not go around as when you roll over the button..

    if you can help please do,i thank you a lot!

  5. #5
    Senior Member
    Join Date
    Aug 2009
    Location
    Scotland & England
    Posts
    117
    Hey,

    Ok take a look at: http://beakable.com/tryout.fla

    If I was making it from scratch I would do it quite different but I've kept it the exact way you made it and only altered some small parts.

    Your original rollOver code was:

    this.button_mc.onRollOver = function() {
    button_mc.gotoAndPlay("_over");
    button_mc.onRollOut = function() {
    button_mc.gotoAndPlay("_out");
    }

    This is now:


    button_mc.onRollOver = function() {
    button_mc.gotoAndPlay("_over");
    }
    button_mc.onRollOut = function() {
    button_mc.gotoAndPlay("_out");
    }


    You don’t need to refer to this. on the main timeline and if you take a close look you will see your rollOver functon was also including the rollOut function (not that it makes any difference really in this case but it's good practice to watch the { } for future Flash stuff)

    Your main rollOut problem was caused by the stop() you had in your actions inside the circle being on the same frame you where telling it to play... .E.g you had gotoAndPlay(25), and on frame 25 you also had stop().

    The issue you now have is you have 2 circles and because the grey line sticks out you can see there is 2 when you roll over 1 and it becomes animated.

    Your main option would be:
    Make the circle a seperate MovieClip that contains all the rollOver and rollOut animations and make the buttons just normal buttons.

    If you give it a bash and run into problems I'm happy to help you again.

  6. #6
    Junior Member
    Join Date
    Sep 2009
    Posts
    23
    Beakers, thank you so much!

    Now i will try and make this as you said,and if any problems occur i will let you know.

    Thanks again!

  7. #7
    Junior Member
    Join Date
    Sep 2009
    Posts
    23
    i've handled it very well,but now i have the problem which i hope you will understand.


    lets say that i scroll over the button on the left, and my circle slides to the left and STAYS there. now if i want to go with the mouse to the right and point on the right button - how can i make my circle scroll from the left side to the right.

    my problem is this because if i also want to go to the upper button,how can i say to my circle to go from the left side to the upper side.

    and of course all other combinations-form left (if the mouse is on the left) to upper side,from left to right,from right (if the mouse is on the right button) to left and etc...

    so just logical explanation which i cannot figure out!

    Thanks!

  8. #8
    Senior Member
    Join Date
    Aug 2009
    Location
    Scotland & England
    Posts
    117
    Righto,

    Did you manage to make the circle/compass in the middle its own Movie Clip which contains all the tween animation?

    Again feel free to email me what you now have and I'll take a look.

    It’s hard to explain the multiple ways you could do it but here goes:

    You could make two full animation cycles of the circle going from left to right and from right to left.

    So your frame1 inside your circle MC is of it pointing left. You then tween it with its rotation animation with for example frame 15 being the compass pointing up and then frame 30 being compass pointing right.
    If you where to run the circle as an animation it would be seamlessly rotating from the left button to the right.
    Frame 30 to frame 45 you want it rotating back to point to the top button and frame 60 you would want it back to where it started; pointing left.

    Don't worry about putting the stop() in the Keyframes just now, you will need to control them through AS so that it stops at the correct button.

    In your main timeline keyframe (along with all your button actions and so on) add a global variable by putting (preferably) at the top var myStop = 1

    Your button actionscripts would then become something like:

    leftButton.onRollOver = function() {
    if(mcCircle._currentframe == 15 || mcCircle._currentframe == 45){
    mcCircle.gotoAndPlay(46)
    }
    if(mcCircle._currentframe == 30){
    mcCircle.gotoAndPlay(31)
    }
    myStop = 60
    }

    topButton.onRollOver = function() {
    if(mcCircle._currentframe == 1 || mcCircle._currentframe == 60){
    mcCircle.gotoAndPlay(2)
    myStop = 15
    }
    if(mcCircle._currentframe == 30){
    mcCircle.gotoAndPlay(31)
    myStop = 45
    }
    }

    And then you need a script in the circle to constantly check if the circle is at the frame it should stop on... which is whatever myStop is equal to.

    mcCircle.onEnterFrame = function(){
    if(this._currentframe == myStop){
    this.stop()
    }
    }

    I've left the right button out for you to work out yourself

    There is an even better way to do it which requires a few more lines of actionscript and allows you to do it with just the 1st 30 tween frames but if you can get it working this way and want to know the better method then give me a shout

    And of course if I haven't made sense or you get lost a little feel free to email it over... I've likely missed something vital out ha, but I'll use my recovering from the flu excuse.

  9. #9
    Junior Member
    Join Date
    Sep 2009
    Posts
    23
    got it perfectly!

    Thank you so much

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