
C
HAPTER
3: Creating a Flash UI for Plug-ins
Delivering a plug-in with a Flash UI
33
X
To dispatch events from your C++ plug-in to the Flash extension, use
SDKPlugPlug::DispatchEvent()
. You can encapsulate complex values in the associated data using
XML format. For example:
std::string xmlString = "<payload>...</payload>";
csxs::event::Event event = {
"com.adobe.csxs.events.UpdateDashPanel",
csxs::event::kEventScope_Application,
"test", NULL, xmlString.c_str()} ;
csxs::event::EventErrorCode testResult = DispatchEvent(&event);
Using the CSXS API
The CSXS ActionScript library provides an API that your Flash extension uses to interact with C++ plug-ins.
For complete reference details, see the documentation provided with the Adobe Creative Suite SDK.
X
To receive CSXS Events of a certain type in ActionScript, register a callback function for that event type
using
addEventListener()
. For example:
public function updatePanel (event : CSXSEvent) : void {...}
CSXSInterface.getInstance().addEventListener("com.adobe.csxs.events.updatePanel",
updatePanel);
X
To dispatch events from your extension to your C++ plug-in, use
dispatchEvent()
. You can pass
related data as a string. To encapsulate complex values in data, you can use XML format. For example:
var okClickEvent : CSXSEvent = new CSXSEvent("com.adobe.csxs.events.OkClicked",
CSXSEventScope.APPLICATION);
var xml : XML = new XML("<payload>...</payload>");
okClickEvent.data = xml;
var result : Boolean = CSXSInterface.getInstance().dispatchEvent(okClickEvent);
Delivering a plug-in with a Flash UI
This section uses the FreeGrid sample plug-in and the FreeGridUI sample extension as examples to
describe how to build, install, and debug a plug-in with Flash UI.
Build and install the C++ plug-in
To build your C++ plug-in in Windows, use Visual Studio 2008. In Mac OS, use XCode.
1.
Open the project file:
Z
In Windows:
SDK_root
\samplecode\FreeGrid\FreeGrid.vcproj
Z
In Mac OS:
SDK_root
/samplecode/FreeGrid/FreeGrid.xcodeproj
2.
Build the project. The build result is placed in a subfolder of the
samplecode
folder, depending on
which target you build:
Z
In Windows:
output\win\debug
or
output\win\release
Z
In Mac OS:
output/mac/debug
or
output/mac/release