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
Once TweenLite class files are downloaded, copy the “greensock” folder to your project’s subfolder “com”, as shown below -

Setting up “Flash Professional to Flash Builder” Workflow
- Open the .fla file from the archive in Flash Professional CS5.
- Click on the “Edit Class Definition” button beside the Document Class text box in the Properties Panel

- Flash Professional pops up a dialog asking where you would want to edit the Class Definition. Choose Flash Builder and click OK.

- Flash Builder 4 should automatically open now. Flash Builder now creates a new project linking it to your Flash Professional CS5 .fla file.
- Give it a project name you desire and specify a location for your Flash Builder Project and click Finish.

- You should see a project structure in Flash Builder similar to the one shown below -

- 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).
- 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.















Pingback: One Code, Multi-Screen « Hemanth Sharma – Tech Blog