• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Action script - move (animate) horizontally

Explorer ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Hi,

I need help solving this.  I have a symbol that i want to move 1920 pixels to the right when i click a button.  I can do this using "Move horizontally".  but this will send the symbol directly.  I want it to move as an animation.

Using the "animate horizontally" snipet, moves the symbol but using a speed, not distance.

 

any help would be appreciated.

 

thanks!

TOPICS
ActionScript

Views

875

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 30, 2022 Nov 30, 2022

Thanks.

 

For this case, you can use a Tween.

 

Just replace the code that you have in your file:

import fl.motion.easing.*;
import fl.transitions.Tween;

var tween:Tween;

go.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

function fl_ClickToPosition(event:MouseEvent):void
{
	tween = new Tween(movedor, "x", Back.easeInOut, movedor.x, 655.4, 1, true);
}

back.addEventListener(MouseEvent.CLICK, fl_ClickToPosition2);

function fl_ClickToPosition2(event:MouseEvent):void
{
	tween = new Twee
...

Votes

Translate

Translate
Community Expert ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Hi.

 

You can use a tween to animate the symbol instance and then set a button to play this timeline on click.

 

Or can't you use timelines?

 

Please let us know.

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Hi Joao, I prefer not to use timeline,

 

here an example of what i want to do, here i have atwo button that nmove a symbol right and left.  I would like to object to animate to te next possition, not to jump the 600 pixels...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

OK. No problem.

 

Did you try to attach some file? There isn't any in your comment.

 

If it's an FLA, you're gonna have to upload it to a file sharing service (e.g.: Creative Cloud, Google Drive, Dropbox, WeTransfer...) and paste the link to the file here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Thanks.

 

For this case, you can use a Tween.

 

Just replace the code that you have in your file:

import fl.motion.easing.*;
import fl.transitions.Tween;

var tween:Tween;

go.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

function fl_ClickToPosition(event:MouseEvent):void
{
	tween = new Tween(movedor, "x", Back.easeInOut, movedor.x, 655.4, 1, true);
}

back.addEventListener(MouseEvent.CLICK, fl_ClickToPosition2);

function fl_ClickToPosition2(event:MouseEvent):void
{
	tween = new Tween(movedor, "x", Back.easeInOut, movedor.x, 55.4, 1, true);
}


Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

Thanks Joao, this is perfect.!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

LATEST

Awesome! You're welcome!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines