FORUMS: list search recent posts

how do I play a small img seq by mouse dragging (?)

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
jamesmanner
how do I play a small img seq by mouse dragging (?)
on Sep 10, 2007 at 12:48:30 pm

I'm new to Flash, that means that I can do basic stuff but nothing fancy or AS related, I found myself in the need to do something like this:

example

I thought it was easy but I'm wrong, I guess. I have this image sequence of 50 frames of a rotating obejct, I'd like to use it on my website and I think the example above is just right for my needs but my small knowledge on the subject is a restrain (also the accessibility to a computer with Flash).
Actually I was hoping of any software beside Flash that would output a swf like the above after loading either an image sequence or a small avi/mov/gif.

Any help is warmly appreciated thanks.

James



Return to posts index

Doccie
Re: how do I play a small img seq by mouse dragging (?)
on Sep 11, 2007 at 12:02:23 pm

http://pastebin.coconut.se/?id=5554

This script should do it :)
I'll take you through it line for line.

var currentx:Number = this._xmouse;
this is a variable the gets updated everytime the rotate function is called. In it, is the current mouse position (in pixels).

this.onMouseDown = function(){
myInt = setInterval(_root.rotate, 500);
}
Whenever the user clicks and drags the mouse, a function (rotate) is called every 500 milliseconds ( you can change that number so that the animation is played faster or less fast.

this.onMouseUp = function(){
clearInterval(myInt);
}
Make sure that when the user releases the mouse, the function doesn't get called anymore.

The function rotate then checks if the _xmouse at the time the function is called is bigger or smaller than the currentx value. (thus finding out whether the user is dragging to the left or to the right)

Kind regards,
Pieter


Return to posts index

jamesmanner
Re: how do I play a small img seq by mouse dragging (?)
on Sep 11, 2007 at 2:15:52 pm

I'll test it as soon as I get the chance, but just to be clear (again I'm new to Flash).
I suppose I'll have a layer with the image sequence and another layer witht the AS you posted, right? Your line by line explanation makes sense to me but it's unclear how to use it!
And shouldn't I add a button synbol to it or not?

Thanks


Return to posts index


Doccie
Re: how do I play a small img seq by mouse dragging (?)
on Sep 11, 2007 at 2:35:48 pm

No, sorry, I forgot to mention one thing. You will need to put the image sequence in a new movieclip (Insert > new Symbol > movieclip).

So you place the code I have given you on the first frame of the Actions layer on the main timeline and below the actions layer you create another layer named sequence, for instance, on which you drag the movieclip from the library. And then you click on that movieclip and below in the Properties panel, give it the instance name: 'mySequence' (actioncsript uses that for the prevFrame and nextFrame functions)

Kind regards,
Pieter


Return to posts index

jamesmanner
I can't get it to work
on Sep 14, 2007 at 9:56:53 am

Ok, I followed you directions, it seems to work, but not as expected.

The first time the mouse overs it I click and drag and the sequence is played by the mouse movent, however it cannot loop and it stops when reaches the last frame.

after the first click and drag the sequence plays by just hovering the mouse and won't follow the mouse movements anymore.

:-(



Return to posts index

Doccie
Re: I can't get it to work
on Sep 14, 2007 at 5:39:09 pm

Send it to me by e-mail and I'll have a look at it. It's hard to fix it from a distance...

The loop is easy to do, and I expect that the animation keeps playing because you're not clearing the interval. But like I said, mail to me at doccie AT gmail DOT com and I'll have a look.

I'm going on a short vacation starting tomorrow, so it might take some time before I can get back to you.

Kind regards,
Pieter


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]