Skip to main content
Inspiring
April 14, 2019
Answered

HTML5 canvas not working on PHP files

  • April 14, 2019
  • 1 reply
  • 1613 views

I have a problem when I change an animate canvas file from html to php so it doesn't start up. In the Chrome browser, I get this message in the console:
Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught ReferenceError: AdobeAn is not defined
at init (index.php:33)
at onload (index.php:105)
Failed to load resource: the server responded with a status of 404 (Not Found)

Inside the init function I get this marked with red text was comp = AdobeAn.getComposition ("89ED7AB5C946D849B35B1594202278DE")

With Microsoft's Edge browser, I get this message in the console: SCRIPT5009: SCRIPT5009: 'AdobeAn' is not defined index.php (33,2)

What is it due to? I want the canvas in the php file.

    This topic has been closed for replies.
    Correct answer peor

    peor  wrote

    I wonder why it doesn't work. What does 404 mean?

    404 Not Found
    The requested resource could not be found but may be available in the future.
    (List of HTTP status codes)
    It means, that something couldn't be found on the server. I guess it's the index.js file linked in index.php. (depending what you did in Animate's Publish Settings the js-file might be named differently). Let's say it's index.js = it will be linked in index.php like this (line 02):

    <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>

    <script src="index.js"></script>

    If this can't be found then AdobeAn is in no way defined and the process runs into more trouble in around line 33 with:

    var comp=AdobeAn.getComposition("89ED7AB5C946D849B35B1594202278DE");

    There you've got this Error:

    Uncaught ReferenceError: AdobeAn is not defined

    at init (index.php:33)

    This error:

    at onload (index.php:105)
    Failed to load resource: the server responded with a status of 404 (Not Found)

    is related to this line (02) in your index.php:

    </head>

    <body onload="init();" style="margin:0px;">

    In the init() function the malaise with var comp=AdobeAn.getComposition(..); is going wrong.

    Check if links and filenames are okay throughout, correct them if necessary and the problem should disappear. I don't think it has anything to do with your renaming your main document to *.php.

    -Klaus


    Now it works. I had the Swedish letter ö in the name of the .js file where the animation is located. Now it's solved.

    1 reply

    Joseph Labrecque
    Community Expert
    Community Expert
    April 14, 2019

    It shouldn't have anything to do with PHP.

    Are you sure all the CreateJS and specific Animate project JS is being included? No 404s in the developer tools Network panel?

    peorAuthor
    Inspiring
    April 14, 2019

    Yes it is included <script src = "https://code.createjs.com/createjs-2015.11.26.min.js"> </script> in index.php when I use plain html so it works but not on PHP files. I wonder why it doesn't work. What does 404 mean?

    kdmemory
    Inspiring
    April 15, 2019

    peor  wrote

    I wonder why it doesn't work. What does 404 mean?

    404 Not Found
    The requested resource could not be found but may be available in the future.
    (List of HTTP status codes)
    It means, that something couldn't be found on the server. I guess it's the index.js file linked in index.php. (depending what you did in Animate's Publish Settings the js-file might be named differently). Let's say it's index.js = it will be linked in index.php like this (line 02):

    <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>

    <script src="index.js"></script>

    If this can't be found then AdobeAn is in no way defined and the process runs into more trouble in around line 33 with:

    var comp=AdobeAn.getComposition("89ED7AB5C946D849B35B1594202278DE");

    There you've got this Error:

    Uncaught ReferenceError: AdobeAn is not defined

    at init (index.php:33)

    This error:

    at onload (index.php:105)
    Failed to load resource: the server responded with a status of 404 (Not Found)

    is related to this line (02) in your index.php:

    </head>

    <body onload="init();" style="margin:0px;">

    In the init() function the malaise with var comp=AdobeAn.getComposition(..); is going wrong.

    Check if links and filenames are okay throughout, correct them if necessary and the problem should disappear. I don't think it has anything to do with your renaming your main document to *.php.

    -Klaus