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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

A dialog box opens offering a list of ActiveX controls that appear on your PC. Scroll down <strong>to</strong><br />

‘Shockwave <strong>Flash</strong> Object’. If you haven’t got <strong>Flash</strong> installed then it will not appear in the list, but<br />

this book wouldn’t be much use <strong>to</strong> you either!<br />

A black box appears; this is the <strong>Flash</strong> Object without a movie embedded. You can drag and<br />

position this if you wish, or you can do this in code.<br />

Figure 24.9 Inserting a member variable for the dialog box<br />

To use the <strong>Flash</strong> Object in your source code open Class Wizard and select the ‘Member Variables’<br />

tab. Click on the ID name you have chosen for the <strong>Flash</strong> Object. Press the ‘Add Variable...’ but<strong>to</strong>n.<br />

Visual C++ warns you that the object does not have a source file in the current project and<br />

au<strong>to</strong>matically generates one from the information found inside the ActiveX control.<br />

The source files created can be renamed from the defaults if you choose.<br />

Give the member variable a name that you will use <strong>to</strong> manipulate the <strong>Flash</strong> Object. You now<br />

have a project that contains a <strong>Flash</strong> ActiveX control.<br />

Embedding the <strong>Flash</strong> movie as a resource<br />

At this stage the <strong>Flash</strong> movie is empty. In this example we want <strong>to</strong> create a single exe file, so<br />

we need <strong>to</strong> embed the swf file in the exe. To do this you need <strong>to</strong> add a cus<strong>to</strong>m resource. In the<br />

Resource View panel, right-click and choose ‘Import...’; in the import dialog select ‘Cus<strong>to</strong>m’ as<br />

the import type and select an swf file. In the Cus<strong>to</strong>m Resource Type dialog type in FLASH as the<br />

381

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

Saved successfully!

Ooh no, something went wrong!