Nested symbols and limiting variable scope

How would I create a master symbol that can be instanced (duplicated in the timeline rather than duplicated in the resource folder) and contain nested symbols? Additionally, I need to create a handful of variables that will ONLY affect the symbol object level instead of globally. Could I attach a variable to an ID?


For example:

MASTER SYMBOL - Meal

  1. Timeline: Recipes
  2. Timeline: FDA values
  3. Timeline: Feedback

MASTER SYMBOL - Recipe

  1. Timeline: Ingredients
  2. Timeline: FDA values
  3. Timeline: Feedback

MASTER SYMBOL - Ingredient

  1. Timeline: Nutrient
  2. Timeline: FDA values
  3. Timeline: Feedback

In each symbol above, I need variables that only apply to it’s object. So for Meal, I want to create the following variables:

  • Type
  • Title
  • Reference to meal pic in the resource folder
    I need these to be variables because I need to do a lot of custom animation across different states on each timeline.

So let’s say I define them as:

  • Mediterranean
  • Turkish meal
  • turkish-meal.png (via ${resourcesFolderName}/)

Here’s the hard part. I do the same for a recipe symbol:

  • Type: Dessert
  • Title: Baklava
  • Resource: baklava.png (via ${resourcesFolderName}/)

And now I want to simply drop an instance of the recipe symbol into the meal symbol. But I don’t want their variables to overwrite one another.

Is there some way to designate the recipe card ID as “baklava” and then define a variable that is scoped to only that symbol? Something like this?

  1. Manually change a symbol ID to “symbol1”
  2. Set variables: var symbol1 = ["Dessert", "Baklava", "baklava.png"];
  3. for (symbol1) { var type = symbol1[1]; var title = symbol1[2]; }
  4. In a text field in instance 1 of the recipe symbol:
    hypeDocument.getElementById('myTitle').innerHTML = title;

So in another instance of the recipe symbol, I could just change:
var symbol2 = [“Salad”, “Caesar salad”, “salad.png”];
and it would not overwrite the variables used in symbol1
and it would not overwrite the variables even if symbol2 is nested inside symbol1.

There’s a lot going on here, so I got confused.

I’m not sure, but it seems like a two-dimensional array might help.

var meals = [
[Meal,Recipes,FDA Values, Feedback],
[Pizza,Pizza Recipes,Pizza FDA,People like Pizza],
[Pasta,Pasta recipes,Past FDA,Yum Pasta!],
]

That way, an ID number could be used to toggle between the different values.