<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Andrew Schwabe&apos;s Blog - Actionscript</title>
			<link>http://blog.schwabe.net/index.cfm</link>
			<description>Flex and CF and all things Wack.</description>
			<language>en-us</language>
			<pubDate>Wed, 08 Sep 2010 09:20:54 -0400</pubDate>
			<lastBuildDate>Mon, 15 Feb 2010 09:55:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>aschwabe@schwabe.net</managingEditor>
			<webMaster>aschwabe@schwabe.net</webMaster>
			
			
			
			
			
			<item>
				<title>Adobe Announces AIR/Flash support for Android Mobiles</title>
				<link>http://blog.schwabe.net/index.cfm/2010/2/15/Adobe-Announces-AIRFlash-support-for-Android</link>
				<description>
				
				Well, it is finally happening -- the rest of the world is moving on, right around the big iPhone road block.  With Android being a fast growing platform, and Adobe giving official support to build native Flash/Flex apps optimized for mobile processors, this puts the pressure on Apple again, to either bend to what consumers want, or face loss of market share.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>ipod/iphone</category>				
				
				<category>Flash</category>				
				
				<category>google</category>				
				
				<pubDate>Mon, 15 Feb 2010 09:55:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2010/2/15/Adobe-Announces-AIRFlash-support-for-Android</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>JavaScript Hack Enables Flash on iPhone</title>
				<link>http://blog.schwabe.net/index.cfm/2010/2/9/JavaScript-Hack-Enables-Flash-on-iPhone</link>
				<description>
				
				Ok, well it isn&apos;t exactly what we want, but it shows that the development community is thinking beyond Apple&apos;s stranglehold on iphone OS.  According to Wired, Tobias Schneider has written a javascript runtime engine for processing .swf files that is compatible with iphone.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Open Source</category>				
				
				<category>ipod/iphone</category>				
				
				<category>Flash</category>				
				
				<category>Actionscript</category>				
				
				<pubDate>Tue, 09 Feb 2010 12:41:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2010/2/9/JavaScript-Hack-Enables-Flash-on-iPhone</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Multi-web configuration for Railo 3.1 and BlazeDS</title>
				<link>http://blog.schwabe.net/index.cfm/2009/11/20/Multiweb-configuration-for-Railo-31-and-BlazeDS</link>
				<description>
				
				Seems like lots of people are having a problem with Railo configured for multiple websites on a single host, but also need to support AMF via BlazeDS.

The common symptom is when you restart railo services, sometimes you will get a big error instead of your web page that says something like:

&lt;code&gt;
MessageBroker failed to start: flex.messaging.config.ConfigurationException: MessageBroker already defined from MessageBrokerServlet with init parameter messageBrokerId = &apos;__default__&apos;
&lt;/code&gt;

Here is what I found to work for me:

1. Read this post by Roland Ringgenberg at &lt;a target=&quot;_new&quot; href=&quot;http://groups.google.com/group/railo/msg/230e12e0fc12c625&quot;&gt;the railo google group&lt;/a&gt; and follow the directions to install the java jar and edit the flex/services-config.xml file:

&lt;code&gt;
    &lt;services&gt;
        &lt;service-include file-path=&quot;remoting-config.xml&quot; /&gt;
        &lt;service-include file-path=&quot;proxy-config.xml&quot; /&gt;
        &lt;service-include file-path=&quot;messaging-config.xml&quot; /&gt;        
		&lt;service id=&quot;railoBootstrap&quot; class=&quot;railo.runtime.net.amf.RailoMessageBrokerBootstrapService&quot;&gt;
        	&lt;properties&gt;
            	&lt;messageBrokerId&gt;yourcustomBroker&lt;/messageBrokerId&gt;
            &lt;/properties&gt;
        &lt;/service&gt; 
    &lt;/services&gt;
&lt;/code&gt;

2. For me, railo runs on port 8600 internally, and I have IIS configured to serve up content.  BlazeDS however doesn&apos;t get mapped through IIS, so you need to talk on the native port (again, for MY configuration, YMMV).  So to access it, i needed to open TCP port 8600 through the firewall.

3. Once i could talk to the server over port 8600, I changed my flex app that uses remoting to point to http://myserver:8600/flashservices/gateway/ and eveyrthing worked great!

