views:

289

answers:

1

I have a small task in Flash, that I'm having a little trouble with.

First of all, I have 2 layers. The first is a gradient with various colors, on top of that is the second layer, which is a shape tween(movie clip). For those of you using CS4, a classic tween. I'm using CS3 and Actionscript 2

I've allready done the shape tween, it's very simple, it turns into a shuriken and back to the circle.

The thing is, I need to program it so that this only happens when I move my mouse over the circle. And should I move my mouse away from the circle/shuriken, it should remain forever in the shape it had the moment I left the area. So if it's halfway from circle to shuriken and I remove my mouse from the area, it should remain in that halfway form, not jump back to being a circle.

Second, I need to be able to drag the shape, and while dragging it, the shape tween must behave like it would normally. Releasing it doesn't make it stop "tweening", only moving my mouse out if its area. The gradient background gives the nice effect of the colors constantly changing.

I've named the shape-tween "circle_mc".

What I can't implement:
1) The shape reacting to my mouseover
2) Making the shape dragable.

Can someone give me some hints, perhaps articles or examples on this?

A: 

If I'm following correctly, you should be able to place something similar to the following script inside the "circle_mc" clip where your shape tween is. This will allow you to create multiple instances of the clip that do the same action. I've uploaded a test for you to check out. If that's not at all what you meant, let me know. You could also create an external class to use as the base class of your graphics and put the code in there.

var hasRolledOver:Boolean = false;

this.onPress = function():Void
{
    this.startDrag();
}

this.onRelease = function():Void
{
    this.stopDrag();
}

this.onRollOver = function():Void
{
    if (!hasRolledOver)
    {
     this.gotoAndPlay(2);
     hasRolledOver = true;
    }
}

this.onRollOut = function():Void
{
    this.stop();
}

http://typeoneerror.com/media/as/test.fla.zip

Typeoneerror
Very nice, thanks. But what I'm trying to achieve is not only the circle going to shuriken shape, but back. And this in an infinite loop that keeps playing as long as my mouse is hovering over the shape. Also, in your test version, if I move off the shape and then back, it doesn't continue.
WebDevHobo