What’s in a Name?

SOOOooo…. just how observant are you?   Let’s find out!

If you’ve gotten to this point in your understanding of activities, then you’ve probably successfully placed several graphics and pieces of text on top of an activity, saved your work, maybe moved some stuff around.  This is great.  If you can do that, you’ve begun to build a solid understanding of what it takes to build an activity.

When you were adding graphics and text to the activity, you probably used the Property Inspector (hammer/wrench icon) several times to change the items color or picture and such.  While you were looking at the Property Inspector, did you happen to notice the “Name” field?

Take a look at the top of the property inspector.  To get there, touch the yellow square to make it the “currently selected item” and then touch the “hammer/wrench” icon to bring up the property inspector.  When you do so, you should see something that looks like this:

Blue activity square color changed to yellow

At the very top of the property inspector is the “Name” field.   Every item added to your activity is given a unique name by the system.  That name plays a very important role in the work you will do with Events.  Specifically, when you lay out the action blocks associated with an event, you often times have to name the item you want the action to be performed on.  This is where the name field comes in.  In action blocks that require names, you use the name in the “Name” field as the name to be given to the action block.

So, as an example, let’s say we were setting up our action to change the yellow square to red when the square is touched.  To do so, you’d use the action block that changes item’s color (see below).

Color change block in place

Now, in the “Set Foreground Color of” action block the first field it requires is the name field of the item whose color is to be changed.  If you want to precisely name the item whose color is to be changed, you need it’s name and you get that name from the “Name field” on the property inspector.

Names tend to be kind of long (since they are required to be unique).  As such, the system provides a “copy” button next to the name of an item.  When you tap that copy button, the name of the item is placed in the system’s clipboard.   Given that, when you touch the action block’s name field, you can paste in that name and whamo-bamo, you’ve told the action block the name of the item to change.

Wow??  Did you follow all that?  Let me summarize:

  1. All items on an activity, be it text or a shape or some other thing, have a name and that name is unique
  2. When using action blocks in the event action block designer, you’ll find that many of the blocks require an item’s name.   They need that name so that they know which item they are to affect.
  3. You can copy the item name to the clipboard so that you don’t have to type in the name by hand.

So… fortunately, there is also an easier way.  Many times, rather than having to name the item that is to be effected, it’s often good enough to just tell the system “Use the name of the item that was touched”.  That way, you don’t have to copy and paste the name from the property inspector into the action block.  Rather, you just tell the system “Use the name of the item that was just touched”.

In the action block design below, notice that the name field has been kind of left at the default value of “Square-” which isn’t really the name of an item in our activity.  But, plugged into the “Name” field is another action block who, when asked, provides the name of the item that was most recently touched.  It’s called the “Primary Item”.


So, in the action blocks designed above, the “Primary Item’s Name” action block was plugged into the name field of the “Set Foreground Color Of” action block.  So, when the “Set Foreground Color Of” action block needs to know “Who’s color am I changing”, the “Primar Item’s Name” action block looks to see who was touched last and gives the “Set Foreground Color Of” block the name of the item that was last touched.

And, so, now you probably need to go get yourself a glass of something to drink, wipe the sweat from your brow, and stand back in awe of yourself as you’ve just probably understood the most difficult part of building activities… providing names to action blocks.

Congrats!!  You’re doing amazingly well.