Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adobe Animate Scope issues with HTML5.

Explorer ,
Nov 08, 2018 Nov 08, 2018

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.

357
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 08, 2018 Nov 08, 2018

Hi.

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

Regards,

JC

Translate
LEGEND ,
Nov 08, 2018 Nov 08, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 08, 2018 Nov 08, 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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 08, 2018 Nov 08, 2018

Hi.

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

Regards,

JC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 08, 2018 Nov 08, 2018
LATEST

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')

          }

    })

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