-
1. Re: Get the ID of the clicked Symbol
Departure Jul 14, 2013 4:00 PM (in response to Departure)Trying to find answers i came across this article. Great reading to learn more about Edge Structure.
http://www.dehats.com/drupal/?q=node/110
Reading more i believe the root of many of my problems comes from misunderstanding to target Symbols vs DOM Elements, currently i m just playing with pieces of puzzles to see what fits and what doesnt having no idea about the general rule and structures.
-
2. Re: Get the ID of the clicked Symbol
Endoplasmic Jul 14, 2013 5:02 PM (in response to Departure)The issue is that the ID is actually set depending on where you are at in your structure. So on the stage level it's always "Stage_xxxxxx"
I usually just use a substring method to extract it out:
$('.btn').click(function(){
//if it's in a symbol called "buttons" on the stage the ids will be like Stage_buttons_xxxxx
var id = $(this).attr('id').substring(14); //14 = "Stage_buttons_"
window.location = "http://"+id+".html";
});
The other (better) option is to set a param on the button object so you don't need to do any sort of magic, then you can just call $(this).attr('whatever_you_want');
-
3. Re: Get the ID of the clicked Symbol
Departure Jul 14, 2013 5:21 PM (in response to Endoplasmic)Thanks a lot...
How can I insert a new parameter for a symbol object? like this:?
sym.$("first_btn").attr('webAddress', "http:\first.html");
and then
$('.btn').click(function(){
window.location= $(this).attr('webAddress')
})
-
4. Re: Get the ID of the clicked Symbol
Endoplasmic Jul 14, 2013 10:22 PM (in response to Departure)without testing it out it looks fine to me!
-
5. Re: Get the ID of the clicked Symbol
Departure Jul 14, 2013 10:54 PM (in response to Endoplasmic)Thanks....here is a link to another article i read which solves a similar problem, a more advanced problem, including dynamic creation of the symbols and binding a click trigger for each. Sort of relevant.
http://chrisgannon.wordpress.com/2012/03/23/binding-clicks-to-dynamic-symbols-in-adobe-edg e/
-
6. Re: Get the ID of the clicked Symbol
Chris Gannon Nov 28, 2013 4:06 AM (in response to Departure)Try this:
sym.$("myButton").bind('click', {buttonId:4}, onClick);
function onClick(e){
var buttonId = e.data.buttonId;
alert('buttonId is: ' + buttonId);
//alerts 'buttonId is: 4'
}
You can then use this ID as a lookup in an array of URLs or whatever you want.

