dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] move along timeline relating to mouse x coordinates

  1. #1
    disco monkey monkeysquid's Avatar
    Join Date
    Jan 2003
    Location
    Glasgow - the armpit of the north.
    Posts
    306

    [F8] move along timeline relating to mouse x coordinates

    hey, basically i've got a sequence of images (360 of a fashion model), when i poulate the timeline with them i want to be able to use the mouse's x cordinate to run through the timeline, making the model appear to spin in 3D.

    does anyone have any pointers?

    Cheers.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe try something like this...

    Create a movie clip with your sequence of images, set the registration point in the middle. Put the movie clip on the main timeline and give it an instance name (used "my3DmodelMC" in the example below). Place the following code on the main timeline.
    Code:
    var newFrameNum:Number;
    my3DmodelMC.stop();
    my3DmodelMC.onEnterFrame = function() {
    	if (this.hitTest(_xmouse, _ymouse, false)) {
    		newFrameNum = this._currentframe + ((this._x < _xmouse) ? 1 : -1);
    		newFrameNum = (newFrameNum > this._totalframes) ? 1 : (newFrameNum < 1) ? this._totalframes : newFrameNum;
    		this.gotoAndStop(newFrameNum);
    	}
    };

  3. #3
    disco monkey monkeysquid's Avatar
    Join Date
    Jan 2003
    Location
    Glasgow - the armpit of the north.
    Posts
    306
    sorry mate, think i didn't explain that right.

    at the moment the script makes the mc play when i mouse over.

    what i was meaning is a script that means the mc moves across the timeline back and forward depending where the mouse is, so for example when the mouse crosses over from left to right the frames will move forward with the mouse, however when you move from right to left the frames will move backwards along the timeline.

    so the user is controlling the direction of the spin with the mouse x co-ordinates.

    Cheers.

  4. #4
    disco monkey monkeysquid's Avatar
    Join Date
    Jan 2003
    Location
    Glasgow - the armpit of the north.
    Posts
    306
    hate to do this but... bump.

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