Created
August 13, 2012 06:18
-
-
Save setou/3337381 to your computer and use it in GitHub Desktop.
Titanium Mobile AMoAd module
This file contains 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
function ADCAmoadView() { | |
(function() { | |
Ti.App.Properties.setInt('AD_TOP', 0); | |
Ti.App.Properties.setInt('AD_LEFT', 0); | |
Ti.App.Properties.setInt('AD_HEIGHT', 320); | |
Ti.App.Properties.setInt('AD_WIDTH', 50); | |
Ti.App.Properties.setBool('TEST_OR_DEVELOPMENT', | |
((Ti.App.deployType=='test'||Ti.App.deployType=='development')?true:false)); | |
Ti.App.Properties.setString('AMOAD_SID', '<<YOUR SID HERE>>'); | |
Ti.App.Properties.setString('AMOAD_SID_TEST', | |
'b933b6ed285c118eb0074fa0b76d8116d7d9ac661a788926aa4b32dfc7e842cd'); | |
})(); | |
var tiamoad = require('ti.amoad'); | |
var sid = Ti.App.Properties.getBool('TEST_OR_DEVELOPMENT') | |
? Ti.App.Properties.getString('AMOAD_SID_TEST') | |
: Ti.App.Properties.getString('AMOAD_SID'); | |
var self = tiamoad.createAd({ | |
top : Ti.App.Properties.getInt('AD_TOP'), | |
left : Ti.App.Properties.getInt('AD_LEFT'), | |
height : Ti.App.Properties.getInt('AD_HEIGHT'), | |
width : Ti.App.Properties.getInt('AD_WIDTH'), | |
sid : sid, | |
currentContentSizeIdentifier: tiamoad.AMoAdContentSizeIdentifierPortrait, | |
enableRotation: true, | |
interval: 60, | |
//rotationAnimationTransition: tiamoad.AMoAdViewAnimationTransitionFlipFromLeft | |
}); | |
self.startRotation(); | |
if (Ti.App.Properties.getBool('TEST_OR_DEVELOPMENT')) { | |
self.addEventListener("AMoAdViewwithError", function(){ | |
Ti.API.debug(new Date().toString() + ' AMoAdViewwithError'); | |
}); | |
self.addEventListener("AMoAdViewReceiveEmptyAd", function(){ | |
Ti.API.debug(new Date().toString() + ' AMoAdViewReceiveEmptyAd'); | |
}); | |
self.addEventListener("AMoAdViewReceiveAd", function(){ | |
Ti.API.debug(new Date().toString() + ' AMoAdViewReceiveAd'); | |
}); | |
} | |
return self; | |
} | |
module.exports = ADCAmoadView; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment