# AS3.0 Help!

**URL:** https://forum.kirupa.com/t/as3-0-help/311964
**Category:** flash
**Created:** [July 21, 2010, 11:30am UTC](https://forum.kirupa.com/t/as3-0-help/311964 "2010-07-21T11:30:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![AsianSpark](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@AsianSpark](https://forum.kirupa.com/u/AsianSpark)
#### Post date: [July 21, 2010, 11:30am UTC](https://forum.kirupa.com/t/as3-0-help/311964/1 "2010-07-21T11:30:23Z")

</div>

So, I’ve decided to switch to AS3. But I have a few problems with my first project.

I’ll tell you how it works.

Okay, so I have 2 movie clips on the 1st frame. One is named ‘bc’ and the other is named ‘mc’. Both are circles with bc is big and mc is a small circle.  
‘mc’ will follow my mouse.  
IF ‘mc’ hits ‘bc’, mc will enlarge and fit to the width, height, x and y of it.

While mc is hitting bc and the tweening is complete, the object wont follow my mouse, it will just stick to the x and y’s of bc.

And if mc doesnt hit bc anymore, it will automatically tween to the mouse positions.

I used caurina’s library for smooth tweening.

I can’t get it to work. Any advice on the code?  
Oh and I’m not using .as files.  
Somehow Flash CS5 “check syntax” button doesnt give me any output.

\*\*[COLOR=“Red”]\*EDIT [COLOR=“Red”]//remove the space in ‘is’ ‘Hit’[/COLOR]  
[/COLOR]

```auto
**
import caurina.transitions.*
import flash.events.Event;
 // 0 = follow
 // 1 = tween in
 // 2 = tween out
var is Hit:Boolean = false; [COLOR="Red"] //REMOVE SPACE![/COLOR]
var isTween:Boolean = false;
var i:Number = 0;
var orWH:Number = 11.05;

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
	updateRootEvents();
	updateAfterEvent();
}

function updateRootEvents():void
{
	if(mc.hitTestObject(bc)) && is Hit == false && i == 0) [COLOR="Red"] //REMOVE SPACE![/COLOR]
	{
		tweenTo();
		is Hit = true; [COLOR="Red"] //REMOVE SPACE![/COLOR]
		i = 1;
	}
	else
	{
		is Hit = false; [COLOR="Red"] //REMOVE SPACE![/COLOR]
		if(i == 1 && is Hit == false) [COLOR="Red"] //REMOVE SPACE![/COLOR]
		{
			tweenOut(); //tweenOut onComplete set i to 0.
			i = 2
		}
		if(i == 0 && is Hit == false && isTween == false){ [COLOR="Red"] //REMOVE SPACE![/COLOR]
		mc.x = mouseX
		mc.y = mouseY
		}
	}
}

function tweenTo():void
{
	Tweener.to(mc,1,{x:bc.x, y:bc.y, width:bc.width-10, height:bc.height-10, ease:easeOutExpo, onComplete:tweenToComplete});
	isTween = true
}

function tweenOut():void
{
	Tweener.to(mc,1,{x:mouseX, y:mouseY, width:orWH, height:orWH, ease:easeOutExpo, onComplete:tweenOutComplete});
	isTween = true
}

function tweenToComplete():void
{
	isTween = false
}

function tweenOutComplete():void
{
	i = 0
	isTween = false
}

```

If there are any obvious mistakes, sorry.  
I just started AS3 yesterday.

Thanks for your help 🙂

**[COLOR=“Blue”]Project files with the caurina library is HERE:[/COLOR]**  
[http://www.mediafire.com/?md72iwn1dwg6rn9](http://www.mediafire.com/?md72iwn1dwg6rn9)
