Custom controls... a tool kit

Hi all...

I'm looking at designing classes of objects... that can have a predictable behavior within narrow parameters.

What I would like to do is create a "library part" (whatever that might mean), where I could group some graphical elements together... like arrow shapes, a text field, etc... and have this "group" work like a drop in component, complete with the code necessary to generate events, return results, and to modify itself.

For example, say I had a couple of arrows on either side of a text field:

image

I'd like to be able to drop this group into a project and have click events on the arrows modify the numeric value in the center... and I'd like to have drag events on the text box drive a slider like behavior also modifying the text value.

Is this a reasonable thing to attempt with js and Hype?

Thank you for your kind help,

R

Yes, see: https://tumult.com/hype/documentation/#symbols

1 Like

@drewbullen

Thanks... yes, I see that as about half of the equation... instances of groups... But I don't see how that solves the issues of getting data in and out... or setting parameters. I see animations... and that seems too different to be of use in this case.

The missing piece seems to have to be js, though I don't know what that would be.

R

Have a look at this (older) post. ( use v7 )

Think this is what you are eluding to.

Yes the symbols is what you can use to create a library of elements.

To have them include any JS function when you export a symbol, the JS has to be called by the symbol via the hype interface. ( as in not only by hypeDocument. functions() command )

If your code is not or cannot be called by the using the interface, then put a text element inside the symbol with the code snippet and instructions of where and how to use it.

I think we have asked in the past that symbol exports get an option selection for including functions in export because of the current criteria of how and when functions are included.

1 Like

I think that's right on target... thank you for your kind help!
One thing I just learned... is that you can save symbols, and simply load them into the hype doc... very cool.

(I've been at this for less than 24 hours...)

1 Like

Just to be a bit more clear with this tip/work around.

In the example I have a Timeline named yourFunctionSymbolExportLoader
At the very beginning and importantly after the 0 position. I have a pause yourFunctionSymbolExportLoader then a run javascript to the yourFunctions()

This is because Where the other functions in the symbol are being called and used on either symbol load or a mouse action using the Hype interfaces for setup. The yourFunctions() is only called via javascript using the hypeDocument. functions() command.

This would normally mean that on export of the symbol the yourFunctions() would not be included.

So this is why I have that timeline. Because of the pause timeline, it effectively does nothing.
But because we include the run javascript on the timeline and even though that action is never met the function will now be included in export.

1 Like