PDA

View Full Version : Fairly simple scripting concept confusion



Spyder
11-20-2004, 09:03 PM
I'm trying to create a fairly simple effect but am getting confused with FlashMX 2004 pro's version of actionScript.

I have created a triangle within a circle and have converted it to a mc. When the user rolls over the right half of the circle, the triangle (and accompanying circle) needs to rotate 90 degrees cw. If the user rolls over the left half, the triangle needs to rotate 90 degrees (from original position) ccw.

I could easily set up two moveClips, one that turns to the right and one that turns to the left. BUT, I don't want it that cheap. If the user has rolled over the right 1/2 and then rolls over the left 1/2, the triangle should rotate 180 degrees ccw (and vice-versa).

Currently I'm using two buttons that control the triangle_mc. Here is the code that I've attached to the right-half button:

on(rollOver) {
//disable handCursor to eliminate 'button' feel
this.useHandCursor = false;
while (spinTri_mc._rotation < 90){
updateClipEvent(); //<--not working
spinTri_mc._rotation += 2;
}
}

//when user mouseLeaves the button, triangle should reset to 0 degrees, not //working :(
on(rollOut) {
while (spinTri_mc._rotation > 0) {
spinTri_mc._rotation -= 2;
updateClipEvent();
}
}

The rollOver function does work, but makes the triangle 'jump' from 0 degrees to 90 degrees. The rotation effect is not seen.

Is there a better way to approach this? I mean, can you not simply detect the mouse entering the movieClip and have the movieClip react to that?

Please advise, I've read many pages of the FlashMX Bible, many hours spent wasting my time through the feeble 'Help' files associated with Flash MX 2004 pro and more hours trying to find the answer online.

I appreciate any suggestions and conceptual ideas.

TIA,
Spyder

Spyder
11-23-2004, 10:18 PM
I've seen many similar posts to mine above on many different forums and none of those are answered either. Could it be that Macromedia has really screwed things up by developing in their own world and leaving all the developers left stranded?

After all, it's not like their help files are really any help at all either!

Hhhhmmm. Next time I will not be so quick to trust the 'Macromedia' name. :(

Blue Cat Buxton
11-24-2004, 02:22 AM
I've seen many similar posts to mine above on many different forums and none of those are answered either. Could it be that Macromedia has really screwed things up by developing in their own world and leaving all the developers left stranded?

After all, it's not like their help files are really any help at all either!

Hhhhmmm. Next time I will not be so quick to trust the 'Macromedia' name. :(

I think the problem is that Flash actionscript (and flash) tries to be a cut down mix a programming languages, without actually doing any of them well.

I did some programming in Flash 4 and found that I was using more work arounds to sort problems rather than getting a neat solution that does exactly what I wanted. This could have been that I just wasn't using it enough to get really profficient and I am sure there is a way of doing what you want.

Unfortunately I dont have MX (or even 4 installed any more) so can't paly around with your code to try and help. :(