Skip to main content
Inspiring
November 8, 2018
Answered

Adobe Animate Scope issues with HTML5.

  • November 8, 2018
  • 2 replies
  • 412 views

I am using Animate as a Quick HTML editor that displays data from remote feeds. I am having issues with the Scope. My Code below:

Also I am using a external JS library for all of my gets and posts. This example I am using. https://code.jquery.com/jquery-3.3.1.min.js

var tl = this

//Slide1 and Slide2 are Key Frames on the same timeline. Slide1 = Frame 1 and Slide2 = Frame 2

    $.get( "https://give.benevolentenabler.com/api/custom/totals/1", function( data ) {

        if(data.raised.length > 0){

        tl.theTime.text = "$" + data.raised;

            tl.stop();  <-----Does Nothing. Keeps Playing.     

        }

      else{

     //"Do Something Else Like"

          tl.gotoandstop('Slide2'); <-----Does Nothing. Keeps Playing.

          }

    })

   

I know i have to me missing something super simple.

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

Also, please notice that should be gotoAndStop and not gotoandstop.

Regards,

JC

2 replies

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
November 8, 2018

Hi.

Also, please notice that should be gotoAndStop and not gotoandstop.

Regards,

JC

Inspiring
November 8, 2018

I fixed the naming issues and it still ignores my if and else statements and continues to Slide to.

var tl = this

    $.get( "https://give.benevolentenabler.com/api/custom/totals/1", function( data ) {

        //alert(data.raised);

        tl.theTime.text = "$" + data.raised;

        alert(data.raised.length);

       

        if(data.raised.length > 0){ <------This if statement is true and it does not stop the timeline. It continues to Frame 2.

        tl.theTime.text = "$" + data.raised;

            tl.stop();

        }

        else{ <------Do not think this is doing anything.

     //"Do Something Else Like"

          tl.gotoAndPlay('Slide2')

          }

    })

Legend
November 8, 2018

The usual stuff... have you alert'd or console.log'd inside your code to ensure that tl is actually set? Have you opened the developer console and checked for errors?

Inspiring
November 8, 2018

Yes. I have used Alerts. It is getting data it needs.  Below works.

var tl = this

    $.get( "https://give.benevolentenabler.com/api/custom/totals/1", function( data ) {

        //alert(data.raised);

        tl.theTime.text = "$" + data.raised; 

    })

tl.stop();