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

How to adjust the path of a tween using actionscript

Contributor ,
Apr 23, 2013 Apr 23, 2013

I'm a novice at Actionscript3 and would greatly appreciate an answer to what seems like a simple question:

Here's my project:

http://home.comcast.net/~samiri/director/mortals/amadoFlashPortrait/index.htm

Click on the gray scale frame images. A larger version of that image tweens out along the z axis. However it comes from 'somewhere else' not from 'within the frame.' How do I get the each larger gray scale frame image to look like it comes directly from the place where the user clicks (not to one side or the other)?

So I guess what I'm asking is how to adjust the path of the tween along the x and y axis using the actionscript code (below).

My method:

I'm using this line of code in my script:

var myTween:Tween = new Tween(mdImg, "z", Strong.easeOut, 300, 0, 1, true);

"mdImg" is the variable that holds the name of the hotspot clicked upon by the user.

I have the larger (faded edge) image positioned directly on top of the frame image and just kept invisible until the User clicks on the hotspot over the frame image.

Thanks much.

TOPICS
ActionScript
777
Translate
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
LEGEND ,
Apr 23, 2013 Apr 23, 2013

You'll need to tween the x and y properties along with the z property if I understand what you are asking about.

For each gray scale image you need to have some way of using it to reference the starting and ending values for your tweens.  YOu might use arrays for these, or you might be able to use the positions of the objects you click

Translate
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
Contributor ,
Apr 24, 2013 Apr 24, 2013

Yes, Ned, using the positions of the objects the User clicks (hotspots) would be best. Would you be so kind as to write that out for me?

So, IOW: What is the actionscript syntax that uses the position of the hotspot to start the tween motion?

I currently have this line in my script (it :

var myTween:Tween = new Tween(mdImg, "z", Strong.easeOut, 300, 0, 1, true);

(mdImg is actually the name of the larger version of the gray scale image that zooms out from the stage.)

Thanks, Ned.

Translate
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
Guru ,
Apr 24, 2013 Apr 24, 2013

the z-property might not actually be what you need. Since it introdúces a stagewide vanishing point which is hard to control by code alone.

You will need either need a combination of x,y,scleX,scaleY-tweens or do your tweens manually.

Translate
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
Contributor ,
Apr 24, 2013 Apr 24, 2013

Thanks moccamaximum,

By "do your tweens manually" you mean to use the timeline to do frame-based tweening? That is an option but I'm wondering (as a newbie): Isn't it better to use actionscript to do animation since you have more control and it's time based rather than frame-rate based (and works better on low performance machines)? Just curious if I should be spending the time to learn actionscript or do it in the traditional way.

Thanks

Translate
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
Guru ,
Apr 24, 2013 Apr 24, 2013
LATEST

Isn't it better to use actionscript to do animation since you have more control and it's time based rather than frame-rate based

It depends, while I myself would always prefer to do sth. via code than with the timeline, there are cases where it doesn`t make sense to crack a nut with a sledgehammer.

From the look of your site its a graphic-centered project where it makes sense to do the WYSIWIG timeline-animiation, since performanmce issues are not relevant (you are not making a game with 1000+ particles sprites on stage)

Translate
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