• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Swapping Cast Members

Now you're going to create a set of custom handlers that will direct the robot arm to extend or retract. Your handlers will be called ExtendArm and RetractArm. While the up and down movement was created by changing the location of one sprite on the stage (by subtracting and adding to the locV sprite property), the extend and retract movement will be created by displaying different cast members to show the different positions of the arm. In this case, you will subtract and add to the memberNum sprite property, which you've used before. (Recall that the syntax of this property is sprite (whichChannel).memberNum or the memberNum of sprite whichChannel.)

To make this technique work, you have to create a logical sequence for the cast members. If you open the Cast window and look at cast members 1 through 27, you'll see that the different states of the robot arm are organized in a logical order, from most extended (cast member 1) to least extended (cast member 27).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint