September 18, 2008
using webtier compiler with flex 3
In flex 2, the webtier compiler is included in the SDK. But in flex 3, it is no longer included in the flex 3sdk install. You have to install and configure it separately. The following links will show you how to install and configure it.
http://labs.adobe.com/wiki/index.php/Flex_Module_for_Apache_and_IIS
http://livedocs.adobe.com/flex/3/html/help.html?content=apache_3.html
http://opensource.adobe.com/wiki/display/flexsdk/Downloads
There are two type of configuration:
1. config with Apache or IIS connector. If you are using Apache or IIS as your web server, then this may be the approach you want to take.
2. install as a J2EE app. This approach will install a webtier.war to your machine. Then you can deploy this war file to the app server you are using. You should deploy it as extracted app, and put your flex app page under the web root.
Problem:
When you run a flex app page with the webtier compiler, it runs fine the first time you request it. If you modify anything in the code and recompile that page, then you may see the following Error:
TypeError: Error #1010: A term is undefined and has no properties.
at mx.styles::StyleManagerImpl/initProtoChainRoots()
at mx.styles::StyleManager$/http://www.adobe.com/2006/flex/mx/internal::initProtoChainRoots()
See bug http://bugs.adobe.com/jira/browse/LCDS-387 for details.
Workaround:
By default, we are using incremental compile to do the compiling, but the incremental compile has some issues. The workaround is to not use the incremental compile.
in flex-webtier-config.xml; set the incremental-compile to false:
<incremental-compile>false</incremental-compile>
Once the change is made, the webtier compiler will work properly.
Posted by lin at 04:42 PM | Comments (5)
August 12, 2008
How to turn on debug trace in Flex
When you encounter issue wit your flex app, one useful tool for troubleshooting is to turn on debug in flex to get some output that will provide some clue of the cause of he problem. Here is how to turn it on from server-side as well as from client-side:
1. From server side:
In the services-config.xml, set the logging level to debug, and set filters to include the service you need:
<target class="flex.messaging.log.ConsoleTarget" level="debug">
<properties>
<prefix>[Flex hotfix2] </prefix>
<includeDate>true</includeDate>
<includeTime>true</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>true</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Protocol.*</pattern>
<pattern>Message.*</pattern>
<pattern>DataService.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
See available pattern in doc:
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=services_logging_3.html
2. To turn on trace in JGroup:
in jgroups-tcp.xml, add <TRACE/> tag just before the </config> line :
<config>
....
<TRACE/>
</config>
3. To turn on from client-side:
Make sure flashlog.txt is enabled, i.e, have the following setting in mm.cfg
TraceOutputFileEnable=1
ErrorReportingEnable=1
See more details in the doc here
There is a good blog regarding mm.cfg here as well.
Then in your flex app, add the following tag:
<mx:TraceTarget/>
Posted by lin at 04:38 PM | Comments (26)
March 12, 2008
How to apply chart license to flex 3
Some user found that after upgrade from FB2/Flex2 to FB3/Flex3, the chart watermark appears in the app. This is because the license has not applied correctly. There are certain changes regarding how we get license info, and they are described in the doc http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_2.html
Also see Blog entries:
http://raghuonflex.wordpress.com/2008/02/19/changes-in-flex-beta-3-licensing-model/
http://raghuonflex.wordpress.com/2008/02/20/how-to-apply-the-data-visualization-license-on-command-line-in-flex-3/
Basically, here are the things you need to know:
1. If you want to compile with flex 3 SDK, you will need a new license for flex 3. The license for flex 2 sdk would not work.
2. To apply the license from FB3, go to Help --> Manage flex license, then type in the license key. It should look like this: 1377-xxxx-xxxx-xxxx-xxxx-xxxx.
3. To apply the license in flex-config.xml:
<flex-config>
<licenses>
<license>
<product>flexbuilder3</product>
<serial-number>1377-xxxx-xxxx-xxxx-xxxx-xxxx</serial-number>
</license>
</licenses>
<compiler>
...
</compiler>
</flex-config>
4. To apply the license in license.properties file:
The path to the license.properties file for various OS are changes for flex 3, they are now at:
1)."../Documents and Settings/All Users/Application Data/Adobe/Flex" directory on Windows
2)."Library/Application Support/Adobe/Flex" directory on MAC
3)."$HOME/.adobe/Flex" on Linux
Posted by lin at 06:12 PM | Comments (122)
June 07, 2005
Pass different dataProvider into the same ComboBox CellRenderer used in multiple columns of a DataGrid
Recently, I got a request to provide a sample to pass different dataProvider to the same CellRenderer used in multiple columns of a DataGrid. i.e., there are multiple columns in a DataGrid that need to use the same ComboBox CellRenderer. However, the dataProvider for each of the column needs to be different. Obviously, there are several ways to do this. Here I will show two of them.
1. The first approach is tightly couple the main app and the CellRenderer.
This approach requires the CellRenderer has knowledge about the parent document. It define the different dataProvider in the main app for each column CellRenderer, and then the CellRenderer will fetch dataProvider and set the dataProvider of the ComboBox in setValue() based on the column Index we get from getCellIndex().columnIndex like this:
function setValue(str:String, item:Object, sel:Boolean) : Void
{ //Get values from the dataProvider
combo._visible =(item!=undefined);
if (item!=undefined){
var ind = getCellIndex().columnIndex;
trace ("ind="+ind);
if (ind==0) {
combo.dataProvider = parentDocument.nameDP;
} else if (ind==1){
combo.dataProvider = parentDocument.phoneTypesDP;
}
combo.selectedIndex = item.phoneTypes.index;
}
rowData = item;
size();
}
See sample passDiffDP.mxml and the cellrenderer passDiffDPCell.mxml.
2. The second approach is to create a generic CellRenderer.
If you want to have a generic CellRenderer that is not tightly coupled with the parent app, then you should not set dataProvider in the CellRenderer. Instead, you should have the parent document telling the cell renderer what the data provider is for a given column. In this way, the combo CellRenderer class can be generic and could be used by any application.
There should be different ways to create generic CellRenderer, but extending the DataGridColumn works pretty well for me.
The only thing that’s needed in the extended class is a dataProvider String. The code is as simple as the following:
class myDataGridColumn extends mx.controls.gridclasses.DataGridColumn
{
var dataProvider:String;
}
Now the new DataGridColumn will take a property dataProvider, so you can pass individual dataProvider to each column like this:
<myDataGridColumn dataProvider="nameDP" columnName="name" headerText="Name" cellRenderer="{passDiffDPCellFromMain}" editable="true"/>
<myDataGridColumn dataProvider="phoneTypesDP" columnName="phoneTypes" headerText="Phone Type" cellRenderer="{passDiffDPCellFromMain}" editable="false"/>
For more details, see sample code:
passDiffDPFromMain.mxml
Posted by lin at 07:33 AM | Comments (190)