REPEATING A (SET OF) FRAME(S) FOR A CERTAIN TIME

Explorer ,
Nov 18, 2020

Copy link to clipboard

Copied

I am very new so please do not be offended by my basic questions which - despite searching the net - I could not answer.
So far I have only mastered the art of button-controlled-branching to other frames.
So yes when a user presses a button the program branches to a set of 10 slides called "slide17"  (on frames 170 to 179 - keyframe = frame 170).

Now I would like to code the following:

On the background (stage image) of these frames (170-179) I want to play some animations and then - without the user pressing any buttons - return to keyframe 10 (which I called "slide1").

My thought was to tell adobe animate to 
   - "gotoAndPlay("slide17")  - "for a certain time - (20 seconds)"   
   - in this time performing some motion tweens on the screen background (stage image)
   - and then automatically banch to frame 10   = >   gotoAndStop("slide1");

How could I code this - to "stay on a frame for a certain time" ?

 

Kind regards,  William-Michael

Views

126

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 18, 2020

Copy link to clipboard

Copied

canvas or as3?

 

what's the animation on frames 170-179?

 

if it's a movieclip on keyframe 170, start a loop and repeatedly check for the last frame of that movieclip.  when reached return to "slide1".

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 18, 2020

Copy link to clipboard

Copied

Hi Kglad,

