Page 1 of 1

setting a banner Ad to the bottom??

Posted: Tue Mar 11, 2014 9:45 am
by Jellobus
Hi guises, :P

I recently playing with LiveCode commercial version. I am using the fullscreenmode to "exactfit" property in my app but it seems the loc of the banner does not adjusted by the fullscreenmode property. I like to locate a banner ad to the bottom of the screen regardless of its screen size.

I found a lesson for the implementation of the Banner Ad but I couldn't figure out how to set the banner to the bottom of the screen. The lesson shows only a way to set banner to top by setting topleft 0,0

Anyone could help me?

Cheers,

Louis

Re: setting a banner Ad to the bottom??

Posted: Tue Mar 11, 2014 10:10 am
by Mark
Hi Louis,

Try setting the bottomright of the banner ad to the bottomright of the card, instead of setting the topleft of the banner ad to the topleft of the card or stack. If it isn't directly clear how to do this, post your current script and I'll tell you what you need to change.

Kind regards,

Mark

Re: setting a banner Ad to the bottom??

Posted: Tue Mar 11, 2014 11:49 am
by Jellobus
Hi Mark,

This is what I tried...

Code: Select all

on preopenstack
   set the fullscreenmode of this stack to "exactfit"
end preopenstack

on openstack
   createAd1
end openstack

on createAd1
   local tBDetails
   if the environment is "mobile" then
      mobileAdRegister "TestID"
      put "30" into tBDetails["refresh"] // The advert refresh interval in seconds
      put 15-34 into tBDetails["age"] // The age of the target audience
      put "female" into tBDetails["gender"] // The expected gender of the target audience
      mobileAdCreate "myBannerAd1", "banner", (0,0), tBDetails
      mobileAdSetBottomRight "myBannerAd1", (693,390)
      mobileAdSetVisible "myBannerAd1", true // Sets the visible of the ad "myAd2" to true
   end if
end createAd1
I think loc should be set when Ad is created. but not after mobileAdCreate... :roll:

Cheers,


Louis

Re: setting a banner Ad to the bottom??

Posted: Tue Mar 11, 2014 12:32 pm
by Mark
Hi Louis,

There is no mobileAdSetBottomRight. I'd expect you to get an execution error there :-)

Does this work for you?

Code: Select all

on createAd1
   local tBDetails
   if the environment is "mobile" then
      mobileAdRegister "TestID"
      put "30" into tBDetails["refresh"] // The advert refresh interval in seconds
      put 15-34 into tBDetails["age"] // The age of the target audience
      put "female" into tBDetails["gender"] // The expected gender of the target audience
      put mobileAdTopleftFromBottomright(60) into myTopLeft
      mobileAdCreate "myBannerAd1", "banner",myTopLeft, tBDetails
      mobileAdSetVisible "myBannerAd1", true // Sets the visible of the ad "myAd2" to true
   end if
end createAd1

function mobileAdTopleftFromBottomright theBannerHeight
  put the bottom of this cd - theBannerHeight into myTop
  return 0,myTop
end mobileAdTopleftFromBottomright 
I assume that the banner width equals the width of your stack. You can adjust the value 60 to the height of the banner if you know this.

Kind regards,

Mark

Re: setting a banner Ad to the bottom??

Posted: Tue Mar 11, 2014 2:48 pm
by Jellobus
Thanks Mark,

I have tried the script something like your suggestion before this posting...I set the topleft of ad to (0, the height of cd - the height of banner).

Even though I put 0 for the height of banner in the function, the result was same as the picture. Please see the attached picture of the ad test. I assumed that with putting 0 instead 60, the banner should not be shown on the screen..(because the topleft of a banner will be placed just below the screen in theory)...but the banner was set above the screen with margins.. and here is the script I implemented for the result in the picture.

Cheers,

Louis

Code: Select all

on preopenstack
   set the fullscreenmode of this stack to "exactfit"
end preopenstack

on openstack
   createAd1
end openstack

local tBDetails,myTopLeft,myTop

on createAd1

if the environment is "mobile" then
mobileAdRegister "TestID"
put "30" into tBDetails["refresh"] // The advert refresh interval in seconds
put 15-34 into tBDetails["age"] // The age of the target audience
put "female" into tBDetails["gender"] // The expected gender of the target audience
put mobileAdTopleftFromBottomright (0) into myTopLeft
mobileAdCreate "myBannerAd1", "banner",myTopLeft, tBDetails
mobileAdSetVisible "myBannerAd1", true // Sets the visible of the ad "myAd2" to true
end if
end createAd1

function mobileAdTopleftFromBottomright theBannerHeight
put the bottom of this cd - theBannerHeight into myTop
return 0,myTop
end mobileAdTopleftFromBottomright