<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Lin Lin</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/" />
<modified>2008-08-12T21:47:26Z</modified>
<tagline></tagline>
<id>tag:weblogs.macromedia.com,2008:/lin//8</id>
<generator url="http://www.movabletype.org/" version="3.16">Movable Type</generator>
<copyright>Copyright (c) 2008, lin</copyright>
<entry>
<title>How to turn on debug trace in Flex</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2008/08/how_to_turn_on.html" />
<modified>2008-08-12T21:47:26Z</modified>
<issued>2008-08-12T21:38:45Z</issued>
<id>tag:weblogs.macromedia.com,2008:/lin//8.15046</id>
<created>2008-08-12T21:38:45Z</created>
<summary type="text/plain">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...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>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:<br />
<strong>1. From server side:</strong><br />
In the services-config.xml, set the logging level to debug, and set filters to include the service you need:</p>

<p>   &lt;target class="flex.messaging.log.ConsoleTarget" level="debug"&gt;<br />
            &lt;properties&gt;<br />
                &lt;prefix&gt;[Flex hotfix2] &lt;/prefix&gt;<br />
                &lt;includeDate&gt;true&lt;/includeDate&gt;<br />
                &lt;includeTime&gt;true&lt;/includeTime&gt;<br />
                &lt;includeLevel&gt;true&lt;/includeLevel&gt;<br />
                &lt;includeCategory&gt;true&lt;/includeCategory&gt;<br />
            &lt;/properties&gt;<br />
            &lt;filters&gt;<br />
                &lt;pattern&gt;Endpoint.*&lt;/pattern&gt;<br />
               &lt;pattern&gt;Service.*&lt;/pattern&gt;<br />
               &lt;pattern&gt;Protocol.*&lt;/pattern&gt;<br />
                &lt;pattern&gt;Message.*&lt;/pattern&gt;<br />
                &lt;pattern&gt;DataService.*&lt;/pattern&gt;<br />
                &lt;pattern&gt;Configuration&lt;/pattern&gt;<br />
            &lt;/filters&gt;<br />
        &lt;/target&gt;</p>

<p>See available pattern in doc:<br />
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=services_logging_3.html</p>

<p><strong>2. To turn on trace in JGroup:</strong><br />
in jgroups-tcp.xml, add  &lt;TRACE/&gt; tag just before the &lt;/config&gt; line :</p>

<p>&lt;config&gt;<br />
     ....<br />
    &lt;TRACE/&gt;<br />
&lt;/config&gt;</p>

<p><strong>3. To turn on from client-side:</strong><br />
Make sure flashlog.txt is enabled, i.e, have the following setting in mm.cfg <br />
TraceOutputFileEnable=1<br />
ErrorReportingEnable=1<br />
See more details in the doc <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=logging_04.html">here</a><br />
There is a good blog regarding mm.cfg <a href="http://blogs.adobe.com/penguin.swf/2008/08/secrets_of_the_mmscfg_file_1.html">here</a> as well.</p>

<p><br />
Then in your flex app, add the following tag:<br />
&lt;mx:TraceTarget/&gt; <br />
</p>]]>

</content>
</entry>
<entry>
<title>Tips for working with time zone in flex app</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2008/04/tips_for_workin.html" />
<modified>2008-04-04T22:24:27Z</modified>
<issued>2008-04-04T21:49:15Z</issued>
<id>tag:weblogs.macromedia.com,2008:/lin//8.14853</id>
<created>2008-04-04T21:49:15Z</created>
<summary type="text/plain">1. Understand how date and time are determined by flex (player on the client machine) From flex doc we can see: &quot;The Date class lets you retrieve date and time values relative to universal time (Greenwich mean time, now called...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p><strong>1. Understand how date and time are determined by flex (player on the client machine)</strong><br />
From flex doc we can see: <br />
"The Date class lets you retrieve date and time values relative to universal time (Greenwich mean time, now called universal time or UTC) or relative to local time, which is determined by the local time zone setting on the operating system that is running Flash Player. "</p>

<p>This mean if one user's machine is using "Automatically adjust clock for daylight saving changes",  the time displaied in flex app may be different  with another user who is running the same flex app without “Automatically adjust clock for daylight saving changes” on his machine.</p>

<p>"Automatically adjust clock for daylight saving changes" can be checked from<br />
Control Panel --> Date and time -->Time Zone.</p>

<p> <strong>2. Understand how date and time are determined by Java ( On server machine)</strong><br />
 1). The JVM determines the correct Coordinated Universal Time (UTC) by comparing the QUTCOFFSET value to the local time for the system <br />
The JVM returns the correct local time to the system by using the Java system property user.timezone.<br />
The default value for QUTCOFFSET is zero (+00:00).<br />
The QUTCOFFSET value allows the JVM to determine the correct value for the local time. For example, the value for QUTCOFFSET to specify central standard time (CST) is -6:00. To specify central daylight time (CDT), QUTCOFFSET has a value of -5:00.<br />
The user.timezone Java system property uses UTC time as the default value. Unless you specify a different value, the JVM recognizes UTC time as the current time.<br />
See more details in <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzaha/gettime.htm">here</a></p>

<p>2). you need correct patches for Java to get correc date and time. </p>

<p>   -- There is a patch for jdk  you may want to double check:<br />
<a href="http://sunsolve.sun.com/search/document.do?assetkey=1-26-102836-1">http://sunsolve.sun.com/search/document.do?assetkey=1-26-102836-1</a><br />
   -- if you are using Solaris, you may need this patch<br />
<a href="http://sunsolve.sun.com/search/document.do?assetkey=1-26-103044-1">http://sunsolve.sun.com/search/document.do?assetkey=1-26-103044-1</a><br />
  -- if you are using 1.4.2_10 or lower version of JDK, you need this patch<br />
<a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400722">http://kb.adobe.com/selfservice/viewContent.do?externalId=kb400722</a></p>

<p> 3). To verify your time zone setting in JDK, read this<br />
<a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/WebSphere_Application_Server/1173447.html ">http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/WebSphere_Application_Server/1173447.html </a> <br />
Download time.jsp from there, and run it on your server. <br />
To change timezone setting in Java, you can use java arg:<br />
-Duser.timezone=America/Los_Angeles<br />
If you are using Jrun as app sever, this can be change in JRun_install/bin/jvm.config file:<br />
java.args=-Xms32m -Xmx384m -Dsun.io.useCanonCaches=false -Duser.timezone=Etc/UCT</p>

<p><strong>3. synchronize time znoe on client and server</strong><br />
If you want to enter time in the client’s local time - regardless of the timezone your in at the time of data entry, and keep the date in UTC zone on both server and client side, <a href="http://flexblog.faratasystems.com/?p=289">see example</a> <br />
 <br />
Note, don’t forget you also need to set JAVA VM timezone to UTC for this example.<br />
</p>]]>

</content>
</entry>
<entry>
<title>How to access flex app over https but connect to backend using http</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2008/04/how_to_access_f.html" />
<modified>2008-04-03T19:58:26Z</modified>
<issued>2008-04-03T19:08:35Z</issued>
<id>tag:weblogs.macromedia.com,2008:/lin//8.14850</id>
<created>2008-04-03T19:08:35Z</created>
<summary type="text/plain">Many application needs to be accessed over secure connection, but only need to connect to the backend using non-secure connection, or vice versa. How do we accomplish that? Secure connections can talk to secure and non-secure endpoints. Non-secure connections can...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>Many application needs to be accessed over secure connection, but only need to connect to the backend using non-secure connection, or vice versa. How do we accomplish that?</p>

<p>Secure connections can talk to secure and non-secure endpoints. Non-secure connections can only talk to non-secure endpoints.  So you will need to configure your channel differently.</p>

<p>1. If the app is requested over https and then use http to connect to backend:</p>

<p>&lt;channel-definition id="my-amf-secure" class="mx.messaging.channels.<strong>SecureAMFChannel</strong>"&gt;<br />
            &lt;endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.<strong>AMFEndpoint</strong> "/&gt;<br />
          &lt;properties&gt;<br />
     &lt;add-no-cache-headers&gt;false&lt;/add-no-cache-headers&gt;<br />
    &lt;/properties&gt;   <br />
&lt;/channel-definition&gt;</p>

<p>2. If the flex app is requested over http, then using https to connect backend:<br />
&lt;channel-definition id="my-amf" class="mx.messaging.channels.<strong>SecureAMFChannel</strong>"&gt;<br />
            &lt;endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.<strong>SecureAMFEndpoint</strong>"/&gt;<br />
          &lt;properties&gt;<br />
     &lt;add-no-cache-headers&gt;false&lt;/add-no-cache-headers&gt;<br />
    &lt;/properties&gt;   <br />
        &lt;/channel-definition&gt;</p>

<p>3. For LCDS 2.5 and 2.5.1, the configuration would be enough.<br />
   For FDS 201, you need to apply the hotfix build 168076 as well.  You can get the build 168076 from flex Tech support.<br />
</p>]]>

</content>
</entry>
<entry>
<title>How to apply chart  license to flex 3</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2008/03/how_to_apply_ch.html" />
<modified>2008-03-12T23:40:36Z</modified>
<issued>2008-03-12T23:12:19Z</issued>
<id>tag:weblogs.macromedia.com,2008:/lin//8.14784</id>
<created>2008-03-12T23:12:19Z</created>
<summary type="text/plain">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...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>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 <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_2.html">http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_2.html</a><br />
Also see  Blog entries:<br />
<a href="http://raghuonflex.wordpress.com/2008/02/19/changes-in-flex-beta-3-licensing-model/">http://raghuonflex.wordpress.com/2008/02/19/changes-in-flex-beta-3-licensing-model/</a><br />
<a href="http://raghuonflex.wordpress.com/2008/02/20/how-to-apply-the-data-visualization-license-on-command-line-in-flex-3/">http://raghuonflex.wordpress.com/2008/02/20/how-to-apply-the-data-visualization-license-on-command-line-in-flex-3/</a></p>

<p>Basically, here are the things you need to know:<br />
<strong>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. </strong><br />
<strong>2.	To apply the license from FB3</strong>, go to Help --> Manage flex license, then type in the license key. It should look like this: 1377-xxxx-xxxx-xxxx-xxxx-xxxx.<br />
3.	<strong>To apply the license in flex-config.xml:</strong><br />
&lt;flex-config&gt;   <br />
&lt;licenses&gt;<br />
     &lt;license&gt;<br />
       &lt;product&gt;flexbuilder3&lt;/product&gt;<br />
       &lt;serial-number&gt;1377-xxxx-xxxx-xxxx-xxxx-xxxx&lt;/serial-number&gt;<br />
     &lt;/license&gt;<br />
   &lt;/licenses&gt;</p>

<p>                &lt;compiler&gt;<br />
                ...<br />
                &lt;/compiler&gt;<br />
&lt;/flex-config&gt;</p>

<p><strong>4.	To apply the license in license.properties file:</strong><br />
The path to the license.properties file for various OS are changes for flex 3, they are now at:<br />
1)."../Documents and Settings/All Users/Application Data/Adobe/Flex" directory on Windows <br />
2)."Library/Application Support/Adobe/Flex" directory on MAC <br />
3)."$HOME/.adobe/Flex" on Linux<br />
</p>]]>

</content>
</entry>
<entry>
<title>Accessing Spring beans from flex (FDS)</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/accessing_sprin.html" />
<modified>2007-02-24T00:13:29Z</modified>
<issued>2007-02-23T00:04:42Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13217</id>
<created>2007-02-23T00:04:42Z</created>
<summary type="text/plain"><![CDATA[1. What is Spring? Why do we care about Spring? Christophe Coenraets &#160;&lsquo; s 30 minute test drive provides good answer to these questions. See details here. 2. Spring Configuration You can follow the steps described by Christophe or Jeff...]]></summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p><strong>1. What is Spring? Why do we care about Spring?</strong> <br>
      <a href="http://coenraets.org/blog">Christophe Coenraets </a>&#160;&lsquo; s <a href="http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/">30 minute test drive </a>provides good answer to these questions. See details <a href="http://weblogs.macromedia.com/lin/index.htm">here</a>.<br>
      <br>
      <strong>2. Spring Configuration</strong><br>
      You can follow the steps described by Christophe or <a href="http://weblogs.macromedia.com/lin/README.txt">Jeff Vroom</a>, or you can follow the steps below which provide easier access to the required jars. <br>
      1). Download <a href="http://weblogs.macromedia.com/lin/spring.jar">spring.jar</a> and <a href="http://weblogs.macromedia.com/lin/flex-spring-factory.jar">flex-spring-factory.jar</a> to your machine, and put them into your flex app&rsquo;s WEB-INF/lib directory. <br>
    2). Add the following into your flex app&rsquo;s WEB-INF/web.xml file, inside &lt;web-app&gt; tag.</p>
  <blockquote>
    <p>&lt;context-param&gt;<br>
&#160;&#160;&#160;&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;<br>
&#160;&#160;&#160; &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;<br>
&lt;/context-param&gt;<br>
&#160;&lt;listener&gt;<br>
&#160;&#160;&#160; &lt;listener-class&gt; org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt;<br>
&lt;/listener&gt;</p>
    </blockquote>
  <p>3). Add the following into to WEB-INF\flex\services-config.xml inside &lt;services-config&gt; tag: <br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;factories&gt;<br>
&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;factory id=&quot;spring&quot; class=&quot;flex.samples.factories.SpringFactory&quot;/&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/factories&gt;<br>
  4). If you are using JRun as app server, set the following in WEB-INF\jrun-web.xml to avoid parser conflicting:<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jrun-web-app&gt;<br>
