Rotating Clock Hands help!!
Ok I'm fairly new to flash, made alot of ad banners and basic transitional stuff, very little actionscript.
Due to go on the actionscripting stage of the official courses next month.
However been trying to figure out how to make 2 clock hands rotate independently around an axis.
Don't need it to tell the actual time its more to demonstrate the feeling of time flying by, so it'll be the hands spinning round this axis.
Tried using movie clip transition in 45degree steps, but it kind of jiggles around and doesn't stick to the axis!!
Any help would be appreciated, thanks in advance
Senior Member
Make you sure put the pivot point of the hands at the co-ordinates 0,0. As you said you don't need a clock but here's one anyway. You can change it for your needs just by going hours._rotation += 30 or the like.
Attached Files
Ahh thanks very much I'll have a tinker with that and see what I can do with it
Living Proof
If using tweens , put your hour and minute hands on different layers
If someone tells you it can't be done,
it's probally because they don't know how.
Yeah I have that already, the problem I'm finding is fixing one end point to the central axis, it kind of jiggles around the centre point.
Maybe its my understanding of the math.
Senior Member
The easiest thing to do is make your clock hand into a movie clip, with the pivot point at 0,0. Place it on the stage, call it hour_mc and use this code
Code:
this.onEnterFrame = function() {
hour_mc._rotation += 30;
}
Hmm this is where my lack of actionscript knowledge in general is letting me down.
Think I've done it correctly
http://www.maliceguild.net/clock.fla
Theres the FLA. But it doesn't rotate.
Can't wait to go on this course, sure it'll all become shockingly clear
Thanks again for all the help so far
Senior Member
That doesn't seem to be a valid link
Hmm ok try this one, thats definitely there
http://www.maliceguild.net/clok2.fla
Senior Member
You need to name the Instance of the movie clip so Flash can recognise it at run-time.
Click on the MC, in the properties panel put hour_mc in the box where it says <Instance Name>.
Haha!!
Success, now I understand why all the tutorials been ploughing through mention naming instances of Movie Clips as THE thing to know
Thanks very much!!
Ok thats working fine now, I thought that just adding another instance of that 'arm' and repeating the actionscript underneath:
Something like:
this.onEnterFrame = function() {hour_mc._rotation += 30;}
this.onEnterFrame = function() {hour1_mc._rotation += 40;}
Would play both instances of the movie clip together.
But it only plays the bottom one. Is this more to do with the 'this' part of the onEnterFrame command?
As that 'this' command seems very specific to that particular element.
Hence it only controlling the one part.
Senior Member
'this' in this case is just referring to the timeline it's on. It's just something to attach the onEnterFrame function to, you can also use _root or a MC for example.
The reason that it's only doing the bottom one is because you're overwriting the first function. You just need to put both statements in the same function
Code:
this.onEnterFrame = function() {
hour_mc._rotation += 30;
hour1_mc._rotation += 40;
}
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width