A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: a veeery basic and easy onmouseover/onrollover question

  1. #1
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121

    a veeery basic and easy onmouseover/onrollover question

    hi.
    i've got this silly little question: what is the correct actionscript for making a mc go to another frame when mouse is over it? simple, i know, but new for me. i've tried this:

    mcinstancename.onRollOver{
    gotoAndPlay(framename);
    }

    ...but the thing complains there's a syntax error. should i use onmouseover or something like that..?

    thanks, you kind souls...

  2. #2
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    when placed on a movieClip:

    Code:
    onRollover() {
    do something
    }
    When placed on the time line:
    Code:
    movieClip.onRollOver = function() {
    do something
    }

  3. #3
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121
    hi
    well, now it doesn't complain about mistakes any more, which is an imrpvement - but it still won't work:
    i have a mc in my movie. when the mouse is over it, i'm trying to tell the mc to go to frame2 called 'play'. in the first frame of the mc i have a stop-command, so that the mc would stay still when mouse is not over it. i use this in the first frame of my main movie:

    mcinstancename.onRollOver = function() {
    gotoAndPlay(play);
    }

    ...what happens that the mc stays still all the time and doesn't go to frame 'play' when mouse is over it. what am i doing wrong this time, please?

  4. #4
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    Try this:
    (put on MC):
    code:

    on (rollOver) {
    this.gotoAndPlay("play");
    }



    ~Sportzguy933

  5. #5
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121
    hey, i posted my fla here, hoping it'll help you to see where the mistake is... it's in flash 8... thanks!
    Attached Files Attached Files
    Last edited by mrk13; 12-15-2005 at 07:57 PM. Reason: spelling mistrghakes

  6. #6
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    Put quotes around instance names and frame labels in actionScript...

    gotoAndPlay("play")

    You need to tell flash where it can find the "play" frame

    movieClipsName.gotoAndPlay("play")

    or since you have the action attached to the movie clip, you can use "this" to tell flash to look inside the current movieClips timeline

    mcinstancename.onRollOver = function() {
    this.gotoAndPlay("play");
    }

  7. #7
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    might need this as well...

    Code:
    //where frame 1 is where you have the stop action
    movieClipName.onRollOver = function() {
    	if (this._currentframe==1) {
    		this.gotoAndPlay("play");
    	}
    };
    Last edited by DallasNYC; 12-15-2005 at 08:13 PM.

  8. #8
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    Just looked at your fla,

    When used on the timeline, you don't have to use "gotoAndStop(1)" , simply put "stop();" on the frame. And you don't need to use "play();" on the timeline either, just leave it blank. It there is no stop(); action on that frame, then the movie will play regardless.

  9. #9
    user in A minor
    Join Date
    Jan 2005
    Location
    finland
    Posts
    121
    yes! thanks guys - the quotes helped a lot. the thingie works now.
    hugs and juicy kisses to you all.
    mar

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