can we bind mouse events to a dynamic set of instructions in a JSON call?
QuadrantProductions Oct 20, 2014 12:51 PM//method dynamically loads JSON file with all items and iterates them on stage
$.getJSON('staffnames.json', function(data){
for(var i=0; i<data.length; i++)
{
var s = sym.createChildSymbol("teamThumb", "Stage");
s.$("holder").css({"background-image":"url('"+data[i].image+"')"});
s.$("thename").html(data[i].thename);
s.$("thetitle").html(data[i].thetitle);
s.$("certifications").html(data[i].certifications);
s.$("biography").html(data[i].biography);
s.getSymbolElement().css({"position":"absolute",
"left":i*150+"px",
"top":"220px"
});
}
});
Using the above code block which dynamically loads the data in an array held inside a JSON file, how would we write a further instruction so that an additional data object in the JSON array could be loaded onto a stage element (outside of the symbol called teamThumb here).
So specifically, the data object "biography" is inside the array that is being loaded above. And 1 symbol for each data block in the JSON file is being loaded. Now I need to add a command that would load the "Biography" line item say on a mouse click.
Here's the whole code block view on the compositionReady
//method dynamically loads JSON file with all items and iterates them on stage
$.getJSON('staffnames.json', function(data){
for(var i=0; i<data.length; i++)
{
var s = sym.createChildSymbol("teamThumb", "Stage");
s.$("holder").css({"background-image":"url('"+data[i].image+"')"});
s.$("thename").html(data[i].thename);
s.$("thetitle").html(data[i].thetitle);
s.$("certifications").html(data[i].certifications);
s.$("biography").html(data[i].biography);
s.getSymbolElement().css({"position":"absolute",
"left":i*150+"px",
"top":"220px"
});
}
});
// BELOW IS PHASE 2. For absolute positioning.
/* below is what I've figured out so far for manually loading the individual symbols. I would want to do that so I could control the position of how the loading symbols that are going to be populated by JSON data woudl be discplayed.
//method dynamically loads JSON file with all items but manually calls them in place
$.getJSON('staffnames.json', function(data){
{
var s2 = sym.getSymbol("teamThumb1", "Stage");
s2.$("holder").css({"background-image":"url('"+data[0].image+"')"});
s2.$("thename").html(data[0].thename);
s2.$("thetitle").html(data[0].thetitle);
s2.$("certifications").html(data[0].certifications);
// this is saying the symbol name, id name's html should be the corresponding data name in the array
}
*/@
Any assistance is most appreciated!



