Skip to content

Commit

Permalink
add GA code
Browse files Browse the repository at this point in the history
  • Loading branch information
Chenguang Liu committed Jun 13, 2013
1 parent 506bd71 commit 943db64
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 10 deletions.
Binary file added libs/DBGATracker.swc
Binary file not shown.
21 changes: 19 additions & 2 deletions src/DragonBonesDesignPanel.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:view="view.*"
addedToStage="addedToStageHandler()"
applicationComplete="this_applicationCompleteHandler(event)"
preloader="prevloadClasses.Prevloader"
width="100%" height="100%"
>
Expand All @@ -20,12 +21,12 @@
import message.Message;
import message.MessageDispatcher;
import model.CopyDataProxy;
import model.ImportDataProxy;
import model.JSFLProxy;
import model.SettingDataProxy;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
import spark.events.IndexChangeEvent;
Expand Down Expand Up @@ -222,35 +223,41 @@
private function importData():void
{
DBGATrackerManager.tracker.trackPageview("/importWindow");
var window:ImportWindow = new ImportWindow();
PopUpManager.addPopUp(window, this, true);
PopUpManager.centerPopUp(window);
}
private function exportData():void
{
DBGATrackerManager.tracker.trackPageview("/exportWindow");
var window:ExportWindow = new ExportWindow();
PopUpManager.addPopUp(window, this, true);
PopUpManager.centerPopUp(window);
}
private function popUpCopyWindow():void
{
DBGATrackerManager.tracker.trackPageview("/copyWindow");
copyWindow.visible = true;
}
private function popUpXMLWindow():void
{
DBGATrackerManager.tracker.trackPageview("/xmlWindow");
xmlWindow.visible = true;
}
private function popUpTextureAtlasWindow():void
{
DBGATrackerManager.tracker.trackPageview("/textureWindow");
textureAtlasWindow.visible = true;
}
private function popUpAboutWindow():void
{
DBGATrackerManager.tracker.trackPageview("/aboutWindow");
aboutWindow.visible = true;
}
Expand All @@ -272,6 +279,7 @@
{
if(_importDataProxy.skeletonData)
{
DBGATrackerManager.tracker.trackEvent("/", "updateArmature");
var armatureNames:Vector.<String> = new Vector.<String>;
armatureNames.push(_importDataProxy.armatureDataProxy.armatureName);
ImportCommand.instance.importFLAData(true, false, armatureNames);
Expand All @@ -282,9 +290,18 @@
{
if(_importDataProxy.skeletonData)
{
DBGATrackerManager.tracker.trackEvent("/", "removeArmature");
RemoveArmatureCommon.instance.removeArmature(_importDataProxy.armatureDataProxy.armatureName);
}
}
protected function this_applicationCompleteHandler(event:FlexEvent):void
{
DBGATrackerManager.createDBGATracker(this);
DBGATrackerManager.tracker.trackPageview("/");
DBGATrackerManager.tracker.setVar(String(SettingDataProxy.getInstance().languageArrayCollection[language.selectedIndex].label));
}
]]>
</fx:Script>
<fx:Metadata>
Expand Down Expand Up @@ -319,7 +336,7 @@
click="popUpAboutWindow()"
/>
<s:Spacer width="100%"/>
<s:DropDownList width="80" height="24" cornerRadius="0" textAlign="right"
<s:DropDownList id="language" width="80" height="24" cornerRadius="0" textAlign="right"
dataProvider="{SettingDataProxy.getInstance().languageArrayCollection}"
selectedIndex="@{SettingDataProxy.getInstance().languageID}"
/>
Expand Down
2 changes: 2 additions & 0 deletions src/view/AboutWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
protected function closeHandler(event:Event):void
{
this.visible = false;
DBGATrackerManager.tracker.trackEvent("copyWindow", "close");
DBGATrackerManager.tracker.trackPageview("/");
}
private function updateAbout():XML
Expand Down
32 changes: 29 additions & 3 deletions src/view/CopyWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,41 @@
public function closeCopySession():void
{
DBGATrackerManager.tracker.trackPageview("/");
this.visible = false;
CopyDataProxy.getInstance().closeCopySession();
}
private function cancelBtn_onClick(event:MouseEvent):void
{
DBGATrackerManager.tracker.trackEvent("copyWindow", "close");
closeCopySession();
}
protected function this_showHandler(event:FlexEvent):void
{
CopyDataProxy.getInstance().openNewCopySession()
}
protected function copyBone():void
{
DBGATrackerManager.tracker.trackEvent("copyWindow", "copyBone");
CopyDataProxy.getInstance().executeBoneCopy();
}
protected function copyBehavior():void
{
DBGATrackerManager.tracker.trackEvent("copyWindow", "copyBehavior");
CopyDataProxy.getInstance().executeBehaviorCopy()
}
protected function save():void
{
DBGATrackerManager.tracker.trackEvent("copyWindow", "save");
CopyDataProxy.getInstance().save();
}
]]>
</fx:Script>
<s:Panel left="20" right="20" top="20" bottom="20" title="{resourceManager.getString('resources','copyBehaviors')}">
Expand Down Expand Up @@ -79,7 +105,7 @@
<s:Button icon="@Embed(source='./assets/copy_icon.png')"
width="24" height="24" horizontalCenter="0" verticalCenter="0"
enabled="{CopyDataProxy.getInstance().boneCopyable}"
click="CopyDataProxy.getInstance().executeBoneCopy()"/>
click="copyBone()"/>
</s:Group>
<mx:Tree width="100%" height="100%"
labelField="{ConstValues.AT + ConstValues.A_NAME}" textRollOverColor="#CCCCCC"
Expand Down Expand Up @@ -111,7 +137,7 @@
<s:Button icon="@Embed(source='./assets/copy_icon.png')"
width="24" height="24" horizontalCenter="0" verticalCenter="0"
enabled="{CopyDataProxy.getInstance().behaviorCopyable}"
click="CopyDataProxy.getInstance().executeBehaviorCopy()"/>
click="copyBehavior()"/>
</s:Group>
<s:Group width="100%" height="100%">
<s:DataGrid width="100%" height="100%" sortableColumns="false" gridClick="CopyDataProxy.getInstance().playDestinationBehavior(event.item)" selectionMode="multipleRows" selectedItems="@{CopyDataProxy.getInstance().selectedMultipleDestinationBehaviors}">
Expand Down Expand Up @@ -140,7 +166,7 @@

