Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 494427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:29:44+00:00 2026-05-13T05:29:44+00:00

Hi I have a as3 file (listed below) that simply moves a box along

  • 0

Hi I have a as3 file (listed below) that simply moves a box along the X axis when a mouse is over it (using Tweenlight) . What I want to do though is put the box on a 30 degree angle and have the box move along this angle. Can anybody tell me what I am doing wrong please ?

import com.greensock.*;
import com.greensock.easing.* ;


cont.addEventListener(MouseEvent.ROLL_OVER, onOver);
cont.addEventListener(MouseEvent.ROLL_OUT, onOut);
var stx:Number;

function onOver(e:MouseEvent):void
{
    var stx:Number = cont.x +20 ;

    TweenLite.to(cont, 1, { x:stx });
}

function onOut(e:MouseEvent):void
{
    stx = cont.x - 20 
    TweenLite.to(cont, 1, { x:stx } );
}

Here is live example: http://img42.imageshack.us/i/box.swf/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:29:44+00:00Added an answer on May 13, 2026 at 5:29 am

    The hardest thing is to move your box on a line at a 30 degree angle.
    You’ll have to use Trigonometry…remember SOHCAHTOA?

    So basically you’ll need to move in the x and the y direction.

    In your onOver handler…

    you want to move x to 20Math.cos(30Math.PI/180)

    you want to move y to 20Math.sin(30Math.PI/180)

    The cos and sin gives you the x and y steps to keep your objects moving along 30 degrees.

    If you want your object to move more change the 20 parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AS 3.0 class that loads a JSON file in using a
I have a AIR for mobile pure AS3 project that saves a file on
I have a menu that is built using its own AS3 class, when a
I have an iOS app that's using AS3 and AIR. I have external swfs
I'm coding a website in pure AS3 using FlashDevelop and have an object that
I have a function in my AS3 that frequently calls a PHP file. It
I have managed to create an AS3 script that uses file.download(urlRequest); - this is
(Flash Professional / AS3) I have a main fla file that loads a game
I have exported data .xls file using as3. var xml:ArrayCollection; xml=Labneuron8.lastResult.Response.Terminal as ArrayCollection; var
I have a function in my AS3 that frequently calls a PHP file. Most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.