Copy link to clipboard
Copied
I work with Adobe Animate CC html5 canvas to create an interactive board with different panels of switches, analogue and digital instruments and so on. On some parts of a helicopter model I display the rotational speed. When starting my project all speeds has to be zero. When I use some button the speed (rounds per minute = rpm) should increase. As rotation of e.g. the rotor must be synchronous to the value of the pointer of the analogue instrument I added a function call to each frame of the pointer animation of that instrument to increase the value of the rotor rpm by one. As this rotation speed is dependant on other rotation, after increasing the value I call another function to check the rotation speeds. It looks like this:
On each frame I call the increase function:
this.parent.increaseValue();
The function increaseValue() looks like this:
this.increaseValue = function() {
rpm_rotor++;
this.mc_rotor.text = rpm_rotor.toString(); // displays the rotation at the helicopter model
check_rpm();
}
My check-routine will check the dependant values:
function check_rpm()
{
.....
if ( rpm_OfOtherPart == 0 )
{
rpm_rotor = 6144;
this.mc_rotor.text = rpm_rotor.toString();
}
}
And here is my problem:
As soon as I start my program it displays on my helicopter model the value 6144 although I didn't interact with my program to start the animation (value of rpm_OfOtherPart is right now 0). When I comment out the function call to check_rpm() it shows the correct rpm of zero. How can it be that the function check_rpm() will be executed without function call?
Copy link to clipboard
Copied
do you have this.stop() on all timelines BEFORE calling this.increaseValue()?
Copy link to clipboard
Copied
Thank you for your reply.
No, I don't. See it in this way. I've got a switch with different positions: 0% 27% 64% 100%
Switching it from 0 to 27 the timeline plays from frame 1 to 28. At each frame the function
increaseValue() is called to
1. change the rotation speed on my helicopter model and
2. check if rotation speed OfOtherPart is equal 0.
If I would insert this.stop() on the top of each frame I wouldn't get
a fluent animation of the pointer of the analogue instrument as animation
would stop at each frame I think.
But thanks again for your reply. It is a really crazy problem. So I think
I had to change the complete code to not call the function out of another
function.
Copy link to clipboard
Copied
if the timeline with those function calls plays at the start , the calls occur at the start causing what you think is a problem.
Copy link to clipboard
Copied
Good morning Sir!
My Project consists of the Main Timeline with two frames. The frist frame is my starting screen.
The second frame displays buttons, switches, analogue pointer instruments and the model of a helicopter.
When clicking on a button or use a switch a timeline of an movieclip will be called like
this.mc_APPCstarthebel.gotoAndPlay(50, "PlayHebel");
And within this timeline of the movieclip I call the function
this.parent.increaseValue();
where you will find the function call to check_rpm() which changes the value
of a textfield to 6144 when entering frame 2 of my project.
For now after entering frame 2 I just call a function once where I set this value
back to zero. I think it makes no sence to look days for days for the error when
I can get rid of it with changing the value manually.
Thanks all for your help!
Copy link to clipboard
Copied
ok.
Copy link to clipboard
Copied
Also, you should upgrade to Adobe Animate 22.0.6
Copy link to clipboard
Copied
Thanks for your hint. I can do that after finishing my project. I never change
the software version during production.