&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;load-system-classes-first&gt;
    true&lt;/load-system-classes-first&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/jrun-web-app&gt;&#160; <br>
  Now you are ready to use flex to access Spring beans.&#160;<br><br>
    <strong>3. Create Spring beans </strong></p>
  <p>We are going to use the sample code in <a href="http://weblogs.macromedia.com/lin/singleManagedObject.zip">singleManagedObject.zip</a>. To understand the code and configuration, see &quot;&quot;<a href="http://weblogs.macromedia.com/lin/archives/flex_2/fds/index.cfm">How to get Single Managed Objects from a specified remote destination</a>&quot;. In that example, we access data from DataService using an Assembler <a href="http://weblogs.macromedia.com/lin/MyAssembler.java">MyAssembler.java</a>. &#160;With the Assembler, we should be able to access Spring beans, right? Well, we are just a couple of steps away. </p>
  <p>1). Create an interface (<a href="http://weblogs.macromedia.com/lin/MyDAO.java">MyDAO.java</a>)</p>
  <p>Because we are trying to access Spring beans, we need to add an interface that represents all the methods we are going to use. From <a href="http://weblogs.macromedia.com/lin/MyService.java">MyService.java</a> we can see that there are only two methods for this sample, so MyDAO.java is going to be very simple:&#160;</p>
  <p>package myfds;&#160;</p>
  <p>import java.util.Collection;</p>
  <p>import java.util.List;</p>
  <p>import org.springframework.dao.DataAccessException;&#160;</p>
  <p>public interface MyDAO {&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;	public List getProducts()&#160; throws DataAccessException ;</p>
  <p>&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; public MyBean getProduct(int myid)&#160; throws DataAccessException ;</p>
  <p> } </p>
  <p>&#160;</p>
  <p>2). Modify MyService.java and MyAssembler.java</p>
  <p>--- copy MyService.java and save it as <a href="http://weblogs.macromedia.com/lin/MyServiceSpring.java">MyServiceSpring.java</a></p>
  <p>Change the class to extends JdbcDaoSupport and implements the interface:</p>
  <p>import org.springframework.dao.DataAccessException;</p>
  <p>import org.springframework.jdbc.core.JdbcTemplate;</p>
  <p>import org.springframework.jdbc.core.RowMapper;</p>
  <p>import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;</p>
  <p>import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;</p>
  <p>import org.springframework.jdbc.core.namedparam.SqlParameterSource;</p>
  <p>import org.springframework.jdbc.core.support.JdbcDaoSupport;</p>
  <p>public class MyServiceSpring extends JdbcDaoSupport implements MyDAO {</p>
  <p>......</p>
  <p>--- copy MyAssembler.java and save it as <a href="http://weblogs.macromedia.com/lin/MyAssemblerSpring.java">MyAssemblerSpring.java</a></p>
  <p>Change the class with setMyDAO():</p>
  <p>import flex.data.assemblers.AbstractAssembler;</p>
  <p>public class MyAssemblerSpring extends AbstractAssembler {</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; private MyDAO myDAO;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void setMyDAO(MyDAO myDAO) {</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.myDAO = myDAO;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
  <p>........</p>
  <p>3). Compile your java code</p>
  <p>Remember to include spring.jar and flex-messaging.jar in the classpath,</p>
  <p>C:\flex\jrun4\servers\default\samples2\WEB-INF\classes&gt;javac -classpath ./;C:\fl<br />
  ex\jrun4\servers\default\samples2\WEB-INF\lib\spring.jar;C:\flex\jrun4\servers\d<br />
  efault\samples2\WEB-INF\lib\flex-messaging.jar&#160; -Xlint myfds/*.java</p>
  <p>Now we have the spring bean that we can access from flex, we need to register it with our flex app, and configure flex destination to point to the Spring factory. </p>
  <p><strong><br />
  4. Spring beans registration and flex destination configuration</strong></p>
  <p>1). Create applicationContext.xml and put it under your flex app&rsquo;s WEB-INF directory. Here is the applicationContext.xml for this example:</p>
  <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</p>
  <p>&lt;!DOCTYPE beans PUBLIC &quot;-//SPRING//DTD BEAN//EN&quot; &quot;http://www.springframework.org/dtd/spring-beans.dtd&quot;&gt;</p>
  <p>&lt;beans&gt;</p>
  <p>&lt;!--define a data source to connect to your database --&gt;</p>
  <p>&lt;bean id=&quot;<strong>dataSource</strong>&quot; class=&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;&gt;</p>
  <p>&#160;&#160;&#160; &lt;property name=&quot;driverClassName&quot; value=&quot;org.hsqldb.jdbcDriver&quot;/&gt;</p>
  <p>&#160;&#160;&#160; &lt;property name=&quot;url&quot; value=&quot;jdbc:hsqldb:hsql://localhost/flexdemodb&quot;/&gt;</p>
  <p>&#160;&#160;&#160; &lt;property name=&quot;username&quot; value=&quot;sa&quot;/&gt;</p>
  <p>&#160;&#160;&#160; &lt;property name=&quot;password&quot; value=&quot;&quot;/&gt;</p>
  <p>&lt;/bean&gt;</p>
  <p>&lt;!-- define your service (methods) with a reference to dataSource --&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;bean id=&quot;<strong>myServiceSpring</strong>&quot; class=&quot;myfds.MyServiceSpring&quot;&gt;</p>
  <p>&#160;&#160;&#160; &#160;&#160;&#160; &lt;property name=&quot;<strong>dataSource</strong>&quot; ref=&quot;dataSource&quot;/&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/bean&gt; </p>
  <p>&lt;!-- define assembler with reference (dependency) to myServiceSpring --&gt;</p>
  <p>&lt;bean id=&quot;myAssemblerSpring&quot; class=&quot;myfds.MyAssemblerSpring&quot; singleton=&quot;true&quot;&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--the property name myDAO should match the variable for interface MyDAO defined in MyAssemblerSpring--&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name=&quot;myDAO&quot; ref=&quot;<strong>myServiceSpring</strong>&quot;/&gt;</p>
  <p>&#160;&lt;/bean&gt;</p>
  <p>&lt;/beans&gt;</p>
  <p>&#160;<strong>Note,</strong> <strong>myServiceSpring</strong> will be the soruce name you use in the destination you define below. </p>
  <p>2). Configure destination</p>
  <p>We have registered Spring factory in WEB-INF\flex\services-config.xml in step 2 #3).</p>
  <p>&#160;&lt;factory id=&quot;<strong>spring</strong>&quot; class=&quot;flex.samples.factories.SpringFactory&quot;/&gt;</p>
  <p>Therefore we need to point the destination to spring factory. Add the following into WEF-INF\flex\Data-management-config.xml: </p>
  <p>&lt;destination id=&quot;<strong>myfds-spring</strong>&quot;&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &lt;adapter ref=&quot;java-dao&quot; /&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;properties&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;factory&gt;<strong>spring</strong>&lt;/factory&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;source&gt;myAssemblerSpring&lt;/source&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &lt;metadata&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;identity property=&quot;myid&quot;/&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/metadata&gt;</p>
  <p>&#160;&#160;&#160; &lt;/properties&gt;</p>
  <p>&lt;/destination&gt;</p>
  <p>Now, in flex mxml page, you can access the destination myfds-spring by doing something like this: </p>
  <p>&lt;mx:DataService id=&quot;<strong>ds</strong>&quot; destination=&quot;<strong>myfds-spring</strong>&quot; result=&quot;getData1(event)&quot;/&gt;</p>
  <p>And call the methods in the Spring beans by using <strong>ds</strong>.getItem({myid:2})&#160;&#160;&#160;&#160; </p>
  <p>If you run 	<a href="http://weblogs.macromedia.com/lin/myDataServiceSpring.mxml">myDataServiceSpring.mxml</a>, you can get data from different method by click on different button. </p>
  <p>Here is the <a href="http://weblogs.macromedia.com/lin/simpleSpring.zip">simpleSpring.zip</a> which incdules all the code. <br/>
  </p>
	]]>

