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

Getting a movie clip to stop playing, when another one is activated.

Enthusiast ,
Jan 06, 2010 Jan 06, 2010

Copy link to clipboard

Copied

Hello,

I have a file with 3 movie clips and three buttons that control them to play...with the script below It is working fine.

stop()

function startImageOne(Event:MouseEvent):void
{
    imageOne_mc.play();

}
function startImageTwo(Event:MouseEvent):void
{
    imageTwo_mc.play();
}
function startImageThree(Event:MouseEvent):void
{
    imgThree_mc.play();
}

start1_btn.addEventListener(MouseEvent.CLICK, startImageOne);
start2_btn.addEventListener(MouseEvent.CLICK, startImageTwo);
start3_btn.addEventListener(MouseEvent.CLICK, startImageThree);

Then, I wanted to stop a movieClip, if another one was selected to play..so I inserted stop options to the function, which I thought would work, but doesn't. Does any one know why...See this code below..

thanks

stop();

function startImageOne(Event:MouseEvent):void
{
    imageOne_mc.play();
    imageTwo_mc.stop();
    imgThree_mc.stop();

}
function startImageTwo(Event:MouseEvent):void
{
    imageTwo_mc.play();
    imageOne_mc.stop();
    imgThree_mc.stop();
}
function startImageThree(Event:MouseEvent):void
{
    imgThree_mc.play();
    imageOne_mc.stop();
    imageTwo_mc.stop();
}

start1_btn.addEventListener(MouseEvent.CLICK, startImageOne);
start2_btn.addEventListener(MouseEvent.CLICK, startImageTwo);
start3_btn.addEventListener(MouseEvent.CLICK, startImageThree);

thanks

Babs

TOPICS
ActionScript

Views

493

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
LEGEND ,
Jan 06, 2010 Jan 06, 2010

Copy link to clipboard

Copied

There's nothing wrong with the code except that you might possibly have mixed up the naming of things (using img versus image).  What goes on in the animations themselves?

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
Enthusiast ,
Jan 06, 2010 Jan 06, 2010

Copy link to clipboard

Copied

Hi Ned,

I checked the names and they are all correct...(I named one of the instances img instead of image, but it is all fine.

The movie clips are simple...They have a stop action in the first frame, and then it is just an image that fads in and fades out..

Pretty simple?

The code looks fine, so I can't figure out, why the movie clip that is currently playing doesn't stop, when another button is activated.

It seems like is should work??

I'll keep playing .. thanks!!

babs

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
LEGEND ,
Jan 06, 2010 Jan 06, 2010

Copy link to clipboard

Copied

Are those timeline-based fades or actionscript-based fades?  I have been assuming they are timeline-based.

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
Enthusiast ,
Jan 06, 2010 Jan 06, 2010

Copy link to clipboard

Copied

LATEST

Yes, they are all timeline based.


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