Pubblegum with Adobe Flex

Installing the Component

Download the swc library and import it in your flex project.

Import swc library (Flex Builder)

Import the pubblegum class:

import com.adhese.pubblegum.PubblegumAS3;

If you are going to use the events you need to import PubblegumEvent as well:

import com.adhese.events.PubblegumEvent;
var pubblegum:PubblegumAir = new PubblegumAir("adhese_demo", "flex", "demo");

A basic Pubblegum intergration will look like this:

import com.adhese.pubblegum.PubblegumAS3;
import com.adhese.events.PubblegumEvent;
		
var pubblegum:PubblegumAS3 = new PubblegumAS3();
public function init():void{
	pubblegum.companyID = "adhese_demo";
	pubblegum.campaignID = "flex";
	pubblegum.creativeID = "demo";
}

Tracking custom actions

To track actions, you only need this line of code:

pubblegum.action("your_action_name");

Please, do not use characters like @#$%

When publishing your swf and clicking on it you should see something like this:

- Pubblegum for AS3 by Adhese -
http://creative.campaign.adhese.agency.adhese.com/log/adhese/campaign/creative/file:///HD/Users/...

Events

PubblegumEvent.READY

This event is triggered when Pubblegum is fully initialized.

pubblegum.addEventListener(PubblegumEvent.READY, ready);
private function ready(e:PubblegumEvent):void{
	trace("Pubblegum is at your service");
}

PubblegumEvent.LOGGED

This event is triggered each time Pubblegum performs a log action.

The data object contains the logged type.

pubblegum.addEventListener(PubblegumEvent.LOGGED, logged);
private function logged(e:PubblegumEvent):void{
	trace(e.type);
}

PubblegumEvent.URL_FOUND

This event is triggered when Pubblegum has found the swfs location. The data object contains the found url. This url can be used for site specific targetting.

pubble.addEventListener(PubblegumEvent.URL_FOUND, urlFound);
public function urlFound(e:PubblegumEvent):void{
	trace("found url: " + e.data);
}