Hype does not yet support creating elements on the fly. You should be able to use jquery to modify elements in the scene. You can add a unique element id in the Identity Inspector and reference the element that way.
I think my problem is very similar; I’ve created a sybole, I can hide/show by jQuery but I can’t create many more on the scene. I’ve tried append, appendTo, clone etc but I couldn’t multiply my symbole :-/ is there any trip to get it work? Or do we have to wait for Hype update ?
Regards
My ex:
// test
function test(hypeDocument, element, event) {
$("#btn1").click(function(){
var m = $('.module');
// symbol name and id was “module” than I tried class name not to have unique in DOM
Would it be possible to append an entire hype document to the DOM at runtime? Or to modify the innerHTML of an existing document, so that a hype document is added?
I experimented with those ideas a couple of days ago but didn’t succeed.
I reserved empty tags with unique IDs in the main HTML file. Then tried with ‘appendChild’ and ‘innerHTML’ as in the following script part of the main HTML file, got a DOM 8 something error…
Here is something I was working on. Every now and then a group of us do the lottery and we need an agreement form filled out.
So I just wrote this page so any of us can go and fill in details for everyone and print it out.
Each entry is a form or textarea that can be edited on the page.
The documents clones a group and adds it to the hype scene ( not the page body). Height adjustments are made to all the containers.
Everything below the names group is in it’s own group so they can be moved easier.
The main scene container will be called index_hype_container when previewing via hype and lowercase export name & _hype_container when exported.
The code takes care of this but you have to set your export name in the function addName() & removeName()
It isn’t something I have started working on yet, but it is definitely something we have talked about. At this time I can’t make any promises about when will add this feature.
Any update on this? I was wanting to create a drag/drop grid in Hype using js, but need the number of rows and columns to be user specified - so I am guessing I would need to dynamically create x*y elements on the fly. Is this feature something that has been implemented in the interim, still under consideration, or been scrapped as being outside the scope of Hype?
It is definitely not outside the scope of Hype; this is still something we’d like to tackle. Beyond being a good idea in its own right, there are some upcoming features that will need this functionality as well. It will not be for v4.0.0 however.