One other interesting observation... When using Flash remoting with CF7/8/9, you can talk to your CFCs and invoke methods that are set to &quot;public.&quot;  With BlazeDS, your methods need to be marked as &quot;remote&quot; to be accessible.  Minor syntax difference, but a huge impact on security.  make sure you secure your CFCs!
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Open Source</category>				
				
				<category>Railo</category>				
				
				<category>Actionscript</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 20 Nov 2009 12:54:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/11/20/Multiweb-configuration-for-Railo-31-and-BlazeDS</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flash on iPhone? Not really, but kind of, sorta...</title>
				<link>http://blog.schwabe.net/index.cfm/2009/10/13/Flash-on-iPhone-Not-really-but-kind-of-sorta</link>
				<description>
				
				At MAX, Adobe announced a way to build apps and deploy on iPhone.  Huzzah!  Isn&apos;t this what we have been asking for for a LOOOONG time?  Not really....
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>Rants</category>				
				
				<category>ipod/iphone</category>				
				
				<pubDate>Tue, 13 Oct 2009 12:36:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/10/13/Flash-on-iPhone-Not-really-but-kind-of-sorta</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CF United 09 Presentation Files - Google App Engine and Flex</title>
				<link>http://blog.schwabe.net/index.cfm/2009/8/13/CF-United-Presentation-Files</link>
				<description>
				
				Ok folks, here are my preso files for my CF United 2009 talk on Google App Engine and Flex.  Is this the final version?  Sure.  Until I change it.  I shall resist doing that...

&lt;object height=&quot;425&quot; width=&quot;550&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://slidesix.com/viewer/SlideSixViewer.swf?alias=294AndrewSchwabeGoogleAppEngineFlex&quot; /&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;/&gt;&lt;param name=&quot;scale&quot; value=&quot;noScale&quot;/&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot; /&gt;&lt;param value=&quot;transparent&quot; name=&quot;wmode&quot; /&gt;&lt;param value=&quot;quality&quot; name=&quot;best&quot; /&gt;&lt;embed src=&quot;http://slidesix.com/viewer/SlideSixViewer.swf?alias=294AndrewSchwabeGoogleAppEngineFlex&quot; allowscriptaccess=&quot;always&quot; allowFullScreen=&quot;true&quot; height=&quot;425&quot; width=&quot;550&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; quality=&quot;best&quot; /&gt;&lt;/object&gt;

Here is the powerpoint presentation download: &lt;a href=&quot;http://www.schwabe.net/294_Andrew_Schwabe_Google_App_Engine_Flex.ppt&quot;&gt;294_Andrew_Schwabe_Google_App_Engine_Flex.ppt&lt;/a&gt;

Here is the full download (warning, this is big!) Contains all 4 google app engine java projects, all 4 flex projects and the powerpoint file.  The download is big because of all the jar files.  I will try to have a USB key with me so if you want a super fun time instant copy instead of downloading it, I should be able to do that.

Full download (94MB, zipped): &lt;a href=&quot;http://www.schwabe.net/CFun09_GAE_Files.zip&quot;&gt;CFun09_GAE_Files.zip&lt;/a&gt;

For those of you web surfers interested -- demo 4 project includes a fix for allowing Flex app using AMF to retrieve Google Account information (using ajax and a custom auto servlet) so your Flex apps can determine if you are logged in, and get your user identifier if you are logged in.
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Open Source</category>				
				
				<category>Eclipse</category>				
				
				<category>google</category>				
				
				<category>Java</category>				
				
				<category>Actionscript</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 13 Aug 2009 01:42:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/8/13/CF-United-Presentation-Files</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Using Flex built in icons for custom components</title>
				<link>http://blog.schwabe.net/index.cfm/2009/5/6/Using-Flex-built-in-icons-for-custom-components</link>
				<description>
				
				I am a big supporter of &quot;simple first&quot; meaning, get the functionality done and perfect before you start dressing things up and make them fancy.  Flex supports this style of development by having a relitively pretty set of components to begin with, and you can substitute in what you want to change.

