Friday, March 21, 2014

Mochimedia closing down :( Absolute beginner blurrr case scenario for MMF users for Ad quickfix with Flash Develop

Well mochimedia will be closing it's doors coming 31st March 2014. :( With this, it will be the end of all my ads revenue from mochimedia. I have been using Multimedia Fusion for my flash games for some time so adding in the mochiads is rather simple as it's a built in feature for MMF Developer Edition.

The two immediate alternatives for ads I found is FGL and ZuperAds. FGL has been a long player in the industry while ZuperAds is a startup that is shaping up rather nicely after mochi's announcement of it's closure. None of them had an extension in Multimedia Fusion for it's flash exporter :(. I am sure sometime later it will be in but meanwhile I am left with embedding the swf files created by MMF in another SWF which acts as a container that serves the ads.

I am going to walk through on how to add FGL ads as at time of writing, ZuperAds requires you to call ZuperAds,hideAd(); to hide the ads once it's displayed while FGL handles the close ads on it's ad container itself... just to keep it simple.

This might not be the best way but it works... for now.

Ok here goes... what you need.
  • FREE Flash Develop - Get it HERE
  • . Download get the latest. I got mine yesterday ver 4.5.2 Zipped version.
  • FREE Adobe Flex SDK - Get it HERE Now if you got the Flash Develop Zipped version like me, you need to manually download this.
  • FREE Flash Player Active X Debug version - Get it HERE
Yes... I am a bit on a tight budget so everything used is FREE. Even the screenshot I captured was done in FREE GIMP.
Now the hard part... go through Flash Develop Wikidocs on how to set it up properly.

Once it's up and running, create your first Flash Project as shown below.

Make sure you choose AS3 Project and not the default 'Flash IDE Project' or you gonna have problem. I named my project 'TryFGL'

Now you will get a project which has a file class called 'Main' under the src folder. Just go there and click on the file to view the content. It should look like below

Now try to compile the project... right click on the project and choose 'Built Project'

If everything goes well, the output window at the bottom should show some things that ends with a blue Done.

Congratulations! You are a winner! Ahhh... that's not that bad. You have compiled your swf. It's located in your project directory's bin directory.

Now you need to signup with FGL to get the codes... well I am not going to walk you through the signup and getting the codes part. Just go to FGL.
I am just gonna assume you are able to figure it out by yourself, get the "" file and get to the 'Download Ad Code' button to actually download the ad code for your game. You will get something like [NAMEOFGAME] Mine is

Just copy the two files over to your project's src folder along with your SWF files created from MMF. Mine is InvaderDefender.swf

Open up the [NAMEOFGAME] It should look like this.

Note the FGL Ad code number "FGL-2xxxxx28". Now go back to the code and edit it as below.

Ok for those lazy lads that do not like typing... here is the code
 import flash.display.MovieClip;
 import FGLAds;
 [SWF(frameRate='30', width='550', height='400', backgroundColor='0xffffff')]
  * ...
  * @author 
 public class Main extends MovieClip
  [Embed(source = "InvaderDefender.swf")] public var MMFswf:Class;
  public var ads:FGLAds  = new FGLAds(this, "FGL-2xxxxx28");
  public function Main():void 
   if (stage) init();
   else addEventListener(Event.ADDED_TO_STAGE, init);
  private function init(e:Event = null):void 
   removeEventListener(Event.ADDED_TO_STAGE, init);
   // entry point
   ads.addEventListener(FGLAds.EVT_API_READY, showStartupAd);
   var MMFswf:MovieClip = new MMFswf() as MovieClip;

         MMFswf.x = 0;
         MMFswf.y = 0;
  private function showStartupAd(e:Event):void 

Now, if only you would spent some time to read and understand the codes... but I guess you won't so... for a quick fix just change the

InvaderDefender.swf to your MMF swf filename.
FGL-2xxxxx28 to your FGL Ad Code.

Now lets compile! Yup... that's it! You have successfully embedded your MMF produced SWF into a new SWF with an ad container from FGL. Just click on your index.html in your bin folder.

Your FGL ad should display on top of your game!

Hope this article is useful.