J2Play Flash Wrapper

From J2Play

Jump to: navigation, search

Contents

Introduction

With this integration method, you will use the j2play-flash.swf as a loader for j2play flash library as well as your flash game.

Preparation

  • Find J2Play library matches your flash and actionscript versio. We provide three different versions of J2Play library in our flash-toolkit package
    • AS3 -- for Flash9 with ActionScript 3
    • AS2 -- for Flash7, Flash8 and Flash9 with ActionScript 2
    • Flash6 -- for Flash6 with ActionScript 2

Copy following file

  • game.properties
  • j2play.properties
  • j2playlib.swf

from the directory j2play-flash-toolkit/[version]/swf/ to your game's output directory (this is found in the publish settings for the .swf file your game.fla file produces).

Configuration

Change settings in game.properties

  • Open the copied game.properties file in a text editor (open from your game's output directory)
  • Find the following line and change the .swf file to the name of your published game .swf file:
GAME_CLIP=yourgame.swf
  • Set up the debug information for launching test movie in local flash IDE.

Using the information got from J2Play social network developer app, like J2Play facebook developer app, to replace the following settings.

Notice: These setting only works on local flash IDE launching, and will be ignored if launched from J2Play community on web.

DEBUG.GAME_ID=your_game_id
DEBUG.NETWORK_ID=None
DEBUG.SCREENNAME=your_screen_name
DEBUG.USER_ID=your_user_id
  • Save the properties file and close it

Change the wrapper according to your game

  • Open j2play-flash-toolkit/[flash version]/fla/j2play-flash.fla
  • In the Flash publish settings, change the output path to your game's output path (when published, the j2play-flash.swf file will be written to the same folder as your game.swf file)
  • Optionally change the document size of the open "j2play-flash.fla", and make the document size exactly the same as your game stage size. Please ensure your game have been scaled to supported Social Network Game Canvas Sizes.

Include the j2play flash interface to your game

  • Open your game .fla file
  • In the flash publish settings, add the flash interface directory into your game class path. This setting is in the publish settings -> Flash tab -> Actionscript settings button. Click the + sign and add the absolute or relative path to j2play-flash-toolkit/[flash version]/interface. In windows for example: ..\j2play-flash-toolkit\[flash version]\interface. In unix for example: ../j2play-flash-toolkit/[flash version]/interface.

Test and Finish

  • Publish (Shift-F12) j2play-flash.fla. There should be a newly created j2play-flash.swf file in your game's output folder.
  • Publish your game flash as well.
  • Make sure j2play-flash.fla is the movie in focus in Flash IDE and test it! (From the menu -> Control -> Test Movie)

Now you should see your Flash game running as it normally would, however the J2Play Flash Toolkit is integrated and its features are now available to players.

Personal tools