What if you are making a custom component, such as a Button, and you want an icon on the button.  You can open your graphics program and make your PNGs, or SWF files and make custom skins, or wouldn&apos;t it be great if you could just snag one of the built in icons from Flex&apos; SDK and use that?  Nice and simple to get you started.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<pubDate>Wed, 06 May 2009 18:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/5/6/Using-Flex-built-in-icons-for-custom-components</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flex + Google Analytics - Fix Error #1009: Cannot access a property or method of a null object</title>
				<link>http://blog.schwabe.net/index.cfm/2009/4/10/Flex--Google-Analytics--Fix-Error-1009-Cannot-access-a-property-or-method-of-a-null-object</link>
				<description>
				
				Google has released a library for Flash and Flex to embed google analytics calls into your Flash/Flex app.  You can find info and Google&apos;s sample code here: &lt;a href=&quot;http://code.google.com/apis/analytics/docs/tracking/flashTrackingSetupFlex.html&quot;&gt;http://code.google.com/apis/analytics/docs/tracking/flashTrackingSetupFlex.html&lt;/a&gt;.

Since I use Flex, thats all I will cover here.

When I implemented Google&apos;s code, I got the &quot;Error #1009: Cannot access a property or method of a null object&quot; error that seems to show up from time to time. I knew it had to do with google analytics, since it was a fully working app before I added GA.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>google</category>				
				
				<pubDate>Fri, 10 Apr 2009 17:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/4/10/Flex--Google-Analytics--Fix-Error-1009-Cannot-access-a-property-or-method-of-a-null-object</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Adobe Air: #2032 (and similar) error when trying to install an .AIR file</title>
				<link>http://blog.schwabe.net/index.cfm/2009/3/18/Adobe-Air-2032-and-similar-error-when-trying-to-install-an-AIR-file</link>
				<description>
				
				If you are building Adobe AIR applications and run into this vague error when using an &lt;a href=&quot;http://www.adobe.com/devnet/air/articles/badge_for_air.html&quot;&gt;install badge&lt;/a&gt; or &lt;a href=&quot;http://livedocs.adobe.com/flex/3/html/distributing_apps_3.html&quot;&gt;air.swf from within flex&lt;/a&gt;, it may be your web server that is the issue.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Windows 2003</category>				
				
				<category>Actionscript</category>				
				
				<category>Flash</category>				
				
				<pubDate>Wed, 18 Mar 2009 12:53:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/3/18/Adobe-Air-2032-and-similar-error-when-trying-to-install-an-AIR-file</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Manually adding bindings between objects in Flex/AS3</title>
				<link>http://blog.schwabe.net/index.cfm/2009/1/27/Manually-adding-bindings-between-objects-in-FlexAS3</link>
				<description>
				
				I recently needed to manually create bindings in AS3 code between objects, and since MXML ultimately all is just AS3, I figured there had to be a way to do it.  

&lt;b&gt;Binding in MXML&lt;/b&gt;

Lets look at the following code...
&lt;code&gt;
    &lt;mx:TextInput id=&quot;txtMyText?/&gt;
    &lt;mx:Label id=&quot;lblMyLabel? text=&quot;{txtMyText.text}&quot;/&gt;
&lt;/code&gt;

Here you bind the text property of the TextInput to the label&apos;s text property so wh you type in the textInput, it reflects in the label. 

&lt;b&gt;Binding in AS&lt;/b&gt;

The key to this is a class called BindingUtils in the mx.binding.utils package. You can use this class as below:
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Open Source</category>				
				
				<category>Flash</category>				
				
				<category>Actionscript</category>				
				
				<pubDate>Tue, 27 Jan 2009 12:53:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2009/1/27/Manually-adding-bindings-between-objects-in-FlexAS3</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Adobe Flash on the iPhone... finally ?</title>
				<link>http://blog.schwabe.net/index.cfm/2008/10/1/Adobe-Flash-on-the-iPhone-finally-</link>
				<description>
				
				According to several sources, during &lt;a href=&quot;http://www.flashonthebeach.com/&quot;&gt;Flash on the Beach&lt;/a&gt;, Adobe announced that it is &quot;actively developing&quot; a port of the Flash runtime to work on the iPhone.  It would be in Apple&apos;s best interest to help Adobe along with this process.

No dates or feature/compatibility information is available right now, but I certainly hope that Adobe takes into consideration that the Flash 9/10 support (as opposed to Flash &quot;lite&quot;) would open the doors of iphone development to Flex developers. 

Bringing Flash to the iphone will not only address a huge customer demand, but it might also put Apple in a better place to deal with &lt;a href=&quot;http://news.cnet.com/8301-13579_3-9911137-37.html&quot;&gt;Google android&lt;/a&gt; as it begins to grow and take on its own market strategy.

