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

How do I create one (Home / About / Contact / Help etc) button for 16 button instances

Explorer ,
Oct 16, 2020 Oct 16, 2020

Copy link to clipboard

Copied

I am new to Adobe Animate and need to create a presentation in AS6. My problem:
There are 16 images. On frames from 1 to 160    --   Keyframes which change the image are 10, 20, 30  etc till 160

At each keyframe a new image is displayed with navigation buttons on top (like Home, Next, Previous, About etc)
The button  instances are called - e.g. for the "Home" Button:  home1_btn, home2_btn,  ... home16_btn,
For the "Next" button: home1_btn, home2_btn,  ... home16_btn and so on.
 
The big question - do I have to write the same mouse click events - 16 times - that is create an AS3 for each button instance?
The logic would demand that one would write one  code for the base button out of which 16 button instances are created.
And that when one uses an instance of this base button then automatically - if the user ticks "yes" - the code associated to this base button would be executed:
Just as the 4 different states (Up/Over/Click/Hit) of a base button are taken over by all the button instances - why is there not a tick box that allows to create a generic base code for all the button instances ?

E.g. if we take the sample home1_btn to home16_btn      the effect of the mouse click on tis button is always     gotoAndStop("home");
But AS 3 does not seem to allow to write a code for the base button - only a code for the indivdual button instances.. 

Yet, I am sure there must a way to write only one code for all the 16 button instances (they only differ by the appended no.!)
There are  many situations discussed on the net - but none refers to this "same AS3 instructions for multple button instances".
Would be very grateful if solutions to this problem would be discussed.

Thank you for your assistance and understanding.
   

Views

782

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
Explorer ,
Oct 23, 2020 Oct 23, 2020

Copy link to clipboard

Copied

Hi Joao,

1) I do not want to overburden you too much with my many questions - please tell me if I aks too much.
2) Just one thought - related to what you said - which may produce a solution for the problem at hand:
We know that the resulting  keyframe is - in the alphabetical sequence of keyframes one keyframe too low
As the keyframes are alphabetically sorted already (slide0 to slide16) we could just
 - extract the numerical ending of the keyframe that the control routine determined
 - add 1 to it
 - and append it onto the word "slide.." 
But how would we code that?

 

Kind regards,   William-Michael

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
Explorer ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

Hi Joao,

The problem is a little more tricky and I must correct my findings: These are the test results:
1, The control routine works fine as long as the previous slide is the keyfame just before the one in which the 
Previous" button was clicked.
Sample:
I am on key frame 30 and move ahead 1 keyframe (to keyframe 40) via the "Next" button.
If I now (on the key frame 40-stage) click on the "Previous" button your new routine would open up keyframe 30.


2. But if I am e.g. on keyframe 40 and want to move to a frame that is not 1 keyframe lower (e.g. not keyframe 30) 

then it misses the target by one keyframe:
Say I moved from keyframe 80 to 30. Now on keyframe 30 I press the "Previous" button because I want to move back to keyframe 80. But the given routine does not go back to keyframe 80 but keyframe 70..

 

My thinking (which may be wrong) re. solving the problem:
We need to first determine via AS3  that the "Previous" frame was not the one just one lower 
Then, once we know that, we could just increase the count by 1 (count++) and insert 

count = clamp(--count,0,labelsList.length-1);
if (the previous frame is not just the one below the current frame)   count++
gotoAndStop(labelsList[count]);

 

But I would not know how to code this.

i would appreciate any solution to this problem and I think others who want to use Flash for an interactive experience - (user  decides to which frame he wants to go) with "Back Button" would want to know a way for that, too..
                               NB  I tried the function prevFrame() but this dows not seem to work 

Would you know a solution, Joao?

 

Thank you for your understanding and your assistance in solving this problem.

 

Kind regards,    William-Michael

 

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
Explorer ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Oi Joao,

I really need your advice re. the Previous button - I need to write a critical analysis of the presentation (within the next 12 hours) and for this I need to know whether there is a possibility for a full Back button or not.
As well answers to these questions:

To make the Title Screen (keyframe 1-9) more exciting I replaced the   stop(0;   at the end of your routine with         gotoAndPlay(“slide0”);      as an Action for frame 9  (to make the 9 frames run in a loop) and added a motion tween.
I got the motion tween working but the motion tween only works at the start of Flash presentation.
When I click the Next button and then branch back to the “Home (=Title Screen)”  – the motion tween does not work anymore.
Is there a possibility to make the motion tween working whenever I re-enter (branch back to) Keyframe 1-9?

And thirdly - the auto-change of colours for buttons (e.g. when moving over a button) in Keyframe 1-9 does not work anymore. E.g. the Up state of the buttons is green the Over state should be blue.
But since I added the animation - when I move over the button the green colour only shortly changes to blue but then revers back to green. Maybe this cannot be changed since the animation runs in a loop from frame 1-9 not jsut from frame 1-4.
Whatever the answers maybe - e.g. it may well be that animation will not allow for the autochange of button colours and forms - I just like to mention it correctly in my critical analysis of the presentation.

 

So please - if you can - kindly give me some answers to my questions.  

 

Kind regards,    William - Michael

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
Explorer ,
Oct 28, 2020 Oct 28, 2020

Copy link to clipboard

Copied

Oi Joao,
I had to make do without your answers but I hope you are well.
Thank you again for your past assistance.
Regards,    William-Michael

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
Explorer ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

New Bugs!!
How do you overcome the error message “Invalid Type Conversion” without crashing ?
It has an OK button but is of no use as the system completely freezes and there is only Ctrl Alt Del to get out of it - I had to redo several hours work *) - and this happened twice today!
As well Joao - your solution("Previous" button) was very close to be perfect  - could you not have a look at solving the enigma again (or tell me that this is simply not possible)?

Regards,   William-Michael

*) I am pretty new in Animate - so many things are time-consuming for me - ie. they involve a lot of looking-up...

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
Explorer ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

One more urgent rquest, Joao:
I have one further button put on my slides which branches to a hyperlink (Adobe Help Desk) 
else if (e.target.name === "h_btn")
navigateToURL(new URLRequest("https://helpx.adobe.com/au/support/animate.html"), "_blank");
but when I click the button instance nothing happens.
What am I doing wrong?

Would you know how to integrate this into your "button-control-routine "?

Thank you  for your assistance, 
William-Michael

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
Explorer ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

LATEST

One success .... “¯\_(ツ)_/¯“
The navigation to the URL seems to work now.
It seems the problem was a different one.
When I load the movie and start clicking the buttons - they do not respond so quickly -  they seem to need a warm-up-period (maybe the Animate software is quite voluminious and my computer is crying out for more RAM - or if there is some internet involved - our internet connection is rather slow)
But the navigation to the PREVIOUS keyframe is still to be solved....(if possible).

Regards, William-Michael

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