Sorry, I do not yet know what canvas is – so I think it will be movie clip – something dropping from the sky.
Case in point: My program change is an add a motion tween in between 2 already existing slides (slide 0 and slide 1) of a (button-controlled) slide show.
1.  Ideally I would add 10 frames in between slide 0 and 1:  But how?
There is a possibility to “add a frame”.
But when I add this frame it only changes the one layer where the play-head is in.
E.g. if I selected e.g. the layer “actions” and then right click “Add Frame” – it will add a frame to the “actions” layer but not to the other layers. If I need to redo the 17 slides with all the interactive buttons and artwork, this would take too long

  1. To bypass this problem I simply added 10 frames at the end (frame 170 to 179), called them “slide17” and branch to them instead of slide 1  (= instead of gotoAndPlay(“slide1”)   it is now gotoAndPlay(“slide17”)

3. Now what you say re. repeating  I had already done:
(I arrive in keyframe 170 (“slide17”) via a user button click in slide 0.)
Actions in
Key frame 170:   stop();
Keyframe 179:    gotoAndPlay(“slide17”)
But how do I tell Animate to interrupt this endless loop ca. 20 seconds later and branch back to “slide1”

4. Ideally this could be a time setting per frame. I did not find one.
So I tried to find an instruction like For I = 1 to 40  gotoAndPlay(“slide17”)
As I could not find any info about such a loop instruction on the net I got in contact with Adobe Help.
But they told me I should try to find an answer in discussions on this portal.
They gave me a link to a 1054 page developer manual which handles mainly graphic issues.
Strangely there seems to be no AS3 instruction manual

 

All sorts of thoughts appear in my mind - like why not try to make a sep. motion tween slide and Call the subprogram - but how is this done.

 

Thank you for any assistance you can give me in this matter.

William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 19, 2020

Copy link to clipboard

Copied

To Kglad:
I got it working now!
To share the experience I enclose the code that I used with good success
The time at which the frames (170-179) and (180-189) show up can be manipulated by setting
numPlayed17 = 24;
numPlayed18 = 24;
in keyframe 1 actions to a larger or shorter value.
The effect,  to have each set of frames on stage for a while to run tweens is now working.

Thank you for your advice to re-check my looping....

Kind regards,       William Michael 

 

In Keyframe 1:

import flash.events.MouseEvent;

var numPlayed17:Number = 0;
var numPlayed18:Number = 0;

function stageClickHandler(e:MouseEvent):void
{
if  (e.target.name === "start1_btn")
{
numPlayed17 = 24;
numPlayed18 = 24;
gotoAndPlay("slide17");
}

(... (there are checks for further buttons and they all work very well)

 

In keyframe 179:

if (numPlayed17 > 0) {

                numPlayed17 = numPlayed17-1;

                gotoAndPlay("slide17");

                } else {

                gotoAndPlay("slide18");

}

 

In keyframe 189:

if (numPlayed18 > 0) {

                numPlayed18 = numPlayed18-1;

    gotoAndPlay("slide18");

                } else {

                gotoAndPlay("slide1");

}

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

you're welcome.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 19, 2020

Copy link to clipboard

Copied

Hi Kglad, 
One more question, though:
I somehow seemed to have lost my AS3 code:
When I click Window / Actions the panel opens with the keyframes with code on the left side but with no code on the right side.

Interestingly the test run worked as normal so the code must be somewhere
The question is where  did it go.
If this is a clue - for some reason I cannot click on the keyframes on the left (when I click a keyframe on the cursor goes away.
How can I get my cod back?

 

Thank you for your assistance - 

KInd regards,   William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 19, 2020

Copy link to clipboard

Copied

If this is any clue::  The symbols to the right of the text "Add using a wizard" are all dimmed.

William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

use the insert photos's icon to show a screenshot of what you're viewing that's causing a problem.

 

kglad_0-1605819562432.png

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 20, 2020

Copy link to clipboard

Copied

Thank you Kglad.
I will remembe for future correpondence. It is very strange that this taking away of code would happen without any warning. But this time I redid the lost 1 day work because I have to deliver my job in a few days - so time was very essential. . Thank you again.

Kind regards,     William Michael 

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 20, 2020

Copy link to clipboard

Copied

you're welcome.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 21, 2020

Copy link to clipboard

Copied

HI Kglad,

One more question = which plagues me for days on end:
In my presetnation I as the user for his first name and I then use this first name to print a welcome message.
So to get  the user to sign the keyframe set starts with "stop();"  because I have to wait until the user signs in..
When he finishes writing his name he presses a GO button and is presented with his message.
Now, naturally I want the user to read and think of this message for say 5-10 seconds before continuing with the next screen.
I could ask the user to click a continue button.
But nicer would be if I could I program this short stop with a "wait 5 s-10 seconds" command.and then automatically continue on.
Is there such a possibility?

 

Thank you for your assistance.

KInd regards,  William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 21, 2020

Copy link to clipboard

Copied

yes, there are numerous ways to do this.  one is to use setTimeout:

 

stop();

clearInterval(toInterval);  // this is to ensure this timeout is NOT currently running

var toInterval = setTimeout(waitF,8000); // 8000 ms = 8 seconds

 

function waitF(){

//play() or gotoAndPlay() or whatever you want at the end of the 8000ms delay

}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 21, 2020

Copy link to clipboard

Copied

Works perfectly - Thank you very much.
Glad I met you,  Kglad

William-Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 21, 2020

Copy link to clipboard

Copied

Sorry but two more questions, if possible.
1. Is there a way that motion tweens do not .stop the use of buttons and input text fields?
If I use a motion tween in a separate part (left half) of my keyframe it blocks of any user input (Enter your name: ...) and buttons on the right half of the key frame

2. Is there a way to make buttons visible and invisble via code?

 

Kind regards,

William Michael

 

PS
Not sure if Adobe rules permit this:  I had asked this same question as well to another person:

https://community.adobe.com/t5/animate/visible-property-of-objects/m-p/11614421?page=1#M337749


 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 22, 2020

Copy link to clipboard

Copied

Sound files ….

They are so easy to install but do they only seem to work well when the tune is played the first time ?
I installed an mp3 file but in the wrong frame.
So I took it off and reinstalled the mp3 song  again in the right frame.
Result: Adobe somehow copied and mixed the 2 sound files together.
That is what I first thought.

I selected “none” (sound) in the property inspector. No change.
I deleted the file in the library and reloaded it . No change.

I finally saved the fla-file without the mp3 file then imported the mp3 file again  into the library.Result:
It played well, i.e.  the first and second time I started the animate file.
The third time it began to slur and have additional sounds.
And it got worse from here.

Interestingly – when I then right-clicked the sound file in the library itself and then clicked “Play” – my Windows Media Player plays the tune it perfectly - so nothing is wrong with the sound file.
.

How can I tell Animate to always paly the original file?

Kind regards,    William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 22, 2020

Copy link to clipboard

Copied

and re: your sound file issue, most likely it's a user error, not an animate issue.

 

eg, having sound attached to a frame is problematic for inexperienced animate users unless they're careful to never play the frames that contain the sound more than once.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 22, 2020

Copy link to clipboard

Copied

Thank you, Kglad.
I just wonder why my buttons flag a compilation error when I want to make them invisible/visble.

And re . music: I have one frame (start up frame 1)  which immediatly plays blurred music.Adobe just says to drag the sound from the library to the frame and thatis what I did.  How would you, as an expert, code or add a sound file that always works to any frame?
Kind regards, 
  William Michael

 

 

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 22, 2020

Copy link to clipboard

Copied

if the error is 1009, you're using an incorrect reference.  you must use the instance name (in the properties panel), not the library symbol name (though they can be the same name).

 

you most likely have the sound attached to more than one frame either on the same timeline (in different layers) or different timelines or the timeline has more than one frame and no stop() in the first frame.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 22, 2020

Copy link to clipboard

Copied

PS

Re. the button instance the error mentioned is 
1050: Cannot assign to a non-reference value.

Re. the mp3 file:   I just want to play some music for all frames
 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 22, 2020

Copy link to clipboard

Copied

I forgot to mention the tween situation.
The tween is played on the right half of the screen - the input text field and button are on the left half of the screen: The tweeen does not touch any of those two.
I have been told that tweens may sometimes interfere with the functioning of other objects - E.g. one other object that does not like tweens  I found, is a button changing colours when hovering over // clicking onto it (button only changes colour for a split second then turns back to the standard  up-mouse colour)

William Michael

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 22, 2020

Copy link to clipboard

Copied

tweens interfere with nothing (except maybe the tweened object because of user error.)

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 23, 2020

Copy link to clipboard

Copied

Thank you Kglad.
Re. the sound - It cannot be the stop(); 
If it were the use on 2 frames then how come it plays first fine then falls to pieces?
But if it it were - would this mean one would have to check through all the frames in each layer to find th culprit? Should there not be a possibility to just tell Adobe I want the whole program have no sound?
I mean as long as there are humans, mishaps happen. So this is "start anew from (sound) "scratch" is certainly sometimes meeded. And if one thinks of those user errors there should be a feature that tells the user - your sound is overlapping because of a second sound instance in frame   ... layer ...
The same for the blockages due to tweens. Even if it is a beginner programming error that may cause the damage - there shuld be a better error tracing by the Animate software instead of inhibitng the use of input and let the programmer gueess what it may be. 
In due respect - 

It  may be hard to nderstand for a very experienced person that knows the software and its limitations or methods.but it is very upsetting for a newbie.

 

KInd regards.   William Michael

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 23, 2020

Copy link to clipboard

Copied

use the "insert photo" icon to show a screenshot of the 1050 error and show the line of code triggering the error (ie, tick "permit debugging" in file>publish settings>flash)

 

kglad_0-1606141979753.png

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Nov 23, 2020

Copy link to clipboard

Copied

photo 2.PNGphoto 1.PNGphoto 3.PNGphoto 4.PNGphoto 5.PNG

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 23, 2020

Copy link to clipboard

Copied

that's a 1009 as i suspected (above about 3 of my messages ago) though i don't see the line number in the error message (which would be there if you followed my suggestion to "permit debugging") and i don't see line numbers in you code to pinpoint the line of code triggering the error.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more