Last active
September 7, 2015 03:27
-
-
Save marchbold/607b5d114866747b4921 to your computer and use it in GitHub Desktop.
Check and download expansion files using the ExpansionFiles ANE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static const BASE64_PUBLIC_KEY : String = "YOUR_LICENSING_PUBLIC_KEY"; | |
public static const SALT : Vector.<int> = Vector.<int>( [ 1, 43, -12, -1, 54, 98, -100, -12, 43, 2, -8, -4, 9, 5, -106, -108, -33, 45, -1, 84 ]); | |
... | |
ExpansionFiles.init( "APP_KEY" ); | |
if (ExpansionFiles.isSupported) | |
{ | |
ExpansionFiles.service.setup( BASE64_PUBLIC_KEY, SALT ); | |
ExpansionFiles.service.addEventListener( ExpansionFilesEvent.CONNECTED, connectedHandler ); | |
ExpansionFiles.service.addEventListener( ExpansionFilesEvent.STATE_CHANGED, stateChangedHandler ); | |
ExpansionFiles.service.addEventListener( ProgressEvent.PROGRESS, progressHandler ); | |
ExpansionFiles.service.addEventListener( ExpansionFilesEvent.COMPLETE, completeHandler ); | |
// Add the details of your expansion file(s) | |
var expansionFile:ExpansionFile = new ExpansionFile( ExpansionFile.MAIN, 1001002, 233017 ); | |
ExpansionFiles.service.addExpansionFile( expansionFile ); | |
// Check if the files have been delivered / downloaded already | |
if (!ExpansionFiles.service.expansionFilesDelivered()) | |
{ | |
// Start the downloading | |
ExpansionFiles.service.download(); | |
} | |
else | |
{ | |
// Already have expansion files - use as required | |
} | |
} | |
... | |
private function connectedHandler( event:ExpansionFilesEvent ):void | |
{ | |
trace( "connectedHandler()" ); | |
} | |
private function stateChangedHandler( event:ExpansionFilesEvent ):void | |
{ | |
trace( "stateChangedHandler(): " + event.state ); | |
} | |
private function completeHandler( event:ExpansionFilesEvent ):void | |
{ | |
trace( "completeHandler()" ); | |
// Read your expansion files | |
} | |
private function progressHandler( event:ProgressEvent ):void | |
{ | |
trace( "progressHandler( " + event.progress.toString() + " )" ); | |
} | |
// com.distriqt.ExpansionFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://airnativeextensions.com/extension/com.distriqt.ExpansionFiles