Text Object Exercise
Exercise: Using Text Objects
Language Translator with Text Objects
- Start by creating; 3 Int Tags named englishTag, spanishTag, koreanTag. Create 8 Insert Text Boxes and 3 Insert Numeric Text Boxes
- Name the top 3 Text Object boxes; English, Spanish, Korean or which ever language you want to translate with. Name the middle Text Object Boxes; 0, 1, 2, 3, 4.
- Open the String Table Editor which can be found under Tools. Change the name of the group from "New Group" to "Test" and copy the table provided in the screenshot.
- Select one of the language boxes and go to the Actions tab on the right hand side and select On Press. Once in that menu it will be setup as the following images show.
- Do the same steps for the remaining langues adjusting the "Value" to "2" and "3" respective to the language. I.E Spanish will have the value of 2, and Korean the value of 3.
- Next select one of the Text Object Boxes that we labeled "0-4". On the far right pane where it show's "text" hover over that and a chain link should appear. Click the Chain link select the tab that says "Expressions". The initial value should already correspond to the correct KEY ID within the String Table Editor Set each of the boxes (0-4) as follows and confirming the initial value matches their number in the screenshot below.
- Final Step tag each of the 3 Numeric Text Boxes with one of the language tags we created earlier, one box will receive the englishTag, one box will receive the spanishTag, one box will receive the koreanTag. Change the fill type to none under appearances on all the boxes. Lastly put all the boxes ontop of eachother.
Text Object Runtime
- Open the Canvas Simulator and test the project.
- The end result of this project is to have a translation from English, to Spanish, to Korean when those languages are pressed/clicked. Each language is also tied into it's own number which can be demonstrated in the gif below.