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

Question_mouse cursor_click to hide_movieclip will not play after button clicked

Community Beginner ,
Dec 01, 2020 Dec 01, 2020

See Code Below - I have a simple mouse cursor exercise as part of a bigger project. Before I go forward, I want to know what code I must add / remove to make both movie clips "splash1_mc" and splash3_mc" play, once each button has been clicked. I have only created two buttons for now and having issues with the second button / movie clip action working. The first button works and the movie clip plays, the second button works but the second movie clip will not play at all. I have built it many different ways - different MC's, the same MC, different instance names, this.stop(); at first frame, separate frames on the main timeline - nothing works. This scene will eventually have at least 20 buttons to click using a time/score counter. As mentioned, this is part of a bigger project so want to get this correct before I move forward. Let me know what I can do so each 20 frame movie clip plays after each button clicked. Thanks! 

 
Main Timeline
stop();
stage.addChild(ball1_mc);
ball1_mc.mouseEnabled = false;
ball1_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor_5);
function fl_CustomMouseCursor_5(event:Event)
{
            ball1_mc.x = stage.mouseX;
            ball1_mc.y = stage.mouseY;
}
Mouse.show();  // this is superfluous unless there's code elsewhere that hid the mouse
splash1_mc.visible = false;
splash3_mc.visible = false;
jelly1_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_15);
function fl_ClickToHide_15(event:MouseEvent):void
{
jelly1_mc.visible = false;
splash1_mc.visible = true;
}
jelly2_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_14);
function fl_ClickToHide_14(event:MouseEvent):void
{
jelly2_mc.visible = false;
splash3_mc.visible = true;
}

 

Movie Clip to play twice, then stop (want mc's like this play twice after each button clicked - want at least 20 on main timeline.)

 

if (!this.looped) this.looped = 1;
if (this.looped++ > 2) this.stop();

 

323
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 , Dec 01, 2020 Dec 01, 2020

place a stop() on their first frame, add play() in your two hide listeners:

 

jelly1_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_15);
function fl_ClickToHide_15(event:MouseEvent):void
{
jelly1_mc.visible = false;
splash1_mc.visible = true;
splash1_mc.play();
}
jelly2_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_14);
function fl_ClickToHide_14(event:MouseEvent):void
{
jelly2_mc.visible = false;
splash3_mc.visible = true;
splash3_mc.play();
}
Translate
Community Expert ,
Dec 01, 2020 Dec 01, 2020

place a stop() on their first frame, add play() in your two hide listeners:

 

jelly1_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_15);
function fl_ClickToHide_15(event:MouseEvent):void
{
jelly1_mc.visible = false;
splash1_mc.visible = true;
splash1_mc.play();
}
jelly2_mc.addEventListener(MouseEvent.CLICK, fl_ClickToHide_14);
function fl_ClickToHide_14(event:MouseEvent):void
{
jelly2_mc.visible = false;
splash3_mc.visible = true;
splash3_mc.play();
}
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 Beginner ,
Dec 01, 2020 Dec 01, 2020

It works - yay! Thanks so much 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 ,
Dec 01, 2020 Dec 01, 2020
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