4 Replies Latest reply on Mar 26, 2014 8:05 AM by resdesign

    Can interactive SVG's be called from within a symbol in the yepnope function?

    Pam Davison

      I'm hoping someone may have run across this before, I'm trying to access an interactive svg (called "map") from inside a symbol (called "world") in the compositionReady event from the stage.  The image loads just fine as long as I have it directly on the stage, but for the project I'm working on it would be way more convenient to have the svg inside of a symbol since it's supposed to scale in sync with a bunch of other elements.  I have tried everything I can think of to reference the svg inside the symbol, but nothing works.

       

      My code from the compositionReady event looks like this:

       

      yepnope({

                load: "http://cdn.edgecommons.org/an/1.0.0/js/min/EdgeCommons.js",

                complete: function() {

                          // enable svg access

                          EC.SVG.accessSVG( sym.$("map") ).done(              // this is the line where I'd like to reference the svg "map" inside of the symbol "world"

                                    function(svgDocument){

       

                                              // event listener

                                              svgDocument.addEventListener("select", function(event){

                                                        // remember selecte part

                                                        sym.setVariable("selectedPart", event.target);

       

                                                        // show id

                                                        sym.$("selectedPartTxt").html(event.target.id);

       

                                              } );

       

       

                                    }

                          );

                }

      });

       

      It's the EC.SVG.accessSVG( sym.$("map") ).done part that I can't wrap my head around.  I've tried to reference the "world" symbol with things like:

       

      EC.SVG.accessSVG(

      var mySymbolObject = sym.getSymbol("world");

      mySymbolObject.$("map") ).done

       

      or

       

      EC.SVG.accessSVG( sym.$("world").$("map") ).done

       

      but nothing is working!!!  Does anyone know where I've gone wrong? Or perhaps it isn't possible to call an svg from a symbol?

       

      Thanks for any advice you have!