• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Hover a button to call frame label in a MC inside a button

Community Beginner ,
Sep 25, 2017 Sep 25, 2017

Copy link to clipboard

Copied

Hi all,

I need help,

On the stage I have  MC(submenu2_mc) & button(pvdDeptmain_btn)

Inside the MC(submenu2_mc) have button(s2l2a_btn)

Inside the button(pvdDeptmain_btn) have MC(paintingdeptup_mc) in UP frame & another MC(paintingdeptover_mc) in OVER frame

So what I want is when mouse over the button(s2l2a_btn) it will play a frame label(animation) inside a MC(paintingdeptover_mc).

and when mouse over out the button(s2l2a_btn) it will run MC(paintingdeptup_mc) in UP frame.

I have tried below code but no luck:

submenu2_mc.s2l2a_btn.addEventListener(MouseEvent.MOUSE_OVER, pvdover);

function pvdover(event:MouseEvent):void

{

    this.paintingdeptover_mc.gotoAndPlay("animation");

}

submenu2_mc.s2l2a_btn.addEventListener(MouseEvent.MOUSE_OUT, pvdout);

function pvdout(event:MouseEvent):void

{

    this.paintingdeptover_mc.gotoAndStop(1);

}

here is my .fla file Dropbox - level2.fla

Thank you.

cc: just.emmaā€‹ RandomlyFishā€‹ Preranā€‹

Views

318

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

Contributor , Sep 26, 2017 Sep 26, 2017

Accessing movieclips inside buttons can be problematic as it is trying to find a property called paintingdeptover_mc, instead of a child with the name paintingdeptover_mc.

So you should use a movieclip for the button instead. You can change that in the properties panel with the symbol selected, if you click the dropdown below the instance name. That will only change the type for that instance, to change it for the symbol in the library, you can click the button next to "instance of:" and change i

...

Votes

Translate

Translate
Contributor ,
Sep 26, 2017 Sep 26, 2017

Copy link to clipboard

Copied

Accessing movieclips inside buttons can be problematic as it is trying to find a property called paintingdeptover_mc, instead of a child with the name paintingdeptover_mc.

So you should use a movieclip for the button instead. You can change that in the properties panel with the symbol selected, if you click the dropdown below the instance name. That will only change the type for that instance, to change it for the symbol in the library, you can click the button next to "instance of:" and change it in the symbol properties. Now since it's a movieclip, you'll have to add stop(); to the first frame so that it doesn't loop the frames.

And here's what the code should be:

submenu2_mc.s2l2a_btn.addEventListener(MouseEvent.MOUSE_OVER, pvdover);

function pvdover(event:MouseEvent):void

{

    pvdDeptmain_btn.gotoAndStop(2); // Added since it was changed to a movieclip

    // pvdDeptmain_btn.paintingdeptover_mc.gotoAndPlay("animation"); // Changed from this.paintingdeptover_mc but is not needed in this case

}

submenu2_mc.s2l2a_btn.addEventListener(MouseEvent.MOUSE_OUT, pvdout);

function pvdout(event:MouseEvent):void

{

    pvdDeptmain_btn.gotoAndStop(1); // Added since it was changed to a movieclip

    // pvdDeptmain_btn.paintingdeptup_mc.gotoAndStop(1); // Changed from this.paintingdeptover_mc but is not needed in this case

}

if you add trace(this); inside one of those functions, you would see that it's referring to the main timeline, so it wouldn't have been able to access paintingdepthover_mc.

For the buttons inside submenu2_mc, is there a reason why you use instance names such as "s2l2a_btn"? You could use an instance name such as "0_bth", "a_btn" or "pvd_btn". You don't need unique instance names for each symbol, so the same instance name could be used for a different symbol outside of submenu2_mc.

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 Beginner ,
Sep 26, 2017 Sep 26, 2017

Copy link to clipboard

Copied

LATEST

Hye RandomlyFishā€‹,

Thanks for the reply. So, there is no solution to use button?

I've change it to MovieClip & working nicely .

For the buttons inside submenu2_mc, is there a reason why you use instance names such as "s2l2a_btn"? You could use an instance name such as "0_bth", "a_btn" or "pvd_btn". You don't need unique instance names for each symbol, so the same instance name could be used for a different symbol outside of submenu2_mc.

the "s2l2a" is stand for second Sub-menu in Level 2 at Section A in Physical vapor deposition (PVD) Department, because this is just one of many scene for my interactive production map

Btw thanks again for helping me, its been 3 months now & i am starting to liking Animate more & more.

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