02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Type 3: Preloader Ads

A Preloader ad is an ad that is part of the preloading of your game. As the user is waiting why not entertain them with some high quality video ads and get a few bucks in the process.

Preloader ads are perfect in a way as they enable you to make a few dollers and at the same time the user understand that there waiting for there content so there looking at the screen waiting to get started

Video Transcript

00:00So we've seen the two type of ads which were the click ad and the
00:05Time-based ad let's see the third type of ad which is actually the first thing you would you would ever see which is the pre-loader ad
00:12Now to use it. I'm just gonna grab and they're all very very similar which just kind of shows you how
00:18Easy it is to work with them. I'm just gonna grab again
00:23Everything from here and
00:28I am going to put it in my constructor right here
00:32now in our scenario usually you probably wouldn't want to put it here because you first want to
00:38You'd first want to load basically the whole point of the pre-loader banner
00:42It's enabled you to first load your application and while you're loading your application show a banner
00:48Our game is actually only 5k or 4k. So there's really no need for a pre-loader. So we're really just putting it there
00:56Just enable us to put another ad
01:00So I'm just gonna paste in that code and I want to position my ad again in the same spot as before
01:05This time around we're gonna put it at 65 because we don't have the start button there
01:10We don't need to unload anything because it's gonna be the first time that we actually run our ad
01:16Now the next step is actually we want to make sure let's go through the parameters and check if we're happy with them
01:22So we're happy with ID. We're happy with the size
01:25We're happy with the movie clip where it's going to be living in
01:29We're not happy with start because we don't want our application to actually
01:33Start a game at that point. We'd actually want to cancel out this on IO error and I know this seems weird on IO error
01:40So let me just explain what it is for a second. It's kind of a little hack
01:45The reason is because I'm running through Twitter and I'm trying to load from Twitter and Twitter is known to not be being very stable
01:52When it comes to loading things from it
01:54so I'm trying to run it and make a few attempts and basically you
01:58cycle through it a few times actually three times before I give up and
02:02Display the user an error message and to do that
02:04I just wanted to reuse the code and I'm all I'm really doing there is if there was an event I get rid of
02:10The event then I add another count and then I try to load the application again
02:15And it would just call it up to three times and then display an error to the user
02:19So now now that we got that sorted out. Let's try to see and
02:26We don't want to call our start and we probably want to cancel this out, right?
02:30so I'm just going to create here an anonymous function inside and
02:34position it right inside of my ad finished and
02:38In my ad finish I could just call my on IO error, which is basically our loader
02:44Now if we run our application right now, that's really all we had to do besides change the method that we want to call
02:50Right, so we don't want to call the interval one anymore. What do we want to call? We want to call the show
02:55pregame ad and
02:59Again, I have to just delete that extra
03:01open bracket because flash
03:04Automatically adds them when I don't want them sometimes and if I run the application and again, I have a spelling error
03:11How did that creep back up? Let me just fix that
03:15And if we run it, oh I put that oh in the wrong place
03:20definitely did
03:22And one more time and here we go. So first of all, I have my pre loader ad
03:27It's loading in we we have our you know display there telling us that we're loading from our assess
03:32But actually we're not really loading it. We're first loading the banner and
03:37Then we're loading the RSS but because it's such a small feed if it's there it will load really quickly if not it just won't
03:44And now we could see that we have now
03:47three ads
03:48now the question is
03:51Related to this is do we really want to keep it or not? We're gonna see in our next video how we could actually
03:57First of all, even before we go to the next video
03:59Let's see what parameters we could change in here because we talked about and we said that we have some a lot of optional
04:05Parameters that we didn't really get into
04:08So let me just open up our moochie folder and go into my source into the moochie. Whoop
04:14Let's make this bigger and into moochie ad
04:18and
04:19we will open that up and
04:22I'm just gonna search for
04:24Our function that starts any function that starts with show and we'll see that on show pregame
04:30And which is a perfect one to start one from because it's the one that has the most parameters
04:35Let's just run through them quickly. So we already know about clip and we know about our ID and our resolutions
04:43Background enables us to change the color of the background of the preloader
04:48There's quite a lot of these small parameters and they're quite easy to follow and they're just really about just skinning
04:54that preloader
04:55We could skip ads just to make sure that we just don't call the ad while we're working in development as they say it's great
05:02for testing
05:04Fade time is the number of milliseconds to fade out the ad which is basically you could play around with the fade-in
05:09Now this is where it starts getting interesting
05:11So our methods that are here we could override like we overrode our ad finished
05:17Which enable us to know that the ad completed so we could move on to the next step
05:21We could listen also to when the ad began
05:23We could listen also went to when the ad failed in our scenario
05:27We didn't care because we we know the ad finish will be called even if ad fail happens. It would happen before
05:34But if we wanted to have like a backup if for example
05:37We wanted to put one of our internal ads in case the ad failed
05:40Then we could call our on ad failed and put a default banner there to enable us to put something there
05:46Automatically, even if the ad banner didn't work
05:50ad loaded
05:52Is same thing. So the ad was loaded, but it didn't start yet. Ad skipped as if the ad was skipped such as if there was
05:59a failure
06:02Ad in progress, which is only happens for the is only true only for the
06:08Preloader ad which tells us how much did it go through and how much is left?
06:12Now if we go on to the next show all the rest are basically
06:18Stripped down they have most of the functions the callbacks that we could override and as you saw we overrode
06:25Only one method and we overrode it quite a few times where we overrode our ad finished and put inside of it
06:32Whatever we wanted to call
06:35So that's really all you really need to know from the basics and you could see that it's quite easy to get rolling and starting
06:41To work with ads and you could start playing around with it and figure out how do you want to leverage those ads?
06:48Now in my scenario, I don't really want to use the preloader ad directly in my application because I'm going to be using
06:55I'm going to use the loading from the website directly and we're going to see how that works
07:01moment

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!