An addition to the last class lab

I am trying to figure this out on my own so If I do figure it out there will be more to add later but as far as this week goes heres what i figured out.

To solve the problem of the sphere not scaling when the mouse in the left portion of the (ie x = half that of the stage width) you have to add the absolute function to the clamping code.

Here is the code to add at the computing function portion of the script……….

//// computing events
this.addEventListener(Event.ENTER_FRAME, mainLoop);
function mainLoop(event:Event):void {
///////distance from mouse
var distancetoMouseX:Number = clamp(Math.abs(container.mouseX), smallRadius,largeRadius);

/////// compute radius
var sphereRadius: Number;
sphereRadius = smallRadius + largeRadius – distancetoMouseX;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s