Skip navigation
Currently Being Moderated

Can I have unique function and variable names with createjs when publsihing from Flash?

Oct 11, 2012 1:14 PM

Tags: #flash #javascript #html5 #createjs #toolkit_for_createjs

Hey everyone!


I have recently started using the Toolkit for CreateJS exporter for turning small button icon animations, made in Flash, into content for HTML5. I have created 3 seperate icon '.fla' files that animate when rolled over.

With this example tag added into my html5 document, the animation works fine:


<canvas id="about_btn" width="85" height="70" style="background-color:#FFF"></canvas>


However, once I have added more than one canvas tags, only one icon would appear on screen:


<canvas id="about_btn" width="85" height="70" style="background-color:#FFF"></canvas>

<canvas id="news_btn" width="85" height="70" style="background-color:#FFF"></canvas>

<canvas id="contact_btn" width="85" height="70" style="background-color:#FFF"></canvas>


I found out that the JavaScript files that were generated with each '.fla' file were conflicting because they were all using the same variable and function names (ex. stage, canvas, init(), etc.). Is there a way for me to publish the JavaScript from Flash with document specific variable and function names? (ex. about_stage, about_canvas, about_init())


A work around methood that I can currently using is putting each <canvas> tag into it's own iFrame.


Thanks again for the help!


  • Currently Being Moderated
    Oct 26, 2012 10:35 AM   in reply to DjPhantasy5

    The JS asset libraries should not conflict with each other, unless there are symbols with the same names. Even then, you can change the Symbols namespace for each FLA to prevent collisions.


    It sounds like you're trying to copy/paste the code out of the preview HTML. It's not really designed for this, and it will lead to name collisions. You'll either want to rewrite this logic in your own HTML (using the preview code as a reference), or rename the variables as appropriate after you copy/paste.




    Mark as:
  • Currently Being Moderated
    Apr 18, 2013 2:46 PM   in reply to Grant_Skinner

    Hi Grant Skinner

    As I can have two animations on the same page, could you give me an example


    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points