<s:HGroup width="100%" gap="0">
<s:Spacer width="800%"/>
<s:Button label="{resourceManager.getString('resources','save')}" click="CopyDataProxy.getInstance().save()"/>
<s:Button label="{resourceManager.getString('resources','save')}" click="save()"/>
<s:Spacer width="100%"/>
<s:Button label="{resourceManager.getString('resources','cancel')}" click="closeCopySession()"/>
<s:Spacer width="800%"/>
Expand Down
17 changes: 14 additions & 3 deletions src/view/ExportWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<fx:Script>
<![CDATA[
import control.ExportDataCommand;
import message.Message;
import message.MessageDispatcher;
Expand All @@ -19,13 +19,16 @@
import mx.collections.ArrayCollection;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
[Bindable]
private var exportScaleArrayCollection:ArrayCollection = new ArrayCollection([0.1, 0.25, 0.5, 0.75, 0.8, 1, 1.5, 2, 4]);
private function exportData():void
{
DBGATrackerManager.tracker.trackEvent("exportWindow", "exportData", "exportType", exportType.selectedIndex);
if(!ImportDataProxy.getInstance().skeletonName)
{
return;
Expand Down Expand Up @@ -55,9 +58,17 @@
private function closeWindow():void
{
DBGATrackerManager.tracker.trackPageview("/");
MessageDispatcher.removeEventListener(MessageDispatcher.EXPORT, commandHandler);
PopUpManager.removePopUp(this);
}
private function closeBtn_onClick(event:MouseEvent):void
{
DBGATrackerManager.tracker.trackEvent("exportWindow", "close");
closeWindow();
}
]]>
</fx:Script>
<s:HGroup left="10" right="10" top="10">
Expand All @@ -70,7 +81,7 @@
/>
</s:VGroup>
<s:VGroup width="100%" gap="6">
<s:DropDownList width="100%" height="24" cornerRadius="0" textAlign="right"
<s:DropDownList id="exportType" width="100%" height="24" cornerRadius="0" textAlign="right"
dataProvider="{SettingDataProxy.getInstance().dataExportArrayCollectio}"
selectedIndex="@{SettingDataProxy.getInstance().dataExportID}"
/>
Expand All @@ -89,7 +100,7 @@
/>
<s:Button width="100" height="24" cornerRadius="0"
label="{resourceManager.getString('resources','cancel')}"
click="closeWindow()"
click="closeBtn_onClick(event)"
/>
</s:HGroup>
</s:TitleWindow>
18 changes: 16 additions & 2 deletions src/view/ImportWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@
import message.Message;
import message.MessageDispatcher;
import model.SettingDataProxy;
import model.ImportDataProxy;
import model.SettingDataProxy;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
private function importData():void
{
DBGATrackerManager.tracker.trackEvent("importWindow", "import", "dataSource", SettingDataProxy.getInstance().dataImportID);
MessageDispatcher.addEventListener(MessageDispatcher.LOAD_FLADATA, commandHandler);
MessageDispatcher.addEventListener(MessageDispatcher.LOAD_FILEDATA, commandHandler);
switch(SettingDataProxy.getInstance().dataImportID)
{
case 0:
ImportCommand.instance.importFLAData(false, false);
break;
case 1:
Expand All @@ -43,10 +47,20 @@
private function closeWindow():void
{
DBGATrackerManager.tracker.trackPageview("/");
MessageDispatcher.removeEventListener(MessageDispatcher.LOAD_FLADATA, commandHandler);
MessageDispatcher.removeEventListener(MessageDispatcher.LOAD_FILEDATA, commandHandler);
PopUpManager.removePopUp(this);
}
private function closeBtn_onClick(event:MouseEvent):void
{
DBGATrackerManager.tracker.trackEvent("importWindow", "close");
closeWindow();
}
]]>
</fx:Script>

Expand Down Expand Up @@ -104,7 +118,7 @@
/>
<s:Button width="100" height="24" cornerRadius="0"
label="{resourceManager.getString('resources','cancel')}"
click="closeWindow()"
click="closeBtn_onClick(event)"
/>
</s:HGroup>

Expand Down
1 change: 1 addition & 0 deletions src/view/TextureAtlasWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
protected function titlewindow_closeHandler(event:CloseEvent):void
{
DBGATrackerManager.tracker.trackPageview("/");
this.visible = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/view/XMLWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
protected function titlewindow_closeHandler(event:CloseEvent):void
{
DBGATrackerManager.tracker.trackPageview("/");
this.visible = false;
}
Expand Down

2 comments on commit 943db64

@milk531
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using gaforflash in your DBGATrackerManager? In the documents there is a note says "Currently, Flash tracking is available for any Flash content embedded in a web page. Tracking of data sent from Adobe Air, Shockwave, or via the Flash IDE (e.g. using Test Movie) is not supported at this time.". May I ask how to break the limit?

@superlancelot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I use the gaforflash. Based on my testing, data sent from Adobe Air or via the Flash IDE works fine in AS3 Mode. I didn't break anything :)

Please sign in to comment.