e-Software-License.com

How to build your own Flash Software Titles with e-Software-License.com Libraries

Click Flash License Functions for documentation of calls available.

Flash libraries and samples

Flash.zip download has these flash projects and files.

  1. Basic/ Basic.fla, Basic.spf, basic.swf Use these and the step by step below to make a working flash projector (executable) which runs a simple license test. It is suitable for most simple license applications.
  2. e-software-license-flash-demo/ contains e-software-license-flash-demo.fla, e-software-license-flash-demo.swf, e-software-license-flash-demo.exe, e-software-license-flash-demo.spf. Simple button driven demo of 3 license functions.
  3. freeflvframeviewer.exe, a real world freeware program, with license splash screen.
  4. esoftwarelicenseflash.dll, a flash plugin implementation of the license functions, for SWF Studio/plugins folder

Step by Step creation of a stand alone Windows Flash Projector with License capability

  1. Install Northcode SWF Studio version 3.x or later.
  2. Copy esoftwarelicenseflashh.dll to c:/Program Files/Northcode/Studio3/Plugins
  3. Create a Flash file or modify one. It should include Action script 3 code to use one or more of the license functions above. basic.fla shows a simple License splash screen. SWF Studio requires several initialization statements,
    • ssCore.init();
    • ssDefaults.synchronousCommands = true;
    which must be done in at beginning of frame 1.
    The eSoftwareLicenseFlash calls must occur after the stage has loaded.
    Here is a sample script, with required parts underlined:
    stop();  //You should insure the frame executes only once.
    ssCore.init();
    ssDefaults.synchronousCommands = true; // These 2 statements required to initialize ssCore
    var mylicense:int = 0; // assume unlicensed
    
    // After stageinit(), code can simply check (mylicense > 0) or (mylicense == 3)
    
    function stageinit(e:Event=null):void
    {
    	ssDebug.trace("Launching splash for license check. ");
    		
    	// No other action is necessary the Splash screen is the unlicensed behavior.
    	var r = ssCore.eSoftwareLicenseFlash.eslSplash
    		({company_name:"my company", software_name:"my title", current_version:"1"});
    	if (r.success) {
    		// This means the license check WORKED.
    		ssDebug.trace("license check succeeded result an integer as string: "+r.result);
    		if (r.result == "0") {
    			mylevel.text = "unlicensed";
    			// Is NOT licensed
    			ssDebug.trace(r.result +"= \"0\" so running unlicensed- DEMO mode." );
    		} else {
    			// Is licensed
    			mylicense = r.result;
    			mylevel.text = "level "+mylicense;
    			ssDebug.trace(r.result +"> \"0\" so program is licensed- run licensed mode." );
    		}
    	} else {
    		// This is an ERROR condition. if you get here, you may or may not be licensed.
    		ssDebug.trace("license check failed - result undefined: "+r.result);
    	}
    }
    
    if (stage)
    {
       stageinit();
    }
    else
    {
       addEventListener(Event.ADDED_TO_STAGE, stageinit);
    } 
    //The stage must be loaded before running ssCore functions
  4. Next you must increase the response timeout in Flash to allow the user enough time to go through a PayPal transaction.
    Do this at Flash:File:Publish Settings:Flash tab (bottom):Script Time Limit: Set it long enough to complete a transaction. It is in seconds, so 600 is ten minutes.
  5. Do :File:Save: and :File:Publish: in Flash.
  6. Run Northcode's SWF Studio, version 3.x or later.
  7. Basic.spf from FlashLicense.zip has working settings. Here is a summary:
    Quirks of Northcode SWF Studio
    SWF Studio is a solid mature product that has been around for a decade. But it fills the odd gap between Flash and Windows and some quirks show up.
    1. All file locations in the forms to the right must be absolute,
      or if relative start with ".\" like ".\subfolder\Release". No diagnostic is given, it just says it broke when a relative path like "subfolder\Release" is given.
    2. If you use the FLVPlayer for local files the absolute filenames must be given, if FLVPlayer is used inside an SWF Studio projector.
    3. If you use the FLVPlayer inside an SWF Studio projector, it is incompatible with the "secure loading" option on the "Output tab". Standard loading works fine.
    4. Action script statement "ssDefaults.synchronousCommands = true;" sounds optional, it is required to run synchronous ssCore functions. Examples of synchronous function calls omit this.
    5. Errors are returned as an Error object parameter on the Return Object. How to access the error object is documented under "ActionScript API":"Return Object". So you might think you already know the return object from document examples, you don't. The contents of the Error object are documented under headings with "error" in the title.
    6. Return Objects for functions documented as returning TRUE or FALSE, like "var o:Object = ssCore.FileSys.fileExists()", o.Result is a STRING not a boolean, that contains "TRUE" or "FALSE". The success parameter, indicating no error occurred, is a Flash boolean. So you have to use the somewhat odd appearing:
      if (o.success && (o.result == "TRUE")) {}
      To test for a true result.
    Ouput tab
    Set "File name and location" of the Flash Projector (executable) to be built, top 2 lines.
    In "Output File", Set Standalone or Standalone (Debug). Check "Enable debug" if you want trace output.
    Set Project Icon, if you have your own icon. (IcoFX is a utility which generates multiple icon formats from one image, if you want to make one.)
    Movie tab
    Select the .SWF you published from last step. Under Script limits, set the SAME number of seconds as you set in Flash (above). Other settings optional.
    Window tab
    Set window caption if desired, at bottom you can display window border or caption. Drag white rectangle to set starting Position.
    Application Tab
    Useful Options.
    Defaults tab
    Allows you to disable the "standard" flash right click menu, if needed.
    Version Files Mask & ScreenSaver tabs
    Self explanatory advanced options.
    Expiry Tab
    DO NOT USE, with license library. It will cause your Projector to expire and stop working. Use the License Library and built in License expiration, so the user can keep buying renewals, if expiration is desired.
    Trace tab
    Trace output for debugging. SET CHECKBOX on Output tab to use ssDebug.trace().
    Plugins tab
    IMPORTANT!, check the box by eSoftwareLicenseFlash. If you don't see it, copy esoftwarelicenseflash.dll to c:/Program Files/Northcode/Studio3/Plugins.
    Build STEP
    Click the Build BUTTON on top, by the Save button.
    Documentation from Help Button
    Is a very complete set of documentation of all the SWF Studio features (file system, command line, you name it). If you just need license functionality, the above steps are enough.
    SWF studio output tab swf studio movie tab swf studio plugins tab
  8. Once you have built and tested, a SINGLE executable file can distribute your entire program. No dll's, .flvs... No install needed!

