Source: One Code, Multi-Screen

Find below the source code of the game that I developed for my previous example, One Code, Multiple Screens.

Prerequisites

  • This requires Adobe Flash Professional CS5 and I haven’t planned on posting CS4 version as it needs compatibility to Flash Player 10.1 and uses Accelerometer API that is currently available only in CS5.
  • I have used TweenLite AS3 from GreenSock for some animations. I haven’t distributed it with the source files, so you might have to download your own license from www.greensock.com.
  • I have not shared the font I used for original game. I have used Arial in this project instead.
  • If you haven’t followed my previous demo that showcases this game working on many different devices, please visit the post, One Code, Multiple Screens.

Download

Download Source Archive
(349 downloads)


Once TweenLite class files are downloaded, copy the “greensock” folder to your project’s subfolder “com”, as shown below -

Source Structure

Setting up “Flash Professional to Flash Builder” Workflow

  1. Open the .fla file from the archive in Flash Professional CS5.
  2. Click on the “Edit Class Definition” button beside the Document Class text box in the Properties Panel
    Edit Class Definition
  3. Flash Professional pops up a dialog asking where you would want to edit the Class Definition. Choose Flash Builder and click OK.
    Edit ActionScript 3.0 Class
  4. Flash Builder 4 should automatically open now. Flash Builder now creates a new project linking it to your Flash Professional CS5 .fla file.
  5. Give it a project name you desire and specify a location for your Flash Builder Project and click Finish.
    Create Flash Builder Project
  6. You should see a project structure in Flash Builder similar to the one shown below -

    Flash Builder Project Structure

  7. You should also see Logic.as opened so you can start editing the class definition. Once done editing, to test the movie, follow the same shortcut key as Flash Professional CS5. Being in Flash Builder 4, press Ctrl+Enter (Win) or Cmd+Enter (Mac).
  8. You may also delete CrazyGems.as under default package (the same folder as the .fla), since in this particular project, I have all my code in Logic.as.

Do drop me a mail in case you find some trouble understanding the code.

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)