Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Banner ad rotation

var bannerLink = [
"https://www.link2voip.com/index.php?coupon=pnnacvps",
"https://www.link2voip.com/index.php?coupon=pnnacvps",
"http://www.bullionvault.com/#FAHAYEK",
"http://www.bullionvault.com/#FAHAYEK",
"http://www.buyphones.ca"
];

var bannerImg = [
'img/ad1.png',
'img/ad2.png',
'img/ad3.png',
'img/ad4.png',
'img/ad5.png'
];

function randomXToY(minVal,maxVal){ 
   var now = new Date();
   var seed = now.getSeconds();
   var randVal = minVal+(Math.random(seed)*(maxVal-minVal)); 
   return Math.round(randVal);
}

var randomnumber = randomXToY(1,5);

var bannerImage = Titanium.UI.createImageView({
    top:420,
    height:60,
    width:320,
    image:bannerImg[randomnumber]
});

bannerImage.addEventListener('click',function(e){
    Ti.Platform.openURL(bannerLink[randomnumber]);
});

So I've got this far in finding out how to rotate banner ads - It's not working. Any suggestions? Any workable code for rotating any images, even sequentially will be fine. Thanks for your help in advance. This is the last hurdle we have for our app!

— asked September 4th 2010 by D DB
  • ad
  • advertisement
  • banner
  • rotation
  • rotator
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.