danrod
(Daniel Rodrigue)
December 10, 2017, 3:41pm
1
hypeDocument.getSceneElementByName
↑ extension index
hypeDocument.getSceneElementByName
Returns a scene element by name (HTMLDivElement).
/**
* hypeDocument.getSceneElementByName 1.0
* @return {HTMLDivElement} gives you the scene element by name
*/
hypeDocument.getSceneElementByName = function(name){
var idx = this.sceneNames().indexOf(name);
return document.querySelector('#'+this.documentId()+' > .HYPE_scene[hype_scene_index="'+idx+'"]');
}
Usage:
Lets assume you want to extract the text contained in an textfield …
I'm sure I'm missing something but I can't manage to make this "Extension" to work; and give me something other than ''undefined".
I'm puzzled with ".HYPE_scene[hype_scene_index="'+idx+'"] "
Where could I get a workable demo for this "Extension".
Thanks!
MarkHunte
(Mark Hunte)
December 10, 2017, 5:19pm
2
I suspect you are using a Hype text box instead of a form’s textfield.
Have a look at this…
getSceneElementByName.hype.zip (20.1 KB)
if you did want to use a text box or rectangle with text etc…
Then you would use the normal var txt = elm.querySelector(’#mytextbox ’).innerHTML;
1 Like
danrod
(Daniel Rodrigue)
December 10, 2017, 7:16pm
3
Your suspicions were right!
Thank you for the demo; that will help to do my plan.
I want to load elements on another scene; let say textfield from scene A moved to Scene B’s element…
Regards!
MarkHunte
(Mark Hunte)
December 11, 2017, 1:55am
4
You may run into problems doing that, scenes are not fully constructed until they are displayed once.
Also to be honest I was never really of the opinion that this extension was that useful!.
In part because of the above
Let us know some more details if you do run into problems we may be able to find a way…