Skip to main content
shortlin
Participant
January 5, 2018
Answered

How do I use my code to call the export file(html5) to control the animate?

  • January 5, 2018
  • 1 reply
  • 833 views

  First,I would like to introduce myself.I am a front-end web developer from Taiwan.My English is not really good,so if you can't understand what I said,tell me the detail to let me know what words let you understand.

  I started Adobe Animate cc just for few days.I think I can use it to learn html5.

  My question is "How do I use my code to call the export file(html5) to control the animate?"

  It means,when I finished the animation.I want to add this animation to my website(I watched this video Adobe Animate CC: Add to HTML web page (Updated Version) - YouTube  to know how to merge my codes).

  Now,I would like to use a plugin,such like Scroll Magic to control the animation's frame(you can see this example[ Image Sequence - Examples - ScrollMagic  ] to know how the scroll magic  control a parameter to his purpose) .I want to control the export file to control the animation's timeline with my other funtion is my codes,such like controling the animation to stop.when I scroll 100 pixel.

  I have no idea to do this.because I can't call the inner code's frame.

  I tested a idea that is using my code to control the animation.When the animation begin after 1 second,it stoped in the frame 7.This is not use Adobe Animate Inner code.It is use my js to control.

  this is the way I had tride:

  In Adobe Animate CC.I declared a global function which is

globalFunc= function(stopFrame){};

  and then add a scirpt in a timeline's frame,it's code is:

var _this=this;

globalFunc=function(stopFrame)

{

    _this.gotoAndStop(stopFrame);

}

  And then I export the files.change the htmls.add my js code:

   var tmpTime = setTimeout(function()

   {

        globalFunc(7);

   }, 1000);

It worked. the animation stopped in the frame 7 after one second.So,I could use this way to control the animation's parameter.But you know.It's not a good way.

and not my purpose.Because It stared after one second. I want it execute immediately.

So If I want to use this way. I must find out where the animation's first initial place to add "globalFunc(7);".
I am not familiar with CreateJS.So I tried a lot of ways,I still could not find out.

But it is not the best way to control the animation's parameter.If you have a better idea,tell me,thanks.

    This topic has been closed for replies.
    Correct answer shortlin

    Finally I found the answer from canvas - How to communicate 'externally' between Adobe Animate CC animations? - Stack Overflow

    .
    Just use

    exportRoot.gotoAndStop(7);

    But I just have a problem here.

    If the animation only has one time line .It works  immediately.(just add the code after "fnStartAnimation();"))

    but if you have a symbol object.We know if we want to stop it.we should stop the symbol object's timeline.not the root stage's time line.

    So I use:

    exportRoot.obj1.gotoAndStop(7);

    "obj1" is the symbol object's instance name.

    It not works.

    but I found,I used setTimer,let it called after one second,It worked.

    well,I think I don't have to call it immediately.

    Because if I want to use scroll magic to control the object's time line.It not needed to call it immediately.

    but I am curious about this problem...

    1 reply

    shortlin
    shortlinAuthorCorrect answer
    Participant
    January 7, 2018

    Finally I found the answer from canvas - How to communicate 'externally' between Adobe Animate CC animations? - Stack Overflow

    .
    Just use

    exportRoot.gotoAndStop(7);

    But I just have a problem here.

    If the animation only has one time line .It works  immediately.(just add the code after "fnStartAnimation();"))

    but if you have a symbol object.We know if we want to stop it.we should stop the symbol object's timeline.not the root stage's time line.

    So I use:

    exportRoot.obj1.gotoAndStop(7);

    "obj1" is the symbol object's instance name.

    It not works.

    but I found,I used setTimer,let it called after one second,It worked.

    well,I think I don't have to call it immediately.

    Because if I want to use scroll magic to control the object's time line.It not needed to call it immediately.

    but I am curious about this problem...