Game Development Reference
In-Depth Information
But I'm a bit scared of programming!
Although I'll cover a lot of important programming theory in this chapter, the most important thing
you should come away with is how the programming code you type in the ActionScript editor window
changes the behavior of the objects on the stage. The theory is important, but don't agonize too much
if you don't understand it all right away. If you're like me (and almost everyone else), it will take time
and quite a few more practical examples before it all sinks in and starts to make sense.
Just as having a general idea of how a car's engine works is a good idea for any driver, you don't need
to become a mechanical engineer if all you want to do is drive a car. You can always come back to
this theory later if you have some specific questions about how some detail of the code works. If you
generally understand how the code you type affects the objects on the stage and can use that code
with confidence in your projects, you're more than halfway there.
Always remember that programming is a creative tool to help you express yourself, just as a paint-
brush is a creative tool for an artist. It can help create the painting, but is of no use at all without the
imagination of the artist—you!
Displaying the first page of the storybook
You'll work on the interactive storybook from the previous chapter. All the objects are ready to go.
Your first job is to display the first page of the storybook.
To display the first page, you'll use AS3.0 to do two things:
Use the r]n and jas keywords to create an instance of the Op]npL]ca symbol that you can
control with programming code.
Use the ]``?deh` method to visually display that new instance on the stage.
Remember that when you set up this project you created a file called I]ej*]o. This is the ActionScript
file that will contain all the programming code for the storybook. The first thing you need to do is
open this file so that you can start programming into it. Follow these steps:
1. Open the interactive storybook project from the previous chapter. If you created it as a Flash
project, you should be able to select it from the drop-down menu in the Project panel near the
top-left corner of the Flash workspace.
2. Double-click the Main.as file in the Project panel or select it from the tab menu above the
stage if it's already open. A blank ActionScript editor window will open, allowing you to enter
programming code.
You might want to see what the project looks like before you add any programming code. Click the
Test Project button in the Project panel. Flash will generate a pop-up message: Exporting SWF Movie .
A few moments later, you'll see a blank window with the name interactiveMovie.swf in the title bar. This
is the SWF file that will be your finished product. Why is it blank? What happened to all the hard work
you put into designing the buttons, the pages, and the poor little cat?
 
Search Nedrilad ::




Custom Search