Copy link to clipboard
Copied
I have made a file with numbers as placeholders with buttons that navigate along the timeline. But when tested it does not work consistently. Can anyone help me? I have used actionscript 1 and 2 before, but now I have to switch to actionscript 3, and a lot is new to me. I have followed instructions and cannot see what is wrong with the file. Get the file from the link below.
https://dl.dropboxusercontent.com/u/5310648/2014del2svar04a.fla
I doubt it is a bug in the Flash software. I did download your file and I see that if I change the code per what I suggested it does work okay except if you use the "end" button to start things off. Then you get stuck at the end - this is because you skipped the frame where the code gets assigned to the backward moving buttons.
What you might consider doing instead of having the buttons not exist in frames where they won't be used is to instead just turn them invisible in those frames, then tur
...Copy link to clipboard
Copied
Many people will not download files thru the forum for a variety of good reasons. If you show thw code that is not working and explain how your design fits into it you are more likely to get help.
Copy link to clipboard
Copied
Thanks, I will try to do that.
Inge
Copy link to clipboard
Copied
I have four buttons. Two will navigate to each end of the timeline in question. The other two will bring you one step further on the timeline in either direction. The buttons are called start_btn, end_btn, fram_btn and tilbake_btn. The instances are called start, end, fram and tilbake. There are two labels on the timeline, in the Labels layer, one called start, the other called end, at each end of the timeline in question. In addition to the code below, placed at frame number 2, I have a stop-code in the Actions layer at frame number 1 because, when the file is opened I want the movie to stop at this frame.
Here is the code placed in the Actions layer at frame number 2:
start.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_9);
function fl_ClickToGoToAndStopAtFrame_9(event:MouseEvent):void
{
gotoAndStop("start");
}
tilbake.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame_4);
function fl_ClickToGoToPreviousFrame_4(event:MouseEvent):void
{
prevFrame();
}
fram.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame_7);
function fl_ClickToGoToNextFrame_7(event:MouseEvent):void
{
nextFrame();
}
end.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_10);
function fl_ClickToGoToAndStopAtFrame_10(event:MouseEvent):void
{
gotoAndStop("end");
}
Copy link to clipboard
Copied
If the movie stops at frame 1 then how do you get out of frame 1 if the code for the buttons is in frame 2? I am guessing you have at least the nextFrame and end buttons in frame 1 if they are what get you out of frame 1, so you will need to have their code in frame 1 as well.
Copy link to clipboard
Copied
Thanks for the answer! But it did not solve the problem.
From ActionScript 1 and 2, I was used to having a code related to the button. Now the code is in a separate layer in the timeline. This is foreign to me and I do not really understand the logic.
Now I have moved the code for the forward buttons to frame 1. The code for the back buttons is still in frame 2. It works, but inconsistently. It works a couple of times and then it stops. Could it be bugs? Maybe I should download the application and Flash Player again?
Copy link to clipboard
Copied
I doubt it is a bug in the Flash software. I did download your file and I see that if I change the code per what I suggested it does work okay except if you use the "end" button to start things off. Then you get stuck at the end - this is because you skipped the frame where the code gets assigned to the backward moving buttons.
What you might consider doing instead of having the buttons not exist in frames where they won't be used is to instead just turn them invisible in those frames, then turn them visible when you change frames. So in frame 1 you would make the two back buttons invisible and in frame 10 you would make the two forward buttons invisible. Put all of the button event handler code in frame 1 so that everybody is coded up right away and they do not lose it anywhere along the timeline.
Copy link to clipboard
Copied
Thank you, Ned! The problem is solved!
I found out that having buttons on different layers does not work, for one reason or another. It did in Action Script 1 and 2. I put all on the same layer, and then it works. The two buttons that shall not be shown at each end of the movie could easily be hidden by having a invisible grafic over them in a higher layer, as you suggested. Thanks again! Now I can go on with the real work on this website.
Copy link to clipboard
Copied
I am not sure what you mean but you can have as many things on different layers as you like, including buttons. Whatever the problem was it had nothing to do with having things oin different layers.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now