Forum

hotlinks from clickable objects

08 January 2015 21:01
With 2 JSON files with 1 model each, only the first loaded will glow.

With two objects in the same JSON, they will both glow.

Is there a way to load multiple JSON files and have them all glow?


……

function load() {
m_data.load("json/singleModel.json", load_cb);

m_data.load("json/twoModels.json", load_cb);


}

…….


var m_mouse = require("mouse");




function main_canvas_click(e) {
……

var YSbox1= m_scenes.get_object_by_name("singleModel");
if (obj && obj.name == "singleModel") window.open("http://www.link.com")
m_scenes.apply_glow_anim(YSbox1, 1, 1, 0);





var YSRCbox= m_scenes.get_object_by_name("twoModelsA");
if (obj && obj.name == "twoModelsA") window.open("http://www.link2.com")
m_scenes.apply_glow_anim(YSRCbox, 1, 1, 0);

var product2= m_scenes.get_object_by_name("twoModelsB");
if (obj && obj.name == "twoModelsB") window.open("http://www.link3.com")
m_scenes.apply_glow_anim(product2, 1, 1, 0);










;
}

});

b4w.require("example_main").init();

09 January 2015 10:14
In the get_object_by_name(name, data_id) function there is a second argument, using which you can access multiple loaded scene files. Again, look at this canonical example.
The Founder | Twitter | Facebook | Linkedin
19 February 2015 17:24
being able to open webpages with clickable objects (or sections of the object as clickable for hotlinks and other sections of same object clickable for moving it around) would make for fun online catalogs.
Works since 15.01 in the NLA Script.
FYI: hover glow not working in IE 11
Works since 15.02.
The Founder | Twitter | Facebook | Linkedin
19 February 2015 20:15
I have been using the javascript file to make objects hotlinks, etc., but B4W keeps getting better and better, and each release offers awesome features.
 
Please register or log in to leave a reply.