1 Reply Latest reply on Nov 15, 2012 8:06 PM by afroprog

    How to change the assets with a server script (php, CGI/perl, etc)

    afroprog

      Hi.

       

      I'm making a game app with HTML and iOS (UIWebView).

      The HTML is generated by CGI/Perl scripts, server side.

      I'd like to use Edge Animate for pages that use animation.

       

      The problem is, I need to parameterize the assets.

      The actual asset I want to use will change according to the game state.

       

      For instance, there is a page I will display when the user gets a "card" (a game asset).

      The page contains the "card" image in the middle, some texts ("You got this card!"), with animations and effets.

      The "card" image must be changed by the server script according to which "card" the user received.

       

      I made a page like above called animtest.html.

      Edge generated the following files:

      animtest.html

      animtest_edge.js

      animtest_edgeActions.js

      animtest_edgePreload.js

       

      Here's the problem:

      The server script can only generate the HTML part, animtest.html. (Generating multiple files is not good)

      But I figured out the URL of the "card" image is inside animtest_edge.js. (outside animtest.html)

       

      So it means I need to put animtest_edge.js inside animtest.html, inlined.

      I tried to do this but it seemed the preloading goes wrong. (I got a white page)

       

      Is there a solution to this?

       

      Thanks.

        • 1. Re: How to change the assets with a server script (php, CGI/perl, etc)
          afroprog Level 1

          I just found 1 tricky solution.

           

          1. Declare a variable containing the asset URL in the HTML, before the <!--Adobe Edge Runtime--> part. (Sample below.)
          2. In the script (_edge.js), use this variable instead of the asset URL string . (replace the string constant with the variable)
          3. In the server script, generate the HTML by changing the variable definition.

           

          This is ugly...

          I would appreciate any help.

          Thanks.

           

          === HTML sample:

          <!DOCTYPE html>

          <html>

          <head>

                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

                    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

          <script>

          // Define the asset URL

          var cardImage = 'card_01.png';

          </script>

           

           

          <!--Adobe Edge Runtime-->

              <script type="text/javascript" charset="utf-8" src="animtest_edgePreload.js"></script>

              <style>

                  .edgeLoad-EDGE-1381868 { visibility:hidden; }

              </style>

          <!--Adobe Edge Runtime End-->

          </head>

          ====