Skip to main content
Inspiring
May 31, 2022
Question

Adobe Animate CC 2021 function call on Program start

  • May 31, 2022
  • 2 replies
  • 299 views

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?

    This topic has been closed for replies.

    2 replies

    Community Expert
    June 1, 2022

    Also, you should upgrade to Adobe Animate 22.0.6

    Inspiring
    June 2, 2022

    Thanks for your hint. I can do that after finishing my project. I never change

    the software version during production.

    kglad
    Community Expert
    Community Expert
    June 1, 2022

    do you have this.stop() on all timelines BEFORE calling this.increaseValue()?

    Inspiring
    June 2, 2022

    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.

    kglad
    Community Expert
    Community Expert
    June 2, 2022

    if the timeline with those function calls plays at the start , the calls occur at the start causing what you think is a problem.