Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
Jellobus
- Posts: 317
- Joined: Tue Dec 10, 2013 2:53 pm
Post
by Jellobus » Tue Mar 11, 2014 9:45 am
Hi guises,
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
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Tue Mar 11, 2014 10:10 am
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
Jellobus
- Posts: 317
- Joined: Tue Dec 10, 2013 2:53 pm
Post
by Jellobus » Tue Mar 11, 2014 11:49 am
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...
Cheers,
Louis
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Tue Mar 11, 2014 12:32 pm
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
Jellobus
- Posts: 317
- Joined: Tue Dec 10, 2013 2:53 pm
Post
by Jellobus » Tue Mar 11, 2014 2:48 pm
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
-
Attachments
-
