public static void runExample(
DfaServices dfaServices, DfaSession session, String creativeName, String swfAssetFileName,
String imgAssetFileName, long advertiserId, long sizeId, long campaignId) throws Exception {
// Request the service.
CreativeRemote service = dfaServices.get(session, CreativeRemote.class);
// Create the Flash in-page creative.
FlashInpageCreative flashInpage = new FlashInpageCreative();
flashInpage.setId(0);
flashInpage.setName(creativeName);
flashInpage.setAdvertiserId(advertiserId);
flashInpage.setActive(true);
flashInpage.setCodeLocked(true);
flashInpage.setSizeId(sizeId);
// The type ID for FlashInpageCreative is 24. See GetCreativeTypes.java
flashInpage.setTypeId(24);
// Set the parent flash asset structure.
HTMLCreativeFlashAsset parentFlashAsset = new HTMLCreativeFlashAsset();
parentFlashAsset.setAssetFilename(swfAssetFileName);
flashInpage.setParentFlashAsset(parentFlashAsset);
flashInpage.setWmode("opaque");
// Set the backup image asset.
HTMLCreativeAsset backupImageAsset = new HTMLCreativeAsset();
backupImageAsset.setAssetFilename(imgAssetFileName);
flashInpage.setBackupImageAsset(backupImageAsset);
// Set the target window for backup image.
TargetWindow backupImageTargetWindow = new TargetWindow();
backupImageTargetWindow.setOption("_blank");
flashInpage.setBackupImageTargetWindow(backupImageTargetWindow);
// Save the Flash in-page creative.
CreativeSaveResult creativeSaveResult = service.saveCreative(flashInpage, campaignId);
// Display the new creative ID.
System.out.printf("Flash inpage creative with ID \"%s\" was created.%n",
creativeSaveResult.getId());
}