How to implement the branding logo's

Admeen designed own branding logo's for game developers to implement in their own flash games. In this manul we will explain how you can implement our logo in your Flash file.

Logo examples

You will need Adobe Flash Player to view this content
Get Adobe Flash player
branding01.swf 1:1
You will need Adobe Flash Player to view this content
Get Adobe Flash player
branding02.swf 4:1

Howto

Let's say you have got a .fla file with the dimensions 800px (width) x 600px (height). Now you want to add the branding01 logo in the upper right corner. Follow the steps below to implement the logo or download the example file.

  1. Create a new (top) layer in your timeline and change the name to branding;
  2. Download our example file, extract the contents and open example.fla. In the Library (Cmd+L) you'll see a brandingXX_def MovieClip (XX represents a number) and the branding folders, one for each branding logo.
  3. Select the branding01_def MovieClip and the folder for the logo you want to implement, for example branding01;
  4. Go to your own Flash project file and paste the copied items to your Library (Cmd+L);
  5. Insert branding01_def into your stage, give it the instance name branding_def and scale/move it to the right size/position (remember the width and height, you'll need them in step 13);
  6. With the MovieClip still selected (if not, select it in your stage), choose Modify › Convert to Symbol (F8 or rightclick › Convert to Symbol);
  7. Now give your symbol a name (for example branding) and select Movie Clip as Type;
  8. In your Library you will see the new MovieClip item;
  9. Double-click on your symbol in the stage, you will enter the edit mode for your Movie Clip;
  10. Select the one and only keyframe on your timeline;
  11. Open the Action box (Option+F9) so we can enter some ActionScript 3 to load the branding logo;
  12. Copy and paste the code from below;
  13. If you want different logo dimensions you can change the var w and var h values in the top of the code. Make sure you keep the right aspect ratio (shown below the logo examples on top of this page). The values must match the width and height of the MovieClip inserted in step 5;
  14. Test your movie by choosing Control › Test Movie (Cmd+Return) from the menu.

ActionScript 3 code

var url:String = "http://media.admeen.com/branding/branding01.swf";
var w:int = 100;
var h:int = 100;

branding_def.addEventListener(MouseEvent.CLICK, onClickHandler);
branding_def.buttonMode = true;
branding_def.useHandCursor = true;
function onClickHandler(event:MouseEvent){
    var variables:URLVariables = new URLVariables();
    variables.lng = Capabilities.language;
    var request:URLRequest = new URLRequest("http://media.admeen.com/branding/forward.php");
    request.data = variables;
    try {
        navigateToURL(request, "_blank");
    } catch (e:Error) {
        trace("Error: ");
    }
}

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, success);
if(Security.sandboxType == Security.REMOTE){
    var context:LoaderContext = new LoaderContext();
    context.securityDomain = SecurityDomain.currentDomain;
    loader.load(new URLRequest(url), context);
} else {
    loader.load(new URLRequest(url));
}

function success(evt:Event):void{
    var branding:MovieClip = MovieClip(evt.target.content);
    if (contains(branding_def)) removeChild(branding_def);
    var fX = (w/branding.loaderInfo.width);
    var fY = (h/branding.loaderInfo.height);
    addChild(this.scaleToFit(branding,(branding.width*fX),(branding.height*fY)));
}

function scaleToFit(mc:MovieClip, maxW:int, maxH:int):MovieClip{
    maxH = maxH == 0 ? maxW : maxH;
    mc.width = maxW;
    mc.height = maxH;
    mc.scaleX < mc.scaleY ? mc.scaleY = mc.scaleX : mc.scaleX = mc.scaleY;
    return mc;
}

In some cases you'll have to import the needed Flash packages. It might also be necessary to allow our domain inside your actions panel. The code below shows how to implement both parts. Just put the code before the code shown above.

import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.system.Security;

Security.allowDomain("media.admeen.com");

Download example

We've prepared a working example for free download. Just click on the link below to download the zip file, which contains a .fla file.