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

making a Movie Clip crawl back and forth?

New Here ,
Mar 06, 2013 Mar 06, 2013

I am trying to get a Movie Clip to crawl back and forth, stopping at 12 specific points controlled by 12 separate buttons.

In other words when you click on button 3 the Movie Clip slides to position 3 (X position or frame number), then click button 9 it slides to position 9, click on button 1 it slides back to position 1 etc.

I can make jump to the positions and stop but I can’t make it crawl (slide) to the next x position or to go back to a previous x position.

I am very new to flash and I thank you for any help.

Found this in a tutorial but I don’t know how to modify it to do what I want.

stop();

button1_btn.addEventListener(MouseEvent.CLICK, Shoot_1)

function Shoot_1(event:MouseEvent):void

{

                gotoAndPlay(1)

}

Using flash cs5, ActionScript 3 on a PC. This is for a presentation shown in a conference room.

Thanks again,

Pablo

TOPICS
ActionScript
800
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

correct answers 1 Correct answer

Community Expert , Mar 07, 2013 Mar 07, 2013

no, you're not setup correctly for that code.

that code uses no timeline tweening.  it uses tweenlite to tween you object and includes all that's needed to do what you want.

Translate
Community Expert ,
Mar 06, 2013 Mar 06, 2013

// use a decent tweening engine like TweenLite:

import gs.TweenLite;

var positionA:Array=[[x1,y1],[x2,y2],...,[x12,y12]];

for(var i:int=0;i<positionA.length;i++){

this["button"+(i+1)].addEventListener(MouseEvent.CLICK,clickF);

}

function clickF(e:MouseEvent):void{

var index:int = int(e.currentTarget.name.split("button")[1]);

TweenLite.to(yourmovieclip,.5,{x:positionA[index][0],y:positionA[index][1]});

}

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
New Here ,
Mar 06, 2013 Mar 06, 2013

Thanks I'm so new to flash I really am lost.

Never even heard of TweenLite.

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
Community Expert ,
Mar 06, 2013 Mar 06, 2013

get it here:  http://www.greensock.com/tweenlite/

open TweenLite.as to see how to use it though you can just copy and paste the code i suggested for this project.

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
New Here ,
Mar 07, 2013 Mar 07, 2013

kglad, Thanks again.

I can't make it work because I'm such a noob I don't know exactly where to enter my instance names for my 12 buttons and my 1 sliding movie clip.

I have been experimenting but to no avail. Actually I have spent 4 days searching for a tutorial explaining this and reading everything I could find before I finally stopped the truck and asked for directions.

I'm not sure I have it set up correctly to do this in the first place.

What I have is 100 frames, 12 button instances named button1_btn, button2_btn, etc. on 12 different layers. 1Movie Clip instance named big_tl, size W:2879.95 x H:259.20 Starting position is off stage at X552 Y47.

It crawls from X552 Y:47 to X -2430 Y47 using classic tween in 100 frames.

The movement I’m trying to achieve is:

button1 slides from wherever it is currently to X185 Y47 or frame 13,

button2 X39 Y47 or frame 18 etc.

So my questions are too many but, Am I set up correctly for this code? And could you please instruct me further as to how I fill out the code?

Thank you again for your time and patience.

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
Community Expert ,
Mar 07, 2013 Mar 07, 2013

no, you're not setup correctly for that code.

that code uses no timeline tweening.  it uses tweenlite to tween you object and includes all that's needed to do what you want.

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
New Here ,
Mar 08, 2013 Mar 08, 2013

I finally got it to work. Thanks kglad!

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
Community Expert ,
Mar 08, 2013 Mar 08, 2013
LATEST

you're welcome.

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