• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Using Conditional Logic > DEFINING A BOUNDARY

DEFINING A BOUNDARY

Boundaries are something we contend with on a daily basis. Although boundaries can take many forms—physical, financial, mental—in the end they’re nothing more than an indicator of something’s limit. To make a boundary work, you must simply define its limits, then take appropriate action when (or just before) those limits are exceeded. Think of driving a car: Lines on the road define the boundaries our cars are supposed to remain within. If we’re approaching the line on the left (the left boundary), we move our steering wheel to adjust; if we’re approaching the line on the right, we once again make the requisite adjustment—conditional logic in action! Written in ActionScript, those actions might look like the following:

					if (car._x > leftOfRoad) {
					turnWheel ("right");
					} else if (car._x > rightOfRoad) {
					turnWheel ("left");
					}
				


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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