Sources quoted: http://blogs.pcworld.com/staffblog/archives/007842.html&lt;br&gt; 
http://www.flashmagazine.com/news/detail/flash_for_the_iphone_confirmed_at_fotb/&lt;br&gt;
http://itknowledgeexchange.techtarget.com/business-presentation/adobe-flash-on-iphoneipod-touch-another-advancement-for-mobile-business/&lt;br&gt;
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>ipod/iphone</category>				
				
				<category>Flash</category>				
				
				<pubDate>Wed, 01 Oct 2008 19:02:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/10/1/Adobe-Flash-on-the-iPhone-finally-</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>TaskCFC : Open Source Group Task Management is coming!</title>
				<link>http://blog.schwabe.net/index.cfm/2008/8/19/TaskCFC--Open-Source-Group-Task-Management-is-coming</link>
				<description>
				
				I have been working hard on a new project, to be released as open source called &quot;TaskCFC.&quot;  This is a group task management system that uses ColdFusion on the back end and Flex on the front end.  I am writing this since it seems there are no real easy to use/easy to customize group task mgt systems out there.  Ultimately this *WILL* be integrated with FusionDox, and may be integrated with Google apps and Google App Engine.
				 [More]
				</description>
						
				
				<category>FusionDox</category>				
				
				<category>Adobe Flex</category>				
				
				<category>Open Source</category>				
				
				<category>google</category>				
				
				<category>Actionscript</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 19 Aug 2008 15:23:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/8/19/TaskCFC--Open-Source-Group-Task-Management-is-coming</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flex &gt; CF &gt; Craigslist &gt; Google Maps Mashup</title>
				<link>http://blog.schwabe.net/index.cfm/2008/8/8/Flex--CF--Craigslist--Google-Maps-Mashup</link>
				<description>
				
				Here is one of several apps I have written recently that i&apos;ve been meaning to put on the blog. This app shows how Flex can bridge data from multiple sources.  Perform a keyword search, maybe search for an iphone, and this app will search craigslist, and show you the results displayed on a map of the city.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>google</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 08 Aug 2008 00:28:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/8/8/Flex--CF--Craigslist--Google-Maps-Mashup</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Dynamic RemoteObject defined by settings in an XML file</title>
				<link>http://blog.schwabe.net/index.cfm/2008/8/7/Dynamic-RemoteObject-defined-by-settings-in-an-XML-file</link>
				<description>
				
				In my CF United 2008 presentation on Charting with Flex and ColdFusion, I demonstrated a nifty actionscript function to dynamically create a remoteObject without needing to use services-config.xml.  (The code is nearly identical to code written by Mike Nimer, but lovingly frosted with glucose... rr tweaked for my needs)  I also mentioned that using this, it would be possible to have an external settings file read at runtime that defined your remote object endpoint, without needing to use an annoying services-config.xml file and allowing run-time configuration of your remote data services. 

Why would you want to do that? (you might ask...)  Well, the short answer is that you can re-configure the server that your app talks to without re-compiling your flex app, which is really important if you do any type of QA testing.

So this post is all about how to do that thing i just described.
				 [More]
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 07 Aug 2008 18:49:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/8/7/Dynamic-RemoteObject-defined-by-settings-in-an-XML-file</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>CF United 2008 Presentation Files</title>
				<link>http://blog.schwabe.net/index.cfm/2008/6/19/CF-United-2008-Presentation-Files</link>
				<description>
				
				Here are the presentation files and sample flex apps from my presentation on &amp;quot;Charting with CF and Flex&amp;quot; on Friday June 20, 2008.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.schwabe.net/RIA328_Charting_with_CF_and_Flex.zip&quot;&gt;RIA328_Charting_with_CF_and_Flex.zip&lt;/a&gt; (5.5M)
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<category>charting</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 19 Jun 2008 02:00:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/6/19/CF-United-2008-Presentation-Files</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Dispatching custom events from a Flex Module</title>
				<link>http://blog.schwabe.net/index.cfm/2008/4/29/Dispatching-custom-events-from-a-Flex-Module</link>
				<description>
				
				&lt;p&gt;I have been working to make my Flex applications more and more modular.&amp;nbsp; Flex now supports modular development with the ModuleManager so you can dynamically load and unload modules at runtime.&lt;/p&gt;
