5 Replies Latest reply on Aug 6, 2013 10:58 AM by TimJaramillo

    Get clicked symbol propreties


      Hi there!

            Is there a way of acessing the symbol properties (id on stage, timeline, nested elements,etc ), from the click bind placed on the stage?


           For example:

                In flash i add the eventlistener. then the function receive the event type as a parameter, and i could just use for everything.


                bt.addEventListener(MouseEvent.CLICK, doSomething);

                function doSomething (e:MouseEvent)


                     //Here with the "e" variable correspond to the bt that was clicked




           How can i do this on edge?



           Thx for the help.


        • 1. Re: Get clicked symbol propreties
          TimJaramillo Level 4

          Hi there, on the button's click event, you can log:




          This will give you the object's id, but strangely it prepends "Stage". So if your button is called "myButton", this would return: "Stage_myButton". You can work around this by simply removing the "Stage_" part of the string, using the javascript slice() method. Then you can use the resulting string to target the symbol normally, to get it's timeline, nested elements, etc.

          1 person found this helpful
          • 2. Re: Get clicked symbol propreties
            CindyJones-Hulfachor Level 1

            Thank you for this tip. I was a bit confused until I made a test file?

            1. So I put code on click event, buried in symbols


            2. Previewed project in Chrome and clicked item(s)

            3. My alert was then this ...




            • 3. Re: Get clicked symbol propreties
              TimJaramillo Level 4

              Hey Cindy,


              Edge does some funny stuff with object id's. Basically- when objects are nested, Edge combines the nested names together to form the id, separating them by "_".


              In fact, when you test in broswer, right click on your nested "finalSquare4" div, and select "Inspect Element". You will see that the actual div name is the long combined string, which is reflected in the alert you saw.

              1 person found this helpful
              • 4. Re: Get clicked symbol propreties
                CindyJones-Hulfachor Level 1

                So I believe you are saying that to reach this element in the DOM its actual Div ID is

                div id="Stage_rectangleMain_circlesInsideRectangle_squaresInsideCirclesInsideRect_finalSquare 4"


                But am I correct in thinking that I could use this info from the alert (as a quick way) to know how to reference the element to hide on the stage, from say compositionReady.





                In JQuery I would need to reference an element in the DOM which would be the long div id, where in writing Javascript code I can reference the element on the stage, which would be coding above.


                If I am still confused I will keep reading. I do appreciate your patience. And I hope that Joåo has gotten what was needed.



                • 5. Re: Get clicked symbol propreties
                  TimJaramillo Level 4

                  Hi Cindy, yes- you could use the long div output as a way to pinpoint the nested object.


                  Another property you might want to look into is "symbolName":


                  // put this in the click event of your symbol. Note that strangely, it traces the symbol's parent, but at least it's not the long concatenated string:

                  console.log('symbolName = '+symbolName);