mergBanner

mergBanner is a LiveCode external that adds an iAd banner to your app at the bottom of the screen.

command mergBannerCreate

Creates the banner off screen.

Code sample

on openStack
  if the environment = "mobile" then
     mobileSetAllowedOrientations "portrait,portrait upside down,landscape left,landscape right"
    -- must be after the stack is fully visible
    send mergBannerCreate to me in 100 milliseconds
  end if
end openStack

command mergBannerDelete

Deletes the bannser and removes from screen if it's currently being displayed.

Code sample

on closeStack
  -- you should also delete and recreate if you don't want to sisplay the banner for a long time
  mergBannerDelete
end closeStack

command mergBannerVisible pVisible

Animates the banner on and off screen.

Parameters:

  • pVisible -

Code sample

on mergBannerLoaded
  -- an add has loaded so you can display the banner now
  mergBannerVisible true
end mergBannerLoaded
 
on mergBannerError
  -- hide the banner because an add failed to load
  mergBannerVisible false
end mergBannerError// * end

function mergBannerRect

Get the rect of the banner if it's on screen so you can resize your UI above it.

Returns the rect of the banner

Code sample

put mergBannerRect() into tRect

message mergBannerLoaded

Sent to the default card when an add is loaded. You should not set the banner to visible until you recieve this message.

Code sample

on mergBannerLoaded
  -- an add has loaded so you can display the banner now
  mergBannerVisible true
end mergBannerLoaded

message mergBannerError

Sent to the default card when an add failed to load.

Code sample

on mergBannerError
  -- an add has loaded so you can display the banner now
  mergBannerVisible true
end mergBannerLoaded

message mergBannerActionStarted pLeavingApp

Sent to the default card when a user clicks on an ad.

Parameters:

  • pLeavingApp - true if the user will leave the app.

Code sample

on mergBannerActionStarted pLeavingApp
  -- full screen banner action 
  -- stop doing stuff that consumes lots of memory etc
end mergBannerActionStarted

command mergBannerPrepareInterstitials

(iOS 7+) Because displaying an ad involves downloading ad assets over the network, in can sometimes be useful to tell the framework to prepare for ad presentation prior to needing to display the first ad. If there is a point in the launch of your app when it would be convenient to prefetch ad assets, you can use this method to trigger one.

command mergBannerPresentInterstitial

(iOS 7+) This method can be called at any time to request an ad. If an ad is available, the framework presents it immediately. If there is no ad available, nothing happens. iAd has a built in delay of roughly 2 minutes between interstitials so they don't annoy users so no ad will be shown if requesting again after less than that time no ad will be shown.

Sets the result to If true an ad will be displayed

command mergBannerCreateManagedInterstitial

Create an interstitial where you maintain scripted control over how long it remains on screen

message mergBannerInterstitialLoaded

Sent to the control that called mergBannerCreateManagedInterstitial when an ad is available to be shown.

command mergBannerShowManagedInterstitial

Show the interstitial ad

command mergBannerHideManagedInterstitial

Hide the interstitial ad

message mergBannerInterstitialUnloaded

Sent to the control that called mergBannerCreateManagedInterstitial when an ad is unloaded.

command mergBannerDeleteManagedInterstitial

message mergBannerInterstitialActionStarted pLeavingApp

Sent to the control that called mergBannerCreateManagedInterstitial when the user touches the ad and the ad action begins.

Parameters:

  • pLeavingApp - true if the user will leave the app.

message mergBannerInterstitialActionFinished

Sent to the control that called mergBannerCreateManagedInterstitial when the the ad action is finished.

message mergBannerInterstitialError pError

Sent to the control that called mergBannerCreateManagedInterstitial when there is an error loading an ad.

Parameters:

  • pError - A localized error string describing the problem