Creating a Reference in the Properties of a Symbol


#1

Heya,

Here’s a clear example of what I’m talking about.

Create a new video player symbol.

Drag that symbol to the Hierarchy, and select it.

Look down at properties, under references.

Note that it has videoURL, autoPlay, showControls, and showSeekBar.

Now, how do I make my own versions of these for my own sub symbol? I want to be able to put in a keyword so that when I make this symbol it knows how to set up it’s textures and how to look. That way I can have one symbol that has multiple looks. So example of my own.

I am making a “button” symbol. In this symbol it can look like a play, stop, or pause button. When I pull this symbol into my parent hierarchy, I’d like in the reference section to have a field for “material,” where I will then say “play,” so when the symbol activates the script within it will know to set the material to play.

I know how to make this button otherwise, but this to me is a cleaner way of doing so. How do I make references under the Properties of a symbol? If there’s a document for this, please point me to it! I haven’t found it yet (or, it’s vague and I didn’t catch it in the symbol documents already.)

Thanks =)


#2

Gosh, of course, as always… I spend 30 minutes trying to figure it out, then make a post about it… I go back and find it 5 minutes after posting.

Now I know where it is. I’ll play with it there. Is there a document on this feature?

For anyone else searching for this. In your symbol, look at the top of your hierarchy where the options are. That drop down menu has “references” in it. You can play with that there.


#3

And now the issue becomes, how do I use the information found in that reference field. So if I have a reference field of type string, and I’ve entered the word play in there. How do I access that in the script inside that symbol? Where is it? How do I call it?

The only reference I can find to what I’m trying to do, is in the video streaming symbol that you can just plug in. I just don’t understand the scripting in there.

var sym : any = symbol;
myvid = Z.Video(sym.export("videoUrl")());

This is what I see. I don’t get how that happens to be working? Or even if I’m looking at the right example to accomplish what I want personally.


#4

Hi there,

You can’t access a referenced property in a script node within the parent symbol, as it’s meant solely for use in the hierarchy.

If you have a property within a subsymbol that you’d like to access within a script in the parent you can use subsymbol communication.

Essentially, you’d export a variable or function from a script in the subsymbol, which you’d then be able to access from a script in the parent symbol.

Hope this helps.

All the best,
Seb


#5

Then I suppose I’m confused. I’ve done the above and that’s cool too. Here are the panels I’m asking questions about though? Maybe I’m asking the wrong question? I just want to know how to utilize this feature. Or maybe it’s not really a feature anymore? The first image comes from “Videoplayer” symbol which you guys have already made. It’s under its properties. The second image is from inside the Videoplayer, and you access it from the Hierarchy menu under References.

Properties-ReferencesReferences

My question is, from the Subsymbol Videoplayer. How do I write a script inside that subsymbol, that uses the values entered into that reference box? I’m not trying to write a script from my parent symbol to access them. =)