02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 24: Embedding <strong>Flash</strong><br />

You can react <strong>to</strong> different commands in different ways by first testing the value of ‘command’<br />

passed in<strong>to</strong> the function.<br />

Figure 24.2 ‘Examples/Chapter24/VB/vbflash.exe’<br />

Embedding <strong>Flash</strong> in<strong>to</strong> C ++<br />

Although a little more difficult than VB, embedding <strong>Flash</strong> in<strong>to</strong> C++ programs is still relatively easy.<br />

Step 1 is <strong>to</strong> run Visual C++ and choose ‘File/New’. Click the ‘Projects’ tab in the dialog box<br />

that opens and select ‘MFC AppWizard (exe)’ as the project type. You must also select a location<br />

and name for the project.<br />

In the next dialog choose ‘Dialog based’ for the type of application you want <strong>to</strong> create.<br />

The default file names for the source files will probably suffice, but you have the option <strong>to</strong><br />

change them if you wish. Then click ‘Finish’; all the project files are au<strong>to</strong>matically created and<br />

you are ready <strong>to</strong> add the <strong>Flash</strong> object.<br />

Inserting a <strong>Flash</strong> ActiveX control<br />

To add the <strong>Flash</strong> object click on the ‘ResourceView’ tab in the workspace panel. If the dialog<br />

template is not open then expand the Dialog folder and click on the single template that is in the<br />

folder. You should see a dialog template that is the same as that shown in Figure 24.6. Right-click<br />

on the template and select ‘Insert ActiveX Control...’ from the context menu.<br />

377

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!