Archive for January, 2007

MouseWheel support on MacOS X

It seams that flex is unable to receive the MOUSE_WHEEL MouseEvent on Mac computers. This is because Flash MouseWheel is not supported on Mac by default. This has been submitted as an enhancement request already. At the meantime, there are add-on examples you can consider. See one of them here:

Tips for configuring QTP with flex 2.0.1

Key info:

1. must have QTP 9.1, flex 2.0.1, IE 6+, and install the QTP plug-in.

2. must recomiple the app in flex 2.0.1 with automation testing libraries.

3. must put the swf and html file to the QTP machine.

4. When testing, access the html(not the swf) file from a browser via web server. don’t open the html from the file system.

  • Before you start to test your flex app with QTP, you have to make sure you have all the necessary software installed and configured correctly.
  1. Make sure you installed QTP 9.1, not 9.0.
  2. Make sure you installed flex 2.0.1 , and your flex app should be recompiled using flex 2.0.1.
  3. Make sure you have installed the QTP plug-in. You can download it from our website. You will need to register to login the page first. After you login into the page, scroll down and you will see "Flex Automation Package". From there you can download After you unzip the zip file, you can see QTP_Plugin_Installer.exe. Run that exe file and that will install the plugin. Note, To verify if you have installed the plug-in or not, go to your registry, and search for entry of TEAPluginIE.dll and TEAPluginQTP.dll. If those dlls are not in the registry, then your plug-in has not been installed correctly.
  • If you have above installation and configuration, but the QTP does not record the flex app, then check the following:
  1. QTP plug-in is only supported on IE 6+, you need to make sure your browser is using IE 6 or higher version. And your flash player must be version 9.0.28. or higher. To verify your flash player version, request the following link from your testing browser:
  2. The flex app you are going to test with QTP must be prepared for automation. You need compile your app with automation testing libraries, such as automation.swc, automation_agent.swc, and qtp.swc, etc. You can compile this via Command-line compiler or flex builder. If you have compiled your flex app in flex 2.0.1 already, and want to Test run-time loading, then you can compile RunTimeLoading. Please follow the instruction step by step described here.
  3. If you request your flex app from a browser, you have to use the html wrapper file. Do not accessing the swf directly, it needs to be loaded from an object tag with an ID. You can open the wrapper or the SWF file from the file system, but it is not a recommended practice. You should try to deploy the SWF file to a web server and request the html wrapper through HTTP from the server.
    See page 13 of Testing Flex Applications with Mercury QuickTest Professional for more details.
  • If you still have trouble getting up and running with Flex QTP plugin, you can create a log by following the steps below:
  1. Go to the mercury installation/bin directory say: "C:\Program Files\Mercury Interactive\QuickTest Professional\bin" and run MicLogSetting.exe .
  2. Select the log settings as:
    Level: MicLogLevelDebug2
    Folder:C:\Program Files\Mercury Interactive\QuickTest Professional\
    Selected Categories:LogCatPackTEA
  3. Run QTP and record a
    flex application say flexstore.html
  4. A log file would have been generated like C:\Program Files\Mercury Interactive\QuickTest Professional\MicLogFile_QTPro_pid1912_11_32_32.html
  5. Check whether you are seeing the following in the log: “Read Flex environment and matching ProgId TEAPluginQTP.TEAFlexAgentQTP.

How to access cfc on your Coldfusion server from flex app on a separate server.

Coldfusion 7.0.2 added flex feature support, hence you can access your cfc service from flex app. See a good article by Kyle about how this works at here.

The above article described how to access cfc using RemoteObject in flex app when your cfc and mxml pages are both on the same Coldfusion server. If you have your cfc services in an existing Coldfusion app, and you want to create new flex app on a remote server, how do you access the existing cfc services now? Here we will go through the steps to make that configuration work.

The reason the example works in above article is because CF 7.0.2 implemented gateway to access AMF, and by default a destination/channel is defined in CF app WEB-INF/flex/services-config.xml. When running the flex app on a remote server, we will need to use flex app gateway instead, and configure destination/channel in the flex app.

Let us use the example in the above article, download to your machine.

1. Extract HelloWorld.cfc to your Coldfusion app root. For me, it is C:\flex\jrun4\servers\cfusion\cf702. Here, cfusion is a server instance, /cf702 is the context root. It uses port 8300.

2. Extract folder HelloWorld_ro to your flex app root. For me, it is C:\flex\jrun4\servers\default\samples2, default is a server instance, /samples2 is the context root. It uses port 8700.

3. Copy the following and Paste it into your flex app WEB-INF/flex/remoting-config.xml, inside the <service> tag, parallel to other destination tag.

<destination id=”ColdFusion”><channels> <channel ref=”my-cfamf”/> </channels> <properties> <source>*</source> </properties> </destination>

4. Copy the following and Paste into your flex app\’s WEB-INF/flex/services-config.xml, inside <channels> tag, parallel to other channel-definition.

<channel-definition id=”my-cfamf” class=”mx.messaging.channels.AMFChannel”> <endpoint uri=”http://{}:{server.port}{context.root}/flex2gateway/” class=”flex.messaging.endpoints.AMFEndpoint”/> <properties> <polling-enabled>false</polling-enabled> <serialization> <instantiate-types>false</instantiate-types> </serialization> </properties> </channel-definition>

5. Define your endpoint. You can configure the destination in servicees-config.xml. See above channel-definition you just added. You can change uri=”http://{}:{server.port}{context.root}/flex2gateway/” to point to your real server name and port. For this example, it is http://linIp:8300/cf702/flex2gateway.

Or you can override it in your RemoteObject tag:

<mx:RemoteObject endpoint=”http://linIp:8300/cf702/flex2gateway/”
source=”HelloWorld”><mx:method name=”sayHelloString” result=”handleStringResult(event)” fault=”” /></mx:RemoteObject>

6. Make sure both Coldfusion and flex server are running.

7. run HelloWorld_ro.mxml either from flex builder or by request
http://localhost:8700/samples/HelloWorld_ro/ HelloWorld_ro.mxml,
you should see a button with label "get String Remote Object", click on it, you should see "Hello World!" displayed on top of the button.

8. If you are using standalone Coldfusion with default install, then put HelloWorld.cfc under C:\CFusionMX7\wwwroot. Note the context root now is /. If you are using port 8500 for this server, then your endpoint would be:

Note, step 3 to step 6 is to configure channel in the configuration files. You can also assign channels on the client at run time by creating a ChannelSet object that contains one or more Channel objects, and assigning the ChannelSet to a service componen. See flex doc for details.