Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import com.poki.*;
- import com.stencyl.Engine;
- import com.stencyl.event.EventMaster;
- import com.stencyl.event.StencylEvent;
- class PokiFlash
- {
- public var PokiSDK:PokiFlashSDK;
- //public static function start(instance:Dynamic)
- public function new()
- {
- //I'll do PokiSDK = new PokiFlashSDK(); here when I'll learn how to make a Singleton
- }
- public function start()
- {
- trace ("started");
- PokiSDK = new PokiFlashSDK();
- PokiSDK.Init(openfl.Lib.current);
- PokiSDK.enableLogs = true;
- }
- public function getAd(position:String)
- {
- try {
- if (position == "preroll")
- {
- PokiSDK.RequestAd(PokiAdPosition.preroll);
- trace ("preroll add requested");
- }
- else if (position == "midroll")
- {
- PokiSDK.RequestAd(PokiAdPosition.midroll);
- trace ("midroll add requested");
- }
- else
- trace ("Unknown ad requested");
- } catch(e:Dynamic) {
- trace("Error, cannot trigger ad, reason:" + e.message);
- }
- }
- //public static function addListener(type:String, func:Dynamic):Void
- public function AddListener(type:String, func:Void -> Void):Void
- {
- //PokiSDK.AddEventListener(type, func);
- PokiSDK.AddEventListener(PokiAdEvent.completed, function(){trace ("HELLO!!!");});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement