• Home
  • About Me
  • AIR Central
  • AS3 Libs
  • Books
  • Flex Central
  • Resources
  • The Guru's
  •  

    Flex 2 ExternalInterface API Sample

    October 26th, 2005

    Using the new ExternalInterface API we can now communicate seamlessy from Flex to Javascript and from Javascript to Flex. Check out the sample by running the code below.

    This sample requires the Flash 8.5 player.

    Run This Code

    View & Download Source Code


    Setup for FlexBuilder 2 - ColdFusion adapter

    October 25th, 2005

    Here is what I didto get the new FlexBuilder 2 - ColdFusion adapter.

    My CF server is localhost:8500 so your config could be a little different.

    After following the directions from macromdeia:
    To install the FlexBuilder 2-ColdFusion Adapter:

    1. Extract the files in the cfzorn.zip file as follows:
      File Extract to:
      hf701-61119.jar cfusion\lib\updates (mine was at C:\CFusionMX7\lib\updates)
      crossdomain.xml your web root (for example wwwroot, or inetpub\wwwroot) (mine was at C:\CFusionMX7\wwwroot)
      flex-services.xml
      flex-services.xsd
      coldfusionsamples.xml
      WEB-INF\flex (mine was at C:\CFusionMX7\wwwroot\WEB-INF)
      Note: The WEB-INF\flex directory does not already exist.
    2. Modify the web.xml file, which is located in the WEB-INF directory by doing the following:.
      1. In the section of the file that contains the servlet configurations, add the following:
        <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <servlet-class>coldfusion.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.messaging.MessageBrokerServlet</param-value> <param-name>services.configuration.file</param-name> <param-value>/WEB-INF/flex/flex-services.xml</param-value> </init-param> <load-on-startup>14</load-on-startup> </servlet>
      2. In the section of the file that contains the servlet-mappings, add the following:
        <servlet-mapping id="macromedia_mapping_0"> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/flex2gateway/*</url-pattern> </servlet-mapping>
    3. If your ColdFusion server uses something other than port 8500:
      1. Open the file C:\CFusionMX7\wwwroot\Web-INF\flex\flex-services.xml.
      2. Change the following to specify the port you are using:
        <endpoint uri="/flex2gateway/" port="8500" in flex-services.xml
      3. Save the file.
    4. Restart the ColdFusion server.

    I then did the following:
    Created a com folder and then a local folder within com.
    I then created a cfc named TestCFC.cfc with the following code:
    <cfcomponent>
    <cffunction name=”getTestString” returntype=”string”>
    <cfreturn “Test from ColdFusion”>
    </cffunction>
    </cfcomponent>

    I added the following to my coldfusionsamples.xml file:
    <destination id=”TestCFC”>
    <properties>
    <source>com.local.TestCFC</source>
    <lowercase-keys>true</lowercase-keys>
    </properties>
    <channels>
    <channel ref=”my-cfamf”/>
    </channels>
    </destination>

    I then created an mxml file with the following code:
    <?xml version=”1.0″ encoding=”utf-8″?>
    <mx:Application xmlns:mx=”http://www.macromedia.com/2005/mxml” xmlns=”*”>
    <mx:RemoteObject id=”testCFC”
    destination=”TestCFC”
    result=”mx.controls.Alert.show(’result = ‘ + event.result, ‘Result’)”
    fault=”mx.controls.Alert.show(’error = ‘ + event.fault, ‘Error’)”/>
    <mx:Canvas width=”100%” height=”100%”>
    <mx:Button click=”testCFC.getTestString()” label=”Get String” />
    </mx:Canvas>
    </mx:Application>

    Lastly I added the following to my Project -> Properties -> Flex Compiler:

    --services=C:\CFusionMX7\wwwroot\WEB-INF\flex\flex-services.xml

    Simple Email Validator

    October 20th, 2005

    Here is a simple Regular Expression email validator. This sample requires the Flash 8.5 player.
    You can also run it from the permanent link in the header of this page.
    Run This Code

    View & Download Source Code


    Flex Blog Reader

    October 19th, 2005

    I created a Flex Blog Reader that parses all of the Flex blogs posted at weblogs.macromedia.com. This is a Cairngorm v.99 application based on the macromedia simpleblog reader.
    Run This Code

    Download This Code


    OMNOVA Solutions

    October 18th, 2005

    A new entry has made it into the Flex Hall of Fame is the Design Center localed at http://www.omnova.com.
    This site shows excellent use of RIA and a nice clean design.
    Please nominate your choice for the next entry into the hall in the comments section.