Flash License Function Interface

All arguments and results are passed as strings.
Unlicensed software returns a license level of "0". Level 1 return "1", and so on.

In order to access the e-software-license library from Flash, you must place the library "esoftwarelicenseflash.dll" in a Northcode SWF Studio plugins subfolder.
Run SWF Studio, on the plugins page, check the box by esoftwarelicenseflash. The functions are accessed through the ssCore object. (examples below.)

These functions are available through the flash interface

The functions available are the same s for the C interface, except no browser functions are there
(Flash has native browser stuff.)

Arguments common to all license functions
Arguments are each passed as a parameter of a flash object.
Example: {company_name:"<your business name>",
  software_name:"<you software title>",
  current_version:"<your version>"}
Values are always strings, like "Angry Amphibians".
One could pass the same object to each license function call.
eslCheckLicense
// returns current License Level Integer as a String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslCheckLicense({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslGetLicense
// returns current License Level Integer as a String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslGetLicense({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslSplash
// returns current License Level Integer as a String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslSplash({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslAbout
// returns current License Level Integer as a String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslAbout({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslContactSupport
// returns current License Level Integer as a String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslContactSupport({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslCheckUpdate
//<your_options>= one of "", "A", "N", or "AN".
// "A" or "AN"- Ask before downloading. If update is needed, it prompts the user
// "AN" or "N"- Inhibit the Install after download. The end User must be told to run the install,
// or the application must run the install
// returns Latest Version String
var ret:Object = ssCore.eSoftwareLicenseFlash.eslCheckUpdate({company_name:"<your business name>", software_name:"<you software title>", current_version:"<your version>",update_options="<your options>"});
if (ret.success) {
   license_level= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}
eslWhatIs
//<your query>= "companyname" software company name
// "expirationdate" expiration date
// "licensedate" date licensed
// "grace" expiration grace period, if any
// "limittouser" limit license to pc user at time of licensing boolean
// "licensedto" name licensed to use product
// "licenselevel" integer license level as a string
// "licensedemail" email when product licensed
// "licensedescription" license description
// "ipwhenlicensed" ip when licensed
// "idlicense" license id (int)
// "latestdownload" file name to update to latest version
// "latestdownloadargs" update file arguments, if any
// "latestversion" latest version
// "softwarename" software product name
// "currentversion" current (running) product version
// "computername" computer name
// "currentuser" current computer username
// returns the queried item a string.
// Example "http://www.AngryAmphibians.com/download/AngryAmphibians3.4.exe" for "latestdownload"
var ret:Object = ssCore.eSoftwareLicenseFlash.eslWhatIs({company_name:"<your business name>", software_name:"<you software title", information_query:"<your query>"});
if (ret.success) {
   query_result= ret.result;
} else {
   //<error case. Not built with SWF Studio, not on the internet, etc >
}