&lt;p&gt;There is reasonably good documentation online for how to load and unload basic modules, and even how to set public vars and call&amp;nbsp;public methods defined in modules after they are loaded.&amp;nbsp; There were not, however, any examples (that i could find anyway...) for having a module dispatch a custom event class, so that your application can catch and respond to the event.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Here is a basic outline of an app, a custom event class that stores some bits of information, and&amp;nbsp;a module that demonstrates dispatching the custom event class:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The main Flex app &amp;quot;SimpleModuleEvents.mxml&amp;quot; :&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;em&gt;&lt;strong&gt;&lt;em&gt;&lt;strong&gt;&lt;em&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;em&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;mx:Application xmlns:mx=&amp;quot;http://www.adobe.com/2006/mxml&amp;quot; &lt;br /&gt;
&amp;nbsp;creationComplete=&amp;quot;initApp()&amp;quot;&lt;br /&gt;
&amp;nbsp;layout=&amp;quot;absolute&amp;quot;&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;![CDATA[&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;import mx.controls.Alert;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;import net.schwabe.demos.CustomEvent;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;import mx.modules.*;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;import mx.events.ModuleEvent;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;public var myModuleInfo:IModuleInfo;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;private function initApp():void&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// load our module (but don&apos;t display yet)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myModuleInfo = ModuleManager.getModule(&amp;quot;modules/Dispatcher.swf&amp;quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myModuleInfo.addEventListener(ModuleEvent.READY, displayModuleHandler);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myModuleInfo.load();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// start listening for our custom event.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;addEventListener(&amp;quot;customEvent&amp;quot;, handleCustomEvent);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* Runs when the module is finished loading and is ready to display */&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;private function displayModuleHandler(event:ModuleEvent):void&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myPanel.addChild(myModuleInfo.factory.create() as DisplayObject);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;/* runs when the custom event is caught */&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;private function handleCustomEvent(event:CustomEvent):void&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Alert.show(&amp;quot;received event with data: &amp;quot; + event.myNumber + &amp;quot;=&amp;quot; + event.myString);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;nbsp;&amp;nbsp;]]&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;lt;mx:Panel id=&amp;quot;myPanel&amp;quot; width=&amp;quot;300&amp;quot; height=&amp;quot;300&amp;quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;/mx:Panel&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;lt;/mx:Application&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;The module&amp;nbsp;&amp;quot;Dispatcher.mxml&amp;quot; :&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;font color=&quot;#0000ff&quot; size=&quot;2&quot;&gt;&lt;font face=&quot;Arial&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;mx:Module xmlns:mx=&amp;quot;http://www.adobe.com/2006/mxml&amp;quot; layout=&amp;quot;vertical&amp;quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;![CDATA[&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;import net.schwabe.demos.CustomEvent;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;private function doEvent():void&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var myEvent:CustomEvent = new CustomEvent(&apos;customEvent&apos;,42,&apos;The answer to all life and everything&apos;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parentDocument.dispatchEvent(myEvent);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;]]&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;mx:HBox width=&amp;quot;100%&amp;quot; height=&amp;quot;100%&amp;quot; horizontalAlign=&amp;quot;center&amp;quot; verticalAlign=&amp;quot;middle&amp;quot;&amp;gt;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;mx:Button label=&amp;quot;Dispatch CustomEvent!&amp;quot; click=&amp;quot;doEvent()&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;lt;/mx:HBox&amp;gt;&lt;br /&gt;
&amp;lt;/mx:Module&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;The custom event class:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;font size=&quot;2&quot;&gt;&lt;font face=&quot;Arial&quot;&gt;package net.schwabe.demos&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;import flash.events.Event;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;public class CustomEvent extends Event&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;public var myNumber:Number;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;public var myString:String;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// constructor&lt;br /&gt;
&amp;nbsp;&amp;nbsp;public function CustomEvent(type:String, myNumber:Number, myString:String) &lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;super(type);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;this.myNumber = myNumber;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;this.myString = myString;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;} // end constructor&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;public override function clone():Event&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;return new CustomEvent(type, myNumber, myString);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;Hope this is helpful, as it is a very bare bones explanation of how to modularize your code and use custom event classes to pass around useful data.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Ciao&lt;/p&gt;
				
				</description>
						
				
				<category>Adobe Flex</category>				
				
				<category>Actionscript</category>				
				
				<pubDate>Tue, 29 Apr 2008 15:04:00 -0400</pubDate>
				<guid>http://blog.schwabe.net/index.cfm/2008/4/29/Dispatching-custom-events-from-a-Flex-Module</guid>
				
			</item>
			
		 	
			</channel></rss>