</content>
</entry>
<entry>
<title>How to get Single Managed Objects from a specified remote destination </title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/how_to_get_sing.html" />
<modified>2007-02-23T18:40:19Z</modified>
<issued>2007-02-21T22:50:04Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13203</id>
<created>2007-02-21T22:50:04Z</created>
<summary type="text/plain">Flex Campaign for Java Developers has launched on Monday, Feb. 13. This is good news for java developer who would like to make Flex app work with backend database.Christophe Coenraets &amp;#160;&apos;s 30 minute test drive &amp;#160;provides many examples about how...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>FDS</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p><a href="http://weblogs.macromedia.com/flexteam/">Flex Campaign for Java Developers</a> has launched on Monday, Feb. 13. This is good news for java developer who would like to make Flex app work with backend database.<a href="http://coenraets.org/blog">Christophe Coenraets </a>&#160;'s <a href="http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/">30 minute test drive </a>&#160;provides many examples about how to manipulate data with FDS. You can download the test drive server <a href="http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/">here</a>. </p>
  <p>Once you extracted fds-tomcat.zip , you can see flex samples that integrate with <a href="http://www.activemq.org">ActiveMQ</a> , <a href="http://www.springframework.org/">Spring</a> 2 , <a href="http://www.hibernate.org/">Hibernate</a> 3.2 , and <a href="http://hsqldb.org/">HSQLDB</a> 1.8 . &#160;Sample 8 under testdrive folder demonstrated how to retrieve/create/update/delete data using FDS. The flex client code displays the collection managed objects retrieved from backend. However, users may have difficulty to get Single Managed Objects from flex app. It may not be clear how the identity is passed to the method. I was asked to create a sample to get Single Managed Objects from a specified remote destination. I am putting a simplified version of the example here to demonstrate how to do that.</p>
  <p><strong>1. Create java Assembler</strong></p><p>
    1). Create your bean (<a href="http://weblogs.macromedia.com/lin/MyBean.java">MyBean.java</a>)<br>
    First you create your bean with the data field you needed, and set/get method for each of them.&#160; <br>
    2). Create <a href="http://weblogs.macromedia.com/lin/MyService.java">MyService.java</a> for your methods <br>
    For simplicity, &#160;I have only defined two methods:<br>
    <strong>&#160;&#160;&#160;&#160;	getProducts() </strong>&#160;-- retrieve all data, returns a list <br>
    <strong>&#160;&#160;&#160;&#160; getProduct(int myid)</strong> --- retrieve data with myid as identity,&#160; returns a single Object. <br>
    3). Create an Assembler (<a href="http://weblogs.macromedia.com/lin/MyAssembler.java">MyAssembler.java</a>)<br>
    <The assembler extends AbstractAssembler class which is defined in flex-messaging.jar  
  

      public class MyAssembler extends AbstractAssembler {<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; public Collection fill(List fillArgs) {<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyService service = new MyService();<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return service.getProducts();<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>
      public Object getItem(Map identity) {<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyService service = new MyService();<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyBean mybean =&#160; service.getProduct(((Integer) identity.get(&quot;myid&quot;)).intValue());<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(&quot;mybean.myid=&quot;+mybean.myid);<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return mybean;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
  <p>As we can see, <strong>fill()</strong> method calls <strong>getProducts()</strong>, and <strong>getItem()</strong> calls <strong>getProduct()</strong> from MyService. <br>
      Note,&#160; MyBean mybean =&#160; service.getProduct(((Integer) identity.get(&quot;<strong>myid</strong>&quot;)).intValue());<br>
      Here myid is the identity field.&#160; It must match the identity property in your destination configuration:<br>
&lt;identity property=&quot;<strong>myid</strong>&quot;/&gt;
</p>
    </p>
    <p><strong>2. Compile your java code.</strong><br>
  As we mentioned before, MyAssembler extends AbstractAssembler which is defined in flex-messaging.jar. So when you compile the java code, you must include flex-messaging.jar in your classpath. &#160;This jar is included in your fds flex app&rsquo;s \WEB-INF\lib directory. &#160;For example:<br>
 C:\flex\jrun4\servers\default\samples2\WEB-INF\classes&gt;javac -classpath ./;C:\fds-tomcat\webapps\ROOT\WEB-INF\lib\flex-messaging.jar -Xlint myfds/*.java</p>
  <p><strong>3. Mapping client-side objects to Java objects</strong><br>
  This is a very important step, but easy to forget. Here are some key points from doc:<br>
  1). To represent a server-side Java object in a client application, you use the [RemoteClass(alias=&quot; &quot;)] metadata tag to create an ActionScript object that maps directly to the Java object. You specify the fully qualified class name of the Java class as the value of alias. This is the same technique that you use to map to Java objects when using RemoteObject components.<br>
  2).You can use the [RemoteClass] metadata tag without an alias if you do not map to a Java object on the server, but you do send back your object type from the server. Your ActionScript object is serialized to a Map object when it is sent to the server, but the object returned from the server to the clients is your original ActionScript type.<br>
  3). To create a managed association between client-side and server-side objects, you also use the [Managed] metadata tag or explicitly implement the mx.data.IManaged interface. The [Managed] metadata tag ensures that the managed Contact object supports the proper change events to propagate changes between the client-based object and the server-based object.<br>
    See <a href="http://weblogs.macromedia.com/lin/MyBean.as">MyBeam.as</a> for code details. </p>
  <p><strong>4. configure destination in data-management-config.xml</strong><br>
  add the following into your<strong> data-management-config.xml</strong>, parallel to other destination definition. <br>
&lt;destination id=&quot;<strong>myfds</strong>&quot;&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;adapter ref=&quot;java-dao&quot; /&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;properties&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;source&gt;<strong>myfds.MyAssembler</strong>&lt;/source&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;scope&gt;application&lt;/scope&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;metadata&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;identity property=&quot;<strong>myid</strong>&quot;/&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/metadata&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;network&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;session-timeout&gt;20&lt;/session-timeout&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;paging enabled=&quot;false&quot; pageSize=&quot;10&quot; /&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;throttle-inbound policy=&quot;ERROR&quot; max-frequency=&quot;500&quot;/&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;throttle-outbound policy=&quot;REPLACE&quot; max-frequency=&quot;500&quot;/&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/network&gt;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/properties&gt;<br>
  &#160;&#160;&#160; &lt;/destination&gt;<br>
 &#160;<br>
  <strong>Note: </strong>source should point to the full qualified class name of your assembler.<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Identity should match the identity you are passing in Assembler:<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;	MyBean mybean =&#160; service.getProduct(((Integer) identity.get(&quot;<strong>myid</strong>&quot;)).intValue());
</p><p><strong>5. create flex page to display the data (<a href="http://weblogs.macromedia.com/lin/myDataService.mxml">myDataSerivce.mxml</a>)</strong><br>
  1).&#160; Retrieve data <br>
  &#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mx:ArrayCollection id=&quot;mydata1&quot;/&gt; <br>
  &#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mx:DataService id=&quot;ds1&quot; destination=&quot;myfds&quot; result=&quot;getData(event)&quot;/&gt; <br>
  &#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mx:Button&#160; id=&quot;bt1&quot; label=&quot;Get data from fill method&quot; click=&quot;ds1.fill(mydata1)&quot;/&gt;&#160;<br>
  &#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;mx:Button&#160; id=&quot;bt2&quot; label=&quot;Get data from getItem method&quot; click=&quot;ds1.getItem({myid:2})&quot;/&gt;<br>
    --- We first define a DataService ds1 which is mapped to destination named <strong>myfds</strong>. This should match &lt;destination&#160; id=&quot;<strong>myfds</strong>&quot;&gt; in <strong>data-management-config.xml</strong>.<br>
    ---We call ds1.fill(mydata1) to populates an ArrayCollection <strong>mydata1</strong>, and use it as dataProvider of the datagrid. <br>
&#160;&#160;&#160; &lt;mx:DataGrid dataProvider=&quot;{<strong>mydata1</strong>}&quot;&#160; width=&quot;300&quot; height=&quot;100%&quot; &gt;<br>
---We use ds1.getItem({<strong>myid:2</strong>}) to get single Object based on the dentity myid &#160;we passed into getItem.<br>
2). We use a result handler getData(event) to handle the data we retrieved from DataService. This will make sure that your event is trigged after the data has returned. &#160;
    Now let&rsquo;s look at resulte handler getData():<br>
&#160;&#160; private function getData(event:ResultEvent):void{<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(myButton == &quot;bt1&quot;){<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;prodId.text = event.result[1].prodID;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;firstName.text = event.result[1].firstName;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;lastName.text = event.result[1].lastName;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; prodId.text = event.result.prodID;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; firstName.text = event.result.firstName;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastName.text = event.result.lastName;&#160;&#160;&#160;&#160; <br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br>
&#160;&#160;&#160;}<br>
  Because fill() method returns an ArrayCollection, getItem() returns a single object, so we have to treat it differently. To figure out which method is called by the user, we add EventListener to the button, and record the button id.<br>
&#160;&#160;&#160;&#160; private function init():void{<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bt1.addEventListener(MouseEvent.CLICK,clickHandler);<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bt2.addEventListener(MouseEvent.CLICK,clickHandler);<br>
&#160;&#160;&#160;&#160;&#160;&#160;}<br>
&#160;&#160;&#160;&#160;&#160; private function clickHandler(event:MouseEvent):void{<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myButton = event.currentTarget.id;<br>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;<br>
Now, when you click different button, different data will be displayed in &quot;User Details&quot; TitleWindow.</p>
<p><strong>6. To test the sample:</strong></p>
<p>1). &#160;Unzip <a href="http://weblogs.macromedia.com/lin/singleManagedObject.zip">singleManagedObject.zip </a> to your machine . Put myfds folder under your flex app&rsquo;s WEB-INF/classes directory. Put myDataService.mxml and MyBean.as under you flex app&rsquo;s root directory.<br>
      2). Double check the step 4 mentioned above. Restart your flex app server if needed. <br>
      3). Run myDataService.mxml, click on the two buttons and see different data displayed. </p>
<p><br>
      <strong>7. Troubleshooting</strong></p>
<p>If there are no erros client side, but can't get data to retrun from the server side, check the following:</p>
<p>1). double check step 4 mentioned above, make sure your destinatio id, sourceand identity property are defined correctly. Also, make sure your database connection is valid and qurey statement are correctly retrieving data.</p>
<p>2). Trun on server side debug bysetting log level to debug in services-config.xml: </p>
<p> &lt;target class=&quot;flex.messaging.log.ConsoleTarget&quot; level=&quot;Debug&quot;&gt;</p>
]]>

</content>
</entry>
<entry>
<title>Flex builder silent install</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/flex_builder_si.html" />
<modified>2007-02-16T21:15:18Z</modified>
<issued>2007-02-16T20:02:34Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13157</id>
<created>2007-02-16T20:02:34Z</created>
<summary type="text/plain">My colleague Nick Watson put the instruction together, I am just posting his work here without changing any words. Overview · These steps are for silent installations on Windows - InstallAnywhere doesn&apos;t support silent installation fully on OS X. ·...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>My colleague Nick Watson put the instruction together, I am just posting his work here without changing any words. </p>

<p><strong>Overview </strong></p>

<p>·        These steps are for silent installations on Windows - InstallAnywhere doesn't support silent installation fully on OS X. </p>

<p>·        There are two installers nested within the Flex Builder win installers, so they must be run in series for a silent operation: first the metainstaller, and then the individual installer (either standalone or plugin). </p>

<p>·        One easy way to install silently is with a batchfile, as shown in the example below. </p>

<p><br />
<strong>Create a properties file for each installer </strong></p>

<p>·        For a standalone installation the properties file must be named standalone.properties </p>

<p>·        For a plugin installation the properties file must be named plugin.properties </p>

<p>·        To run a standalone installation using the batchfile attached, place the file standalone.properties in the same folder with the batchfile and the installer </p>

<p>·        The simple properties file example: </p>

<p>INSTALLER_UI=silent<br />
USER_INSTALL_DIR=c:$/$fb2</p>

<p># Player installer choices<br />
INSTALL_FLASH85_OCX=1<br />
INSTALL_NETSCAPE_PLUGIN=1</p>

<p><br />
<strong>Sample batch file for silent installation </strong></p>

<p>REM Place this batchfile in the same folder with the PFTW installer. <br />
@echo off <br />
mkdir %TMP% <br />
mkdir %TMP%\installprops </p>

<p><strong>copy standalone.properties %TMP%\installprops\standalone.properties </strong></p>

<p>REM <br />
REM Extract the FB archive - match the exe filename below with the actual installer <br />
FLXB_2.0_Win_WWE.exe /s /f%TMP% /a -i silent </p>

<p><br />
<strong>Running the batchfile </strong></p>

<p>·        Make sure the batchfile is in the same folder as the FB installer, along with the properties file you created earlier </p>

<p>·        Simply double-click the batchfile to run it </p>

<p>·        Alternatively, you can open a cmd window to the folder that contains the batchfile, and run it by typing "silent" to invoke it </p>

<p>·        Idiosyncrasies: </p>

<p>o       The batchfile will appear as if it is complete before the installer is really finished </p>

<p>o       You'll know the silent install has really completed when the ColdFusion folder opens at the end. </p>

<p>The switches below are specifically for use with Package from the Web download:</p>

<p>/s tells FB to run silently<br />
/f tells FB where to unpack its archive<br />
/a allows FB to pass arguments to the next installer in the series: the InstallAnywhere metainstaller.</p>

<p>The next set of args are aimed at InstallAnywhere:<br />
-i silent tells InstallAnywhere to run silently, resulting in the default Standalone installation selection in the metainstaler.</p>]]>

</content>
</entry>
<entry>
<title>Tips for using Flex Builder 2 (part 2)</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/tips_for_using_2.html" />
<modified>2007-05-04T15:39:32Z</modified>
<issued>2007-02-16T19:12:58Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13156</id>
<created>2007-02-16T19:12:58Z</created>
<summary type="text/plain"><![CDATA[1. Install FB 2 on Vista get &quot;Power User permissions required&quot; error, even while logged on as admin This was an issue in FB2 but it&rsquo;s fixed in FB 2.0.1. Just in case you encounter this problem, here is a...]]></summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex Builder 2</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p><strong>1. Install FB 2 on Vista get &quot;Power User permissions required&quot; error, even while logged on as admin</strong></p>
  <p>This was an issue in FB2 but it&rsquo;s fixed in FB 2.0.1. Just in case you encounter this problem, here is a Workaround:</p>
  <p>1). Click the OK button in the &quot;Power User permissions required&quot;&#160;&#160; dialog to cancel &amp; dismiss the installer</p>
  <p>2). &quot;Program Compatibility Assistant&quot; dialog will appear</p>
  <p>3). Select the first option, &quot;Re-install using recommended settings&quot; to re-launch the installer</p>
  <p>For other installation problem, check the following first:</p>
  <p>--Check account privilege, including read-write permission </p>
  <p>--Check java version on the system. FB install includes a JRE; you don&rsquo;t have to have JRE/JDK installed previously. However, if you have an existing JRE/JDK which is not a valid version for FB on the system, then it can cause problem during the installation. Use &ldquo;java -version&rdquo; command to verify the version of Java your system is using. The installer has to be able to find a valid jre/jdk installation. </p>
  <p>--Check Direct X version . If the installation hangs, see <a href="http://www.adobe.com/go/badaccab">http://www.adobe.com/go/badaccab</a></p>
  <p><strong>2. Flex builder silent install</strong></p>
  <p>See instruction <a href="http://weblogs.macromedia.com/lin/archives/2007/02/flex_builder_si.cfm">here  </a></p>
  <p><strong>3. xerces conflict when running FB with IBM JVM.</strong></p>
  <p>When using FB with WebSphere Development environment or IBM RSA 7.0,&#160; xerces conflict may cause the service not start correctly. &#160;To use the IBM jvm1.4.2 with the Flex Builder compiler and the Flex command-line compilers, you must ensure that the JVM loads the version of xerces supplied with Flex instead of the one in the IBM JVM. To do this, add the following JVM argument to the FlexBuilder.ini (Eclipse.ini in the plug-in configuration) file:<br />
  -Xbootclasspath/a:{path-to-flex-install}/lib/xercesImpl.jar</p>
  <p>Standalone example:<br />
      -Xbootclasspath/a:C:/Program Files/Adobe/Flex Builder 2/Flex SDK 2/lib/xercesImpl.jar </p>
  <p>Plug-in example:<br />
  -Xbootclasspath/a:C:\Program Files\Adobe\Flex Builder 2 Plug-in\Flex SDK 2\lib\xercesImpl.jar </p>
  <p><strong>4. Install FB 2.0.1 with IBM RSA/
RAD  7.0</strong></p>
  <p>1). FB plugin should be installed on top of the existing RSA/Eclipse configuration. </p>
  <p>One potential workaround, for people who have already installed FB ahead of RSA, would be to disable com.adobe.feature.core using Eclipse Configuration Manager before installing RSA, and then re-enable it afterwards.</p>
  <p>2). You may see error like the following: </p>
  <p>java.lang.IllegalAccessError: cannot access superclass org/apache/xerces/util/XMLAttributesImpl$Attribute from class org/apache/xerces/util/XMLAttributesMMImpl$AttributeMMImpl </p>
  <p> See #3 for xerces conflict issue.</p>
  <p>3). if 
RSA is installed as standalone with  FB plugin on top of it, then you have to 
launch with IBM's shortcut icon (which uses IBM JVM).</p>
  <p>If you install RSA's plugin and FB plugin on top of Eclips, then you can launch it with either IBM shortcut icon or FB shortcut icon.</p>
  <p>4). To make RAD 7.0 work with FB 2.0.1, See 
    <a href="http://www.adobe.com/go/kb401623">http://www.adobe.com/go/kb401623</a> . </p>
  <strong>5. Eclipse Help trouble</strong> <br>
Sometimes you may see error:"Help cannot be displayed. The embedded application server could not run help web application. Check the log for details."<br>
This is a log4j conflicting issue. See 
<a href="http://lists.apple.com/archives/Java-dev/2004/Sep/msg00482.html">http://lists.apple.com/archives/Java-dev/2004/Sep/msg00482.html</a><br>
<br>
<strong>6. Location of FB log file</strong><br>
The easiest way to find the log file is from FB Help. <br>
Go to Help-->product details.. -->Configuration details -->view error log<br>
If "view error log" is inactive, that means there is no error log exist. The error log will only be created after FB compiler found error in the code. <br>
Here are the location of my log file on Window:<br>
For standalone:<br>
C:/Documents and Settings/<user>/My Documents/Flex Builder 2/.me
tadata/.plugins/org.eclipse.ui.workbench/log<br>
For plugin<br>
C:/eclipse/.metadata/.plugins/org.eclipse.ui.workbench/log<br>
On Mac:<br>
<user>/Documents/Flex Builder 2/.metadata/.log<br>

If you don't see .metadata folder on Mac, you can do the following to show hidden files:<br>
In the <strong>Terminal</strong> type in:<br>
defaults write com.apple.finder AppleShowAllFiles TRUE<br>
killall Finder
<br>]]>

</content>
</entry>
<entry>
<title>Flex 2 and Accessibility</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/flex_2_and_acce.html" />
<modified>2007-02-09T22:58:52Z</modified>
<issued>2007-02-09T21:45:06Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13116</id>
<created>2007-02-09T21:45:06Z</created>
<summary type="text/plain">One improtant thing to keep in mind is that Accessibility support doesn&apos;t happen automatically. You have to tell flex you want Accessibility support in your app, and you need to implement it accordingly. Here are all the relevant links regarding...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex 2.0.1</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[One improtant  thing to keep in mind is that Accessibility support doesn't happen automatically. You have to tell flex you want Accessibility support in your app, and you need to implement it accordingly. Here are all the relevant links regarding <a href="http://www.adobe.com/macromedia/accessibility/features/flex/">Accessibility.</a> <br><br>

<strong>Enabling Application Accessibility </strong><br>
There are multiple ways to enabling application accessibility. See <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#appaccessibility">here </a> for details. If you are using flex builder 2 to compile your app, from Flex builder, go to project--->properties ---> flex compiler, check the box "generate accessible SWF file".  <br><br>

<strong>Flex Accessibility Best Practices</strong><br>
Flex includes 22 components with built-in accessibility support. But this does not mean you can simply compile you app with accessibility enabled, and your app will meet all the requirement. You need to make sure you have taking care of <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#readingorder">Controlling Reading Order</a>, <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#providinginstructions">Providing Instructions </a>, <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#keyboardaccess">Ensuring Keyboard Access</a>, <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#providecaptions">Providing Captions</a>, <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#providetext">Providing Text Equivalents</a>, and <a href="http://www.adobe.com/macromedia/accessibility/features/flex/best_practices.html#color">Using Color Wisely</a>. <br><br>
<strong>
Using Flex with JAWS</strong><br>
In order to most effectively use the JAWS screen reader with an Adobe Flex application, users must <a href="http://www.adobe.com/macromedia/accessibility/features/flex/jaws.html">download and install scripts</a>.
]]>

</content>
</entry>
<entry>
<title>Example of Designing Loosely Coupled Flex 2 Components --- pass data from main to child component</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/example_of_desi.html" />
<modified>2007-02-16T21:32:01Z</modified>
<issued>2007-02-08T22:16:03Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13109</id>
<created>2007-02-08T22:16:03Z</created>
<summary type="text/plain"> There is a good article regarding Designing Loosely Coupled Flex 2 Components. This is a good place to learn about different ways to design your components in Flex 2. On the third page of this article, it demonstrated how...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex 2.0.1</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[
<p>There is a good article regarding <a href="http://mxdj.sys-con.com/read/276919_1.htm">Designing Loosely Coupled Flex 2 Components</a>. This is a good place to learn about different ways to design your components in Flex 2. On the third page of this article, it demonstrated how to Create Custom Event ActionScript Classes for sending complex data with an example. This example shows how to send data to the parent page by dispatch an event from the child component.  What if you want to dispatch the event from the parent page, and pass the data into the child?  Here is a simple example to show how we can accomplish that.</p>
  <p><strong>1. create a customer event ActionScript class: </strong></p>
  <p>In order to pass extra data via event, a customer event class is needed. We do this by extends existing Flex event classes and inherit all the events of the base class. &#160;Here we create myEvent.as to pass selectedAlbum with the event. </p>
  <p><strong>myEvent.as:</strong></p>
  <p>package<br />
      {<br />
   &#160;&#160;&#160;&#160; import flash.events.Event;<br />
   &#160;&#160;&#160;&#160; import mx.core.Application;</p>
  <p> &#160;&#160;&#160;	public class myEvent extends Event<br />
 &#160;&#160; {<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public var myAlbum:String;<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public function myEvent(selectedAlbum:String,type:String) {<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; super(type);<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.myAlbum = selectedAlbum;<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Application.application.lb.text=myAlbum;<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public override function clone():Event{<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return new myEvent(myAlbum,type);<br />
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
 &#160; }<br />
  }</p>
  <p><strong>2.&#160; Create the main application:</strong></p>
  <p>The main application has a datagrid. The goal is to be able to display data in a new state based on selected row in the datagrid. The follwoing two&#160;handlers are the most improtant:</p>
  <p>1).datagrid's itemClick event handler itemClickEvent():&#160; this will get the selected row and value of selectedAlbum. </p>
  <p>2).eventHandler(): this will display the new state, dispatch event myEvent (must make sure the event is dispatched after the child is created), and pass selectedAlbum to the child component. We reference the child component as &lt;v:looselyCoupledChild /&gt;. </p>
  <p><strong>Note</strong>, eventObj = new myEvent(selectedAlbum,&quot;<strong>passID</strong>&quot;);</p>
  <p>Here,<strong> passID </strong>is the event name we will define in the Metadata of the child component:</p>
  <p>&lt;mx:Metadata&gt;<br />
[Event(name=&quot;<strong>passID</strong>&quot;, type=&quot;myEvent&quot;)]<br />
&lt;/mx:Metadata&gt;</p>
  <p>main flex page <strong>looselyCoupled.mxml</strong>:</p>
  <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</p>
  <p>&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; xmlns:v=&quot;*&quot; layout=&quot;vertical&quot;&gt;</p>
  <p>&lt;!--This example passes selectedAlbum to child.mxml by listening&#160; to myEvent --&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
  <p>&lt;mx:Script&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;![CDATA[&#160;&#160;&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; import flash.events.EventDispatcher;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; import mx.events.ListEvent;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; import mx.collections.ArrayCollection;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [Bindable]</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public var selectedAlbum:String;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public var eventObj:myEvent;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [Bindable]</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private var initDG:ArrayCollection = new ArrayCollection([</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {Artist:'Pavement', Album:'Slanted and Enchanted',&#160;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Price:11.99, SalePrice: true },</p>
  <p>&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{Artist:'Pavement', Album:'Brighten the Corners',&#160;&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;	Price:11.99, SalePrice: false }</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ]);&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; private function itemClickEvent(event:ListEvent):void {</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedAlbum=event.currentTarget.selectedItem.Album;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; eventObj = new myEvent(selectedAlbum,&quot;passID&quot;); </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.dispatchEvent(eventObj);</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lb1.text=eventObj.myAlbum;</p>
  <p>&#160;&#160;&#160;&#160;&#160; }</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private function eventHandler(stateView:String):void{</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//the stateView must be created before the event dispatch.</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.currentState = stateView; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dispatchEvt();</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private function dispatchEvt():void{</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; eventObj = new myEvent(selectedAlbum,&quot;passID&quot;);</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.dispatchEvent(eventObj);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ]]&gt;</p>
  <p>&lt;/mx:Script&gt;</p>
  <p>&lt;mx:Label id=&quot;lb&quot;&#160; text=&quot;show selectedAlbum -- from myEvent&quot;/&gt;</p>
  <p>&lt;mx:Label id=&quot;lb1&quot;&#160; text=&quot;show selectedAlbum -- from eventObj.myAlbum&quot;/&gt;</p>
  <p>&lt;mx:DataGrid&#160; id=&quot;dg&quot; dataProvider=&quot;{initDG}&quot;&#160; itemClick=&quot;itemClickEvent(event)&quot;&gt;</p>
  <p>&lt;/mx:DataGrid&gt;</p>
  <p>&lt;mx:Button x=&quot;117&quot; y=&quot;240&quot; label=&quot;dispaly Album&quot;&#160; id=&quot;bt&quot; click=&quot;eventHandler('child')&quot; /&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &lt;mx:states&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&lt;mx:State name=&quot;child&quot;&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&lt;mx:AddChild position=&quot;lastChild&quot;&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;v:looselyCoupledChild /&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&lt;/mx:AddChild&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&lt;/mx:State&gt;</p>
  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &lt;/mx:states&gt;&#160;&#160;&#160;&#160;&#160; </p>
  <p>&lt;/mx:Application&gt;</p>
  <p> <strong>3. create the child component:</strong></p>
  <p>In the child component, we need to add event listener to listen to <strong>passID </strong>as following: &#160; Application.application.addEventListener(&quot;passID&quot;, passIDHandler);</p>
  <p><strong>looselyCoupledChild.mxml</strong>: </p>
  <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
    &lt;mx:Panel xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; width=&quot;400&quot; height=&quot;300&quot; initialize=&quot;initHandler()&quot; &gt;<br />
    &lt;mx:Metadata&gt;<br />
[Event(name=&quot;passID&quot;, type=&quot;myEvent&quot;)]<br />
&lt;/mx:Metadata&gt; <br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[</p>
<p> import mx.core.Application;<br />
  import myEvent;<br />
  private function initHandler():void{<br />
  Application.application.addEventListener(&quot;passID&quot;, passIDHandler);<br />
  }</p>
  <p> private function passIDHandler(event:myEvent):void {<br />
  tinput.text = event.myAlbum;<br />
  }</p>
  <p> ]]&gt;<br />
  &lt;/mx:Script&gt;</p>
  <p> &lt;mx:Label text=&quot;Album you selected from event:&quot; x=&quot;26&quot; y=&quot;10&quot;/&gt;<br />
&lt;mx:TextInput x=&quot;107&quot; y=&quot;8&quot; id=&quot;tinput&quot; /&gt;<br />
&lt;mx:Label x=&quot;291&quot; y=&quot;10&quot; text=&quot;Album you selected from selectedAlbum:&quot;/&gt;<br />
&lt;mx:TextInput x=&quot;372&quot; y=&quot;8&quot; text=&quot;{Application.application.selectedAlbum}&quot;/&gt;<br />
  <br />
&lt;/mx:Panel&gt;</p>
  <p><strong>Note</strong>, Application.application.addEventListener(&quot;passID&quot;, passIDHandler);
&#160; This means we will always have a reference to the child. If you are concerned about memory issue, you should check and destroy the event when it is done. If you don't want to destroy the event, you can set weakRef to true in addEventListener. </p>
  <p>To test the sample, </p>
  <p>1). run looselyCoupled.mx, and select a row. You will see the Album name displayed on top of the datagrid.</p>
  <p>2). click on &quot;dispaly Album&quot; Button, you will see the Album name has passed into the child component. </p>
  <p>3). select another row in the datagrid, you will see the value in the child component is changed as well. </p>
]]>

</content>
</entry>
<entry>
<title>Links to nice flex 2 examples </title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/02/links_to_nice_f.html" />
<modified>2007-02-09T22:46:12Z</modified>
<issued>2007-02-03T00:00:52Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.13074</id>
<created>2007-02-03T00:00:52Z</created>
<summary type="text/plain"> 1. Design loosely coupled Flex 2 components http://mxdj.sys-con.com/read/276919_1.htm 2. Export datagrid to Excel: If manfully copy from a datagrid and paste to Excel is sufficient , see: http://www.cflex.net/showFileDetails.cfm?ObjectID=298&amp;Object=File&amp;ChannelID=1 http://mannu.livejournal.com/348299.html#cutid1 If you need the application to generate the excel for...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex 2</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[  <p><strong>1. Design loosely coupled Flex 2 components</strong><br>	
      <a href="http://mxdj.sys-con.com/read/276919_1.htm">http://mxdj.sys-con.com/read/276919_1.htm</a><br>
      <br>
      <strong>2. Export datagrid to Excel:</strong><br>
  If manfully copy from a datagrid and paste to Excel is sufficient , see: <br>
  <a href="http://www.cflex.net/showFileDetails.cfm?ObjectID=298&Object=File&ChannelID=1">http://www.cflex.net/showFileDetails.cfm?ObjectID=298&Object=File&ChannelID=1</a> <br>
  <a href="http://mannu.livejournal.com/348299.html#cutid1">http://mannu.livejournal.com/348299.html#cutid1</a><br>
  If you need the application to generate the excel for you ,  see:  <a href="http://cfsilence.com/blog/client/index.cfm/2007/1/24/Exporting-A-Flex-DataGrid-To-Excel">http://cfsilence.com/blog/client/index.cfm/2007/1/24/Exporting-A-Flex-DataGrid-To-Excel</a><br>
  <a href="http://www.meutzner.com/blog/index.cfm/2006/12/8/Export-to-Excel-with-Flex-20-and-ColdFusion">http://www.meutzner.com/blog/index.cfm/2006/12/8/Export-to-Excel-with-Flex-20-and-ColdFusion</a><br>
  <br>
  <strong>3.Internationalizing Flex Apps</strong><br>
  <a href="http://ajaxdevelopersjournal.com/read/316376.htm">http://ajaxdevelopersjournal.com/read/316376.htm</a><br> 
  <a href="http://mannu.livejournal.com/300260.html">http://mannu.livejournal.com/300260.html</a><br>
  <br>
  <strong>4. Coloring the Background of Cells</strong><br>
  <a href="http://weblogs.macromedia.com/pent/archives/flex_solutions/index.cfm">http://weblogs.macromedia.com/pent/archives/flex_solutions/index.cfm</a>  </p>
  <p><strong>5. 
    <a href="http://blog.739saintlouis.com/2007/02/05/scaling-an-image-with-smoothing/">Scaling an image with smoothing</a></strong>
<a href="http://blog.739saintlouis.com/">blog.739saintlouis.com</a><br>
      </p>
<strong>6. Unicode support</strong> <br>
In order for it to work, you have to make sure <br><strong>1).</strong>your font must support those characters. <br><strong>2). </strong>you need to set the correct  fontFamily, <br><strong>3).</strong> you need to set <a href="http://livedocs.macromedia.com/flex/2/docs/00000792.html">character ranges </a><br>

Here are couple of simple examples:<br>
<a href="http://www.mail-archive.com/flexcoders@yahoogroups.com/msg06651.html">http://www.mail-archive.com/flexcoders@yahoogroups.com/msg06651.html</a><br>
<a href="http://www.mail-archive.com/flexcoders@yahoogroups.com/msg41352.html">http://www.mail-archive.com/flexcoders@yahoogroups.com/msg41352.html</a>More to come ....]]>

</content>
</entry>
<entry>
<title>MouseWheel support on MacOS X</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/01/mousewheel_supp.html" />
<modified>2007-01-24T17:41:04Z</modified>
<issued>2007-01-24T17:17:07Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.12990</id>
<created>2007-01-24T17:17:07Z</created>
<summary type="text/plain">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...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex on Mac</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>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:<br />
http://reefscape.net/?p=13<br />
http://blog.pixelbreaker.com/2006/11/08/flash/swfmacmousewheel/</p>]]>

</content>
</entry>
<entry>
<title>Tips for configuring QTP with flex 2.0.1</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/01/tips_for_config.html" />
<modified>2007-02-03T00:30:18Z</modified>
<issued>2007-01-23T17:45:19Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.12971</id>
<created>2007-01-23T17:45:19Z</created>
<summary type="text/plain"> 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...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex 2.0.1</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[
  <p><strong>Key info:</strong></p>
  <p>1. must have QTP 9.1, flex 2.0.1, IE 6+, and install the QTP plug-in.</p>
  <p> 2. must recomiple the app in flex 2.0.1 with automation testing libraries.        </p>
  <p>3. must put the swf and html file to the QTP machine.          </p>
  <p>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. </p>
  <ul>
    <li>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.</li>
  </ul>
  <ol>
    <li>Make sure you installed QTP 9.1, not 9.0.    </li>
  <li>Make sure you installed flex 2.0.1 , and your flex app should be recompiled using flex 2.0.1.      </li>
  <li> Make sure you have installed the QTP plug-in. You can download it from our <a href="http://www.adobe.com/cfusion/tdrc/index.cfm?loc=en%5Fus&product=flex">website</a>. You will need to register to login the page first. After you login into the page, scroll down and you will see &quot;Flex Automation Package&quot;. From there you can download Flex_Automation.zip. After you unzip the zip file, you can see QTP_Plugin_Installer.exe. Run that exe file and that will install the plugin. <strong>Note</strong>, To verify if you have installed the plug-in or not, go to your registry, and search for entry of <strong>TEAPluginIE.dll</strong> and <strong>TEAPluginQTP.dll</strong>.  If those dlls are not in the registry, then your plug-in has not been installed correctly.</li>
  </ol>
  <ul>
    <li> If you have above installation and configuration, but the QTP does not record the flex app, then check the following:      </li>
  </ul>
<ol>
    <li>	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:  http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15507      </li>
  <li>	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 <a href="http://www.adobe.com/support/documentation/en/flex/2/install.html#at">here</a>.      </li>
<li>	If you request your flex app from a browser, you have to <strong>use the html wrapper file. Do not accessing the swf directly,</strong> 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<a href="http://download.macromedia.com/pub/documentation/en/flex/2/flex2_testing_with_mercury_qtp.pdf"> Testing Flex Applications with Mercury QuickTest Professional </a> for more details.</li>
</ol>
<ul>
  <li> If you still have trouble getting up and running with Flex QTP plugin, you can create a log by following the steps below:      </li>
</ul>
<ol>
  <li> Go to the mercury installation/bin directory say: &quot;C:\Program Files\Mercury Interactive\QuickTest Professional\bin&quot; and run MicLogSetting.exe .      </li>
<li> Select the log settings as:
                  Level: MicLogLevelDebug2
                  Folder:C:\Program Files\Mercury Interactive\QuickTest Professional\
      Selected Categories:LogCatPackTEA</li>
<li> Run QTP and record a
                  flex application say flexstore.html      </li>
<li> A log file would have been generated like C:\Program Files\Mercury Interactive\QuickTest Professional\MicLogFile_QTPro_pid1912_11_32_32.html</li>
<li> Check whether you are seeing the following in the log: "Read Flex environment and matching ProgId TEAPluginQTP.TEAFlexAgentQTP. </li>
</ol>
]]>

</content>
</entry>
<entry>
<title>How to access cfc on your Coldfusion server from flex app on a separate server. </title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2007/01/how_to_access_c.html" />
<modified>2007-01-23T21:57:28Z</modified>
<issued>2007-01-13T00:55:04Z</issued>
<id>tag:weblogs.macromedia.com,2007:/lin//8.12875</id>
<created>2007-01-13T00:55:04Z</created>
<summary type="text/plain">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...</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>
<dc:subject>Flex 2</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>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 <a href="http://www.adobe.com/devnet/flex/articles/helloworld.html">here</a>. 
  
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. 
  
</p>
    <p>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.</p>
    <p>Let us use the example in the above article http://www.adobe.com/devnet/flex/articles/helloworld.html, download helloworld_cfc.zip to your machine.</p>
    <p>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.</p>
    <p>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.</p>
    <p>3.	Copy the following and Paste it into your flex app WEB-INF/flex/remoting-config.xml, inside the &lt;service&gt; tag, parallel to other destination tag.   </p>
    <p>&lt;destination id="ColdFusion"&gt;&lt;channels&gt; &lt;channel ref="my-cfamf"/&gt; &lt;/channels&gt; &lt;properties&gt; &lt;source&gt;*&lt;/source&gt; &lt;/properties&gt; &lt;/destination&gt;</p>
    <p> 4.	Copy the following and Paste into your flex app\'s WEB-INF/flex/services-config.xml, inside &lt;channels&gt; tag, parallel to other channel-definition.</p>
    <p> &lt;channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel"&gt; &lt;endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/&gt; &lt;properties&gt; &lt;polling-enabled&gt;false&lt;/polling-enabled&gt; &lt;serialization&gt; &lt;instantiate-types&gt;false&lt;/instantiate-types&gt; &lt;/serialization&gt; &lt;/properties&gt; &lt;/channel-definition&gt;</p>
    <p> 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.name}:{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:</p>
    <p>&lt;mx:RemoteObject endpoint="http://linIp:8300/cf702/flex2gateway/"
          id="myService"
          destination="ColdFusion"
          source="HelloWorld"&gt;&lt;mx:method name="sayHelloString" result="handleStringResult(event)"  fault="Alert.show(event.fault.message)" /&gt;&lt;/mx:RemoteObject&gt;</p>
    <p>6.	Make sure both Coldfusion and flex server are running.</p>
    <p>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 &quot;get String Remote Object&quot;, click on it, you should see &quot;Hello World!&quot; displayed on top of the button.</p>
    <p>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:
                      endpoint="http://linIp:8500/flex2gateway/"  </p>
    <p><strong>Note</strong>, 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<a href="http://livedocs.macromedia.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=ent_services_config_097_04.html"> flex doc </a>for details. </p>
    <p>&#160;
    </p>
]]>
 
</content>
</entry>
<entry>
<title>Using FDS 2 with Tomcat</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/lin/archives/2006/09/using_fds_2_wit.html" />
<modified>2006-09-26T22:26:15Z</modified>
<issued>2006-09-26T21:02:09Z</issued>
<id>tag:weblogs.macromedia.com,2006:/lin//8.12036</id>
<created>2006-09-26T21:02:09Z</created>
<summary type="text/plain">When using FDS 2 with Tomcat, there are extra files to install and configure. Please see flex install doc 1. About JOTM: You must install JOTM from http://jotm.objectweb.org, and make sure you copy the JAR files from jotm-root/lib to tomcat-root/common/lib....</summary>
<author>
<name>lin</name>
<url>http://weblogs.macromedia.com/lin/</url>
<email>lin@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/lin/">
<![CDATA[<p>When using FDS 2 with Tomcat, there are extra files to install and configure. Please see <a href="http://www.adobe.com/support/documentation/en/flex/2/install.html#tomcat">flex install doc</a></p>

<p>1. About JOTM:<br />
You must install JOTM from http://jotm.objectweb.org, and make sure you copy the JAR files from jotm-root/lib to tomcat-root/common/lib. The jar files are:</p>

<p>    * jotm.jar<br />
    * jotm_jrmp_stubs.jar<br />
    * ow_carol.jar<br />
    * jta-spec1_0_1.jar<br />
    * jts1_0.jar<br />
    * objectweb-datasource.jar<br />
    * xapool.jar<br />
    * howl.jar<br />
    * commons-cli-1.0.jar<br />
    * connector-1_5.jar</p>

<p>To get JOTM configurate correctly with flex samples, see   <a href="http://www.silver-island.com/arts/flex/FDS2.0_on_Tomcat/contact_manager_2.html">this link.</a><br />
If you need to configure JDBC and transactions in  Tomcat with JOTM, see <a href="http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html">this link.</a></p>

<p>2. About JMX<br />
If you are using jdk 1.5. and up, then you don't need to do anything about this. You will only need to install JMX if you are using JDK 1.4.x.</p>]]>

</content>
</entry>

</feed>