<rss version="2.0">
			<channel>
			<title>RIA CFML Flex Flash</title>
			<link>http://www.cfcdeveloper.com/index.cfm</link>
			<description>Adobe RIA Development</description>
			<language>en-us</language>
			<pubDate>Fri, 10 Sep 2010 02:49:02 -0700</pubDate>
			<lastBuildDate>Sat, 01 May 2010 09:39:00 -0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>clint317@cfcdeveloper.com</managingEditor>
			<webMaster>clint317@cfcdeveloper.com</webMaster>
			
			
			
			
			
			<item>
				<title>Fireworks FXG to Flash Builder</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2010/5/1/Fireworks-FXG-to-Flash-Builder</link>
				<description>
				
				Fooling around with the FXG capabilities to embed optimized graphics that can be scaled I found a few issues, not sure if they&apos;re bugs but here&apos;s my findings. I&apos;m using Fireworks CS4 and Flash Builder 4.

I basically created a rectangle with a border and gradient fill then placed large text with border as well. Not really sure what the FXG limitations are but this didn&apos;t work. Without any other changes I exported to FXG.

First of all, no matter what I do, if the FXG export includes any images that has to be embeded I get an error right away saying: com.adobe.fxg.FXGException: Error &apos;Error reading image&apos; occurred while embedding image: &apos;/test.assets/Image_0.png&apos;. Then I have to open the FXG file and delete the foward slash before the path to test.assets. There&apos;s a fix I&apos;m sure but I&apos;m just posting this quick fix for now.

Secondly, the gradient is broken like a .gif does to .jpg images. Not sure what to do about that for now but I have to flatten the gradient pieces, making the FXG vector scaling useless.

Third, the text is improperly placed. Originally I had the text centered but Flash Builder placed it lower right of the rectangle. Finally I had to flatten the text in FW to get it right. I think the text placement is correct but the scale throws it off. 

*Eventually I had to convert the text into paths, duh vectorized, and it worked. This seems to also fix the gradient issue. Doing this however makes editing the text combersome, having to delete it and replace it then export it again. I am however impressed with the file size, an 84k png exported to FXG is less than 3k. Cheers.
				
				</description>
				
				<category>3D &amp;amp; Graphics</category>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Sat, 01 May 2010 09:39:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2010/5/1/Fireworks-FXG-to-Flash-Builder</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>GraniteDS for Flex 3 and Glassfish</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2010/2/8/GraniteDS-for-Flex-3-and-Glassfish</link>
				<description>
				
				Is it just me or is GraniteDS just too complicated? I&apos;m an expert using FMS Flash Media Server and I understand BlazeDS but Granite Data Services is beyond plug-n-play. First, what is the stack and why is it hard to figure out? Tide, EJB, Gravity, Pojo, Seam, Spring, Guice, etc..

I have Glassfish v3 installed on my Windows PC along with MySQL and I want to create a Flex 3 application that uses GraniteDS 2.0.x with consumer and publisher, possibly along with Cairngorm Enterprise and no, I do not want an example, I want steps. I&apos;m using Eclipse with Flex 3 plugin, and I don&apos;t want to use Maven or Gas3.

1. How do I get GDS installed on the Glassfish server so that I have a gateway (http://xxxxxx/graniteamf/amf), what files, how and where to put them, etc..
2. Do I use Gravity? Tide? EJB? etc..
3. What are all of the configuration pieces and minimum params?

I&apos;ll take anything I can get to work locally that touches GDS for real time data services with push. I&apos;ve read everything I can online including the GDS web site and can not find a clear concise simple step by step tutorial or documentation. And if I ever figure it out I will certainly write a tutorial for my blog; sadly it&apos;ll be the only clear tutorial available.

So if anyone can tell, show, or point me to the right location, thank you. And I have to warn you, for over 2 weeks now I have tried everything I can find with no success. Please help.
				
				</description>
				
				<category>Eclipse &amp;amp; CFEclipse</category>
				
				<category>Flex/Flash/AS3</category>
				
				<category>Frameworks</category>
				
				<pubDate>Mon, 08 Feb 2010 12:46:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2010/2/8/GraniteDS-for-Flex-3-and-Glassfish</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Adobe Misses Flex Boat</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2010/2/2/Adobe-Misses-Flex-Boat</link>
				<description>
				
				It&apos;s my opinion that Adobe is making a mistake renaming Flex Builder to Flash Builder. Simply put, when it comes to business applications, businesses still don&apos;t want to buy a Flash solution. Adobe should catch this wave created by the Flex craze and call it just that, Flex.
				
				</description>
				
				<category>Bits and Bytes</category>
				
				<category>Eclipse &amp;amp; CFEclipse</category>
				
				<category>Flex/Flash/AS3</category>
				
				<category>Frameworks</category>
				
				<category>Personal</category>
				
				<pubDate>Tue, 02 Feb 2010 19:51:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2010/2/2/Adobe-Misses-Flex-Boat</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>OVP Open Video Player for Flex</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/12/5/OVP-Open-Video-Player-for-Flex</link>
				<description>
				
				I&apos;m working on creating a simple video chat component for my application and came across this open source solution from the good folks at &lt;a href=&quot;http://www.openvideoplayer.com&quot; target=&quot;_blank&quot;&gt;OpenVideoPlayer.com&lt;/a&gt;. You can download the latest &lt;a href=&quot;http://openvideoplayer.sourceforge.net/downloads&quot; target=&quot;_blank&quot;&gt;open source flash video player&lt;/a&gt; version from SourceForge. Open it up and go to the core\bin and drag the ovp_core.swc to your project&apos;s asset folder. Now open project properties within your project and add the swc file through the Flex Build Path, Library path. Now the openvideoplayer package and akamai package will be available for development from the org and com packages.

Below is a very basic Hello World I used to make sure it operated correctly as expected. I&apos;m not sure yet if I&apos;ll use it for my specific needs which are very basic. This OVP brings a lot of other features I may or may not need, like running ads, which I may need. But for now I&apos;ll go through and see if it has the features I require before making a commitment.

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; creationComplete=&quot;init()&quot;&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			import flash.events.*;
			import org.openvideoplayer.net.*;
			import org.openvideoplayer.events.*;
			import com.akamai.net.*;
			
			public var net:AkamaiConnection;
			
			public function init():void {
				ovc = new OvpConnection();
				ovc.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler)
				ovc.connect(&quot;localhost/devCRW&quot;);
				//net = new AkamaiConnection();
				//net.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
				//net.connect(&quot;localhost/devCRW&quot;);
			}
			public function netStatusHandler(e:NetStatusEvent):void {
				var info:Object = e.info;
				switch(info.code) {
					case &quot;NetConnection.Connect.Success&quot;:
						output.text = &quot;Hello World!&quot;;
					break;
					default:
						output.text = &quot;Sorry, try again.&quot;;
				}
			}
		]]&gt;
	&lt;/mx:Script&gt;
	
	&lt;mx:Text x=&quot;10&quot; y=&quot;10&quot; id=&quot;output&quot;/&gt;
	
&lt;/mx:Application&gt;
&lt;/code&gt;

Notice that you don&apos;t include the usual rtmp:// when connecting. I believe it does some of it&apos;s own decision making about connection protocols, meaning you don&apos;t have to test connections and try HTTP tunneling etc.. becuase it&apos;ll do it for you. Now to put up a simple video UI, connect it to my camera, and then stream it to FMS and back again.
				
				</description>
				
				<category>Resources</category>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Sat, 05 Dec 2009 13:11:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/12/5/OVP-Open-Video-Player-for-Flex</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Starter bare-bones AS camera class</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/12/4/Starter-barebones-AS-camera-class</link>
				<description>
				
				Just starting on this class and thought I&apos;d post a good starting point for learning.

&lt;code&gt;
package classes{
	import flash.media.*;
	import flash.net.*;
	
	import mx.core.UIComponent;

	public class Chatcam extends UIComponent{
		private var netconnection:NetConnection;
		private var nsPlayer:NetStream; 
		private var video:Video;
		private var vidPlayer:Video; 
		private var camera:Camera; 
		private var microphone:Microphone;
		private var uic:UIComponent;
		
		public function Chatcam(nc:NetConnection,publishedCam:String=&quot;&quot;){
			netconnection = nc;
		}
		public function detectCamera():Boolean{
			return Camera.getCamera();
		}
		public function publishCamera(cameraName:String,publishType:String=&quot;live&quot;):void {
			camera = Camera.getCamera();
			camera.setQuality(0,100);
			camera.setKeyFrameInterval(15);
			camera.setMode(240,180,15,false);
			//cam.setMotionLevel(35,3000);
		    microphone = Microphone.getMicrophone(); 
		    microphone.setUseEchoSuppression(true);
		    microphone.setSilenceLevel(0,2000); 
		    var ns:NetStream = new NetStream(netconnection); 
		    ns.attachCamera(camera); 
		    ns.attachAudio(microphone); 
		    ns.publish(cameraName,publishType); 
		}
		public function displayPublishingVideo():void {
			video = new Video(); 
		    video.attachCamera(camera); 
		    addChild(video);
		}
		public function displayPlaybackVideo(cameraName:String):void {
			nsPlayer = new NetStream(netconnection); 
		    nsPlayer.play(cameraName); 
		    vidPlayer = new Video(); 
		    vidPlayer.attachNetStream(nsPlayer); 
		    addChild(vidPlayer); 
		}
		
	}
}
&lt;/code&gt;

Example usage:

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; creationComplete=&quot;init()&quot; xmlns:media=&quot;flash.media.*&quot;&gt;
	
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.core.UIComponent;
			import flash.net.*;
			import flash.media.*;
			import classes.Chatcam;
			
			public var nc:NetConnection = new NetConnection();	
			public var ns:NetStream;
			public var rtmpPath:String = &quot;rtmp://localhost/devCRW&quot;;
			public var cc:Chatcam;
			
			public function init():void {
				nc.client = new Object();
				nc.addEventListener(NetStatusEvent.NET_STATUS,ncStatusHandler);
				nc.connect(rtmpPath);
			}
			public function ncStatusHandler(e:NetStatusEvent):void {
				switch (e.info.code) 
				{
					case &quot;NetConnection.Connect.Success&quot;:
						stat(&quot;Connected&quot;);
						cc = new Chatcam(nc);
						if(cc.detectCamera()){
							stat(&quot;displayPublishingVideo&quot;);
							cc.publishCamera(&quot;myCamera&quot;);
							cc.displayPlaybackVideo(&quot;myCamera&quot;);
							addChild(cc);
						}else{
							stat(&quot;Problem with camera.&quot;);
						}
				    break; 
				    case &quot;NetConnection.Connect.Rejected&quot;:
						stat(&quot;Rejected!&quot;);
				    break; 
				    case &quot;NetConnection.Connect.Failed&quot;: 
						
					break;
					case &quot;NetConnection.Connect.Closed&quot;: 
						
					break;
					default:
						
				}
			}
			public function stat(msg:String):void {
				status.htmlText += msg + &quot;&lt;br&gt;&quot;;
			}
		]]&gt;
	&lt;/mx:Script&gt;
	
	&lt;mx:Text x=&quot;198&quot; y=&quot;10&quot; text=&quot;Status:&quot; id=&quot;status&quot;/&gt;
	
&lt;/mx:Application&gt;
&lt;/code&gt;
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<category>OOP/Patterns</category>
				
				<pubDate>Fri, 04 Dec 2009 19:15:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/12/4/Starter-barebones-AS-camera-class</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Using do as the event name in Coldbox, don&apos;t.</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/20/Using-do-as-the-event-name-in-Coldbox-dont</link>
				<description>
				
				It took me a day to figure this out, live and learn right. I used &apos;do&apos; as the event name in one of my Coldbox applications as opposed to &apos;event&apos; given as the default. If you&apos;re considering what to name your events in Coldbox, don&apos;t. Just use the default &apos;event&apos; name given. I was just trying to be unique but it backfired.

The &apos;do&apos; term is a reserved keyword in Flex, ActionScript actually. The lesson I got from this is to not ever use any keywords from any language for which you may mix. In this case I was using Flash remoting from my Flex application to to fire remote ColdFusion functions from the Coldbox framework remote proxy.

Here is the code I was using in my Flex actionscript. Notice the &apos;event&apos; object param passed to the proxy process function, you can&apos;t use &apos;do&apos;, well technically you can but don&apos;t because it won&apos;t work.

&lt;code&gt;
private function authenticateClient():void {
	var cProxy:RemoteObject = getColdBoxProxy();
	cProxy.addEventListener(FaultEvent.FAULT,faultHandler);
	cProxy.process.addEventListener(ResultEvent.RESULT,authenticateHandler);
	cProxy.process({event:&quot;general.doRemoteLogin&quot;});
}
/* UTILITY METHOD TO GET A CBPROXY OBJECT, You can separate all this to a delegate class */
public function getColdBoxProxy():RemoteObject{
    var cProxy:RemoteObject = new RemoteObject(&quot;ColdFusion&quot;);
    cProxy.source = _model.cbProxyPath;
    cProxy.showBusyCursor = true;
    return cProxy;
}
&lt;/code&gt;
				
				</description>
				
				<category>Coldbox 2.6</category>
				
				<category>ColdFusion</category>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Tue, 20 Oct 2009 07:10:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/20/Using-do-as-the-event-name-in-Coldbox-dont</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flex 3: Who changed the shared object?</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/16/Flex-3-Who-changed-the-shared-object</link>
				<description>
				
				So you have a shared object connected and your setting properties to fire off the SyncEvent handler but you want the client to know if it did it or did another client do it. Not confused are you? Just take a look at this code to use on a SyncEvent to tell who changed the shared object&apos;s property.

&lt;code&gt;
private static const SUCCESS:String = &quot;success&quot;;
private static const CHANGE:String = &quot;change&quot;;
//SharedObject Sync Handler

private function soSync(e:SyncEvent):void {
	switch(e.changeList[0].code) {
		case SUCCESS:
			trace(e.changeList[0].code + &quot;! I did it.&quot;);
		break;
		case CHANGE:
			trace(e.changeList[0].code + &quot;D by someone else.&quot;);
		break;
	}
}
&lt;/code&gt;

This comes from the &apos;changeList&apos; property of the SyncEvent class in the flash.events package. Additional code values include &apos;clear&apos;, &apos;reject&apos;, and &apos;delete&apos;. There&apos;s also a &apos;name&apos; param with the property name and an &apos;oldValue&apos; param with the old value if the code is reject or change.
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Fri, 16 Oct 2009 19:40:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/16/Flex-3-Who-changed-the-shared-object</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flex 3: TextArea Scrolling for Chat</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/9/Flex-3-TextArea-Scrolling-for-Chat</link>
				<description>
				
				In a chat application you want the message entered to be placed into the textarea component possibly all the way down or up and scrolled to the last entry line. However just placing a new line a text always adds to the textarea but does not scroll automatically.

What we want to do is automatically scroll the textarea on input of a new message using the textarea&apos;s verticle scroll position. Basically all you have to do is update the component&apos;s verticalScrollPosition attribute with the component&apos;s maxVerticalScrollPosition value. But there is a problem with the amount it scrolls when subjected to the change, it doesn&apos;t scroll all the way.

To fix the scroll position so it butts up to the edge or end of the list we&apos;ll need to use the callLater() performance method. Follow my example and try it for yourself. I&apos;m just creating a simple button and textarea example. Each time the button is clicked it inserts text into the text area, growing it the more you click it. The click also resets the scroll position to the bottom, just like chat should.

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; 
	layout=&quot;absolute&quot; creationComplete=&quot;init();&quot;&gt;
	
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import flash.events.MouseEvent;
			
			public var string:String = &quot;&lt;br/&gt;Mauris blandit vehicula turpis. &quot; + 
					&quot;Aenean lacus quam, adipiscing in, sodales non, viverra &quot; + 
					&quot;euismod, odio. Donec nec sem commodo massa vestibulum posuere.&quot;;
					
			private function init():void {
				textOutput.htmlText = &quot;Welcome&lt;br/&gt;&quot;;
			}
			
			private function updateTextArea():void {
				textOutput.htmlText += string;
			}
			
			private function doUpdateTextArea(e:MouseEvent):void {
				updateTextArea();
				callLater(setMaxScroll);
			}
			
			private function setMaxScroll():void {
				textOutput.verticalScrollPosition = textOutput.maxVerticalScrollPosition;
			}
		]]&gt;
	&lt;/mx:Script&gt;
	
	&lt;mx:Panel x=&quot;10&quot; y=&quot;10&quot; width=&quot;250&quot; height=&quot;200&quot; layout=&quot;absolute&quot; id=&quot;myPanel&quot; title=&quot;Chat&quot;&gt;
		&lt;mx:TextArea x=&quot;10&quot; y=&quot;10&quot; width=&quot;210&quot; height=&quot;106&quot; id=&quot;textOutput&quot; liveScrolling=&quot;true&quot; verticalScrollPolicy=&quot;on&quot;/&gt;
		&lt;mx:Button y=&quot;124&quot; label=&quot;Add Content&quot; id=&quot;connectButton&quot; labelPlacement=&quot;left&quot; horizontalCenter=&quot;-57&quot; click=&quot;doUpdateTextArea(event);&quot;/&gt;
	&lt;/mx:Panel&gt;
	
&lt;/mx:Application&gt;
&lt;/code&gt;

Clicking on the button calls the doUpdateTextArea() function concatenating the htmlText value with the string variable causing the scroll bar to grow with content. Then a callLater() method is called with the setMaxScroll() function, setting the verticalScrollPosition to equal the textArea&apos;s maxVerticalScrollPosition. The callLater() method simply makes Flex wait to call the function only after it makes sure that everything else has finished. Without doing so the scroll will take place before all the text is updated and will miss a line or two.
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Fri, 09 Oct 2009 04:59:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/9/Flex-3-TextArea-Scrolling-for-Chat</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Is Flex now Flash? New Flash Builder name stinks.</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/7/Is-Flex-now-Flash-New-Flash-Builder-name-stinks</link>
				<description>
				
				It sickens my stomach to think what a big mistake this name change is, changing Flex Builder to Flash Builder. 

I&apos;ve never seen so many new jobs open up for a single product than I have with Flex. Flex jobs are everywhere and paying good. Flex, Flex, Flex. Not Flash or Flash Applications Developer, just Flex.

The main point here not matter what you think of the whole ontology of Adobe products is that FLEX is to the industry a seperate paradigm, even though it&apos;s not quite that much of a shift. We (developers) know the underlying truth but it won&apos;t hurt if the client doesn&apos;t know that the application your proposing and demonstrating is in fact a Flash based application built using the Flex framework. All they need to know is that, sure, it&apos;s a Flex application. 

Technically it&apos;s an Internet application that runs in the Flash player developed using a Flex framework MXML markup and ActionScript through a Flash Builder IDE. If you want to specialize in Flex, fine, you&apos;re a Flex Developer. However, if you want to create an Internet application that runs in the Flash player developed using the Flash IDE then you are a Flash Developer. I just don&apos;t think it&apos;s fair that Flex Developers have to work in a product named for a totally seperate skill set.

The most difficult thing for myself to understand is whether or not to continue to call myself a Flex Developer or should I say Flash Developer? If I say I&apos;m a Flex Developer in 3 years and there&apos;s no &quot;Flex&quot; product, will they know what I&apos;m talking about? Flash Builder is I think going to kill the Flex momentum. In war momentum is everything.

This was a bad decision and I don&apos;t know if they can ust change their minds now or not but what can it hurt, better than killing it altogether. Adobe needs to get a backbone, admit to the mistake and go back to calling it Flex. It really is a totally different business solution from Flash. Please, I&apos;m trying to save future careers here.
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<category>Personal</category>
				
				<pubDate>Wed, 07 Oct 2009 16:26:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/7/Is-Flex-now-Flash-New-Flash-Builder-name-stinks</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Fireworks PNG imported to Flash shrinks or resized</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/3/Fireworks-PNG-imported-to-Flash-shrinks-or-resized</link>
				<description>
				
				I was stuck on this one issue for a while looking for a solution or answer on Google. I never found an answer but I finally figured it out myself. If you have any more information to clear this up please share.

I&apos;m working on a Flex application that requires image assets for the layout such as the logo, a nice title image, buttons, borders, and so on. I created the assets in Fireworks and saved them as PNG&apos;s (PNG32), ready to be imported into the Flash CS3 library.

What I&apos;m doing is creating an image assets SWC file I can add to my Flex build library path. In case your new to doing this, it is a way to embed image assets into your Flex project and use them as components. As opposed to using the Embed metatag. Maybe I&apos;ll blog about that too, but back to my issue.

So after saving my PNG&apos;s in Fireworks, I import them to the Flash library, ready to configure for Flex using the Convert Symbol to Flex Component command. However I notice that the images, if you place it on the stage or look at them in the Flex output, are much smaller than my originals back in Fireworks. I couldn&apos;t figure out why Flash was resizing or shrinking my images when I imported them. I tried it on jpg&apos;s also but they turned out fine, it was just PNG&apos;s.

For some reason I thought about the image resolution in Fireworks and played around with it. I&apos;m not a designer or a graphics person so sue me for not knowing. What I found was that the resolution I was using, 98, was the problem and resetting it to different sizes had different results. I really does matter to Flash what resolution PNG&apos;s are saved in. And what works 100% of the time is to use a resolution of 72.

Also, if you use the correct resolution of 72 on your PNG&apos;s you&apos;ll not need to use the Allow Smoothing option on the bitmap properties.

Rule #178:
Always use an image resolution of 72 when creating PNG images in Fireworks for Flash authoring.
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<category>3D &amp;amp; Graphics</category>
				
				<pubDate>Sat, 03 Oct 2009 12:49:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/3/Fireworks-PNG-imported-to-Flash-shrinks-or-resized</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flex 3 PopUpWindow custom event</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/10/2/Flex-3-PopUpWindow-custom-event</link>
				<description>
				
				My flex application has settings that can be changed by the user. The settings window is accessible from a menu link control that pops up the settings window. Some of the settings are for changing attributes of other custom components within the app. For this demonstration my application has a custom component for which the user can change background images from the settings popup component. The click event from the popup component will fire an event in the parent which chages another component&apos;s background, passing it the image class to use.

At first I tried to create a custom event in the popup window but it wasn&apos;t working like it does for custom components so I had to search for another solution. Eventually I settled on adding events to the popup window object in the main app mxml. This also covers passing data back to the main app from the popup window as well. No need to create a custom event class.

1. Create a titlewindow component for the settings popup with the required embeded images and a tilelist to display them for selection. Selection will immediatly change the background for another child component, the main content canvas component in the main app mxml. Notice the tilelist has no click event handler, it is added in the main mxml.
&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:TitleWindow xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; 
    title=&quot;Settings&quot; showCloseButton=&quot;true&quot;
    width=&quot;500&quot; height=&quot;300&quot;&gt;
	
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.controls.Alert;
			import mx.collections.ArrayCollection;
			
			//embed images

			[Embed(source=&quot;../assets/bamboo.jpg&quot;)]
			[Bindable]
			public var Bamboo:Class;
			[Embed(source=&quot;../assets/beach.jpg&quot;)]
			[Bindable]
			public var Beach:Class;
			[Embed(source=&quot;../assets/sky.jpg&quot;)]
			[Bindable]
			public var Sky:Class;
			[Embed(source=&quot;../assets/space.jpg&quot;)]
			[Bindable]
			public var Space:Class;
			
			//create objects for arraycollection

			public var bambooObj:Object = {label:&quot;Bamboo&quot;,icon:Bamboo};
			public var beachObj:Object 	= {label:&quot;Beach&quot;,icon:Beach};
			public var skyObj:Object 	= {label:&quot;Sky&quot;,icon:Sky};
			public var spaceObj:Object 	= {label:&quot;Space&quot;,icon:Space};
			
			//create arraycollection of objects for dataprovider

			[Bindable]
			public var backgroundAssets:ArrayCollection = new ArrayCollection([bambooObj,beachObj,skyObj,spaceObj]);
			
		]]&gt;
	&lt;/mx:Script&gt;
	
	&lt;mx:Label text=&quot;Select a background.&quot;/&gt;
	
	&lt;mx:TileList id=&quot;backgroundsList&quot;
		maxColumns=&quot;2&quot; rowHeight=&quot;100&quot; columnWidth=&quot;125&quot;
		width=&quot;300&quot; height=&quot;200&quot;
		borderStyle=&quot;none&quot;
		paddingBottom=&quot;10&quot; paddingLeft=&quot;10&quot; paddingRight=&quot;10&quot; paddingTop=&quot;10&quot;
		dataProvider=&quot;{backgroundAssets}&quot;/&gt;
	
&lt;/mx:TitleWindow&gt;
&lt;/code&gt;

2. Create the popup window function in the main mxml with a link to make it pop up.
&lt;code&gt;
//the main.as used as the source for a script tag in main.mxml
import flash.events.Event;
import mx.managers.PopUpManager;
import comps.SettingsWindow; //the settings popup window custom component

//create a public SettingsWindow variable

public var settings:SettingsWindow;

[Embed(source=&quot;assets/title.png&quot;)]
[Bindable]
public var Title:Class;

//function to call for opening the settings window

private function openSettings():void {
	//Open a window with settings forms

	settings = SettingsWindow(PopUpManager.createPopUp(this,SettingsWindow,true));
	PopUpManager.centerPopUp(settings);
	//event handler for popup window close button

	settings.addEventListener(&quot;close&quot;,removeSettings);
	//adding an event listener to a control from the settings window component

	settings[&apos;backgroundsList&apos;].addEventListener(&quot;click&quot;,setMainBackground);
}

//function to remove popup window on close

private function removeSettings(event:Event):void {
	PopUpManager.removePopUp(settings);
}
&lt;/code&gt;

3. Create the main.mxml with the popup link button and the main content component for which the background will be changed.
&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
	xmlns:comp=&quot;comps.*&quot;
	layout=&quot;absolute&quot; verticalGap=&quot;0&quot; themeColor=&quot;#724972&quot;
	width=&quot;680&quot; height=&quot;500&quot; horizontalGap=&quot;0&quot;&gt;
	
	&lt;mx:Style source=&quot;assets/general.css&quot;/&gt;
	
	&lt;mx:Script source=&quot;main.as&quot;/&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			
		]]&gt;
	&lt;/mx:Script&gt;
	
	&lt;!-- Title bar --&gt;
	&lt;mx:ApplicationControlBar dock=&quot;true&quot; styleName=&quot;mainAppBar&quot;
		height=&quot;30&quot; dropShadowEnabled=&quot;false&quot; id=&quot;mainAppBar&quot;&gt;
		&lt;mx:Image source=&quot;{Title}&quot;/&gt;
	&lt;/mx:ApplicationControlBar&gt;
	
	&lt;!-- Main content area --&gt;
	&lt;comp:MainContent x=&quot;0&quot; y=&quot;39&quot;
		id=&quot;mainContent&quot;/&gt;
	
	&lt;!-- Menu --&gt;
	&lt;mx:HBox id=&quot;appMenuBar&quot; 
		width=&quot;100%&quot; height=&quot;40&quot;
		borderStyle=&quot;inset&quot; borderThickness=&quot;1&quot; borderColor=&quot;0x000000&quot;
		dropShadowEnabled=&quot;true&quot;
		backgroundColor=&quot;0xFFFFFF&quot;&gt;
		
		&lt;mx:LinkButton label=&quot;Settings&quot; id=&quot;settingsBtn&quot; click=&quot;openSettings()&quot;/&gt;
		
	&lt;/mx:HBox&gt;
	
&lt;/mx:Application&gt;
&lt;/code&gt;
				
				</description>
				
				<category>Flex/Flash/AS3</category>
				
				<pubDate>Fri, 02 Oct 2009 09:37:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/10/2/Flex-3-PopUpWindow-custom-event</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>New York and Atlantic City Vacation</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/9/25/New-York-and-Atlantic-City-Vacation</link>
				<description>
				
				The wife and I took a 6 day retreat together, first stopping off in Virginia to hook up with friends then on to Atlantic City for some gambling and NYC for sight seeing. The drive from here just outside Atlanta to their house in VA was about 8 hours, stayed overnight then they drove the 5 hours to AC in New Jersey.

We stayed 3 nights at the Harrahs hotel and casino and liked it so much we extended another night. The casinos were our main attraction and we enjoyed the boardwalk just as much as it took 2 days to explore it. It&apos;s pretty long and a little busy with people of all walks of life. It was the weekend but even on Sunday it was a feastive atmospher with the Steel Pier, kind of like a mini Coney Island. Much to do and see with lots of little shops. You don&apos;t have to walk if you pay for a ride on a two seater stroller pushed around by some guy. The weather was excellent, food good, and beach was littered with shell pieces and dirty sand.

The casinos we visited were Harrahs, Bally&apos;s, Wild Wild West Casino, Ceasers, and one other I think. Ceaser was the most impressive with it&apos;s Roman themed architecture and the WWWC was neat with it&apos;s big western thing looking like a California gold rush scene complete with animatronics and sound effects. That&apos;s were we tried the ponies for the first time, horse racing. We won some and lost a little. Our friend hit a thousand dollar jackpot on a slot. I played some Blackjack and enjoyed it as usual. Our friends played BJ for the first time too and loved it.

We did a lot, too much to fit it all here without rambling on. The New York city excursion was done on a Sunday, arrived by car via the Lincoln tunnel about 2pm and left around 9pm. We parked at a public parking place on 54th street near Times Square for about $20, no problems. The streets were bustling but not jam packed and it was pleasent. Our walk took us to the visitor center were we looked into tours but passed on the $80 per person price on a 2 hour dubble decker bus ride.

We followed the advice of a local for food and ate at Johns Pizzeria on Times Square and it was excellent. For $8 each (unlimited rides) we took the A train subway down to ground zero for a look and pictures. Then back uptown to 34th street to visit the Empire State building. The Empire was empressive as the tallest building around without the trade towers. We toured to the 89th&apos;ish floor for $20 each and it took about 30 minutes to get there through the crowd and security. Be prepared to be treated like your at the airport, including metal dectectors. There&apos;s a gift shop, the view is spectactular if you can wedge up to the edge, and they take a picture of your group that you can purchase later if you want.

Coming out of the Empire State building we visited the shops across the street then headed for the subway again stopping at a hot dog stand vendor for a dog and pretzel. Headed again uptown on the A train to 59th street to get back to the car and stopped for pictures at Studio 54.

Getting in and out and around was fine. You can&apos;t drive around unless you have all day and there&apos;s plenty of parking, for a normal Sunday any ways. I was a little dissapointed with Times Square but it wasn&apos;t New Yorks fault. I wanted to stand there and take it in you know, like you see on TV but you couldn&apos;t. Some stupid loud Christian music choir concert thing took up the entire square with a thousand other idiots actually listening to it while delusionist tried to pushed pamplets and ideas into your hands and head, a very unpleasant mob.

Driving around up passed Virgina and Atlantic City I never seen so many tolls. It cost probably about $15 in tolls to get to NYC and $15 to get back. Then we went back to Atlantic City to gamble on some ponies and walk on the boardwalk one last time before heading back. The trip back was uneventful and I&apos;m glad to be home again, but can&apos;t wait to go back too. Next time I think we&apos;ll try Vegas as we haven&apos;t done that yet.

We have pictures I haven&apos;t gone through yet and may post them later but you should go yourself if you haven&apos;t yet. Now, back to work..
				
				</description>
				
				<category>Personal</category>
				
				<pubDate>Fri, 25 Sep 2009 04:01:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/9/25/New-York-and-Atlantic-City-Vacation</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>MySQL Find and Replace</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/9/9/MySQL-Find-and-Replace</link>
				<description>
				
				I didn&apos;t know until now about the replace function in MySQL. Evidently you can do case-sensitive search and replace pretty easily.

update table set field = replace(field,&apos;before&apos;,&apos;after&apos;);

I&apos;m not sure about using regex but you can do multiple fields at once. Like this:

update tblblogentries set body = replace(body,&apos;ColdFusion&apos;,&apos;ColdFusion&apos;), title=replace(title,&apos;ColdFusion&apos;,&apos;ColdFusion&apos;)

Don&apos;t even say it ;p
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>SQL</category>
				
				<pubDate>Wed, 09 Sep 2009 16:40:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/9/9/MySQL-Find-and-Replace</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>ColdFusion with Javascript with ColdFusion</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/9/9/ColdFusion-with-Javascript-with-ColdFusion</link>
				<description>
				
				I had a situation where I wanted to pass a query param to a ColdFusion page that would use it to find a record in a cfquery then pass that record to a Javascript function used to display that record in that ColdFusion page. Thats a lot to say all at once. Let me see if I can explain it better.

My ColdFusion page displays a list of private messages for a user in their user account. This list is at the top of the page and shows date, time, sender, and subject. When the user clicks on the subject of any message in the list, Javascript Ajax is used to fetch the message details from a component and display the message fully below the list, kind of like an email program. Also when the page loads, as a default the first message in the list is automatically passed to that Javascript Ajax and displayed. That&apos;s easy enough so far.

It gets more complicated when you allow that same page to be passed a URL query param equalling a message id you want specifically to be shown first, instead of just the first row in the query. It&apos;s hard to explain but try to follow me. It&apos;s not my intention to explain everything like a tutorial so here&apos;s the code I implimented to solve my issue.

The page would be called like so, http://www.site.com/showPrivateMessages.cfm?privatemessageid=2435. But remember that the page can be called without the URL param, in which case it would just use the first record in the query of private messages. Including the param would tell the page to display that particular message&apos;s details first.

So on the called page I get my private messages query:
privateMessagesQuery = event.getValue(&apos;privateMessagesQuery&apos;);
(I&apos;m using the Coldbox framework)

Set up the param to use with a default of 0:
privatemessageid = event.getValue(&quot;privatemessageid&quot;,&quot;0&quot;);

Then I need to define which row in the record matches the one I want, but I must set this up first:
rowtouse = 0;

Now I need to recurse through the query in a loop to set the rowtouse variable equal to the row found for the id:
&lt;code&gt;&lt;cfif privatemessageid gt 0&gt;
	&lt;cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;999999&quot;&gt;
		&lt;cfif privateMessagesQuery.privatemessageid[i] eq privatemessageid&gt;
			&lt;cfset rowtouse = i&gt;
			&lt;cfbreak /&gt;
		&lt;/cfif&gt;
	&lt;/cfloop&gt;
&lt;/cfif&gt;&lt;/code&gt;

Ad now in my Javascript I want to use that row number to set some variables to use in a function call that displays the message details for the message who&apos;s id matches that passed in the URL param. I&apos;m not showing the function that does the actual displaying of details, just the function name for time and space&apos;s sake (I&apos;m busy).

&lt;code&gt;&lt;$cript&gt;
window.onLoad = loadFirstRequestedMsg(&lt;cfoutput&gt;#rowtouse#&lt;/cfoutput&gt;);
function loadFirstRequestedMsg(rowtouse){
	if(rowtouse &gt; 0){
		xPrivatemessageid = &quot;&lt;cfoutput&gt;#privateMessagesQuery.privatemessageid[rowtouse]#&lt;/cfoutput&gt;&quot;;
		xRead = &quot;&lt;cfoutput&gt;#privateMessagesQuery.readed[rowtouse]#&lt;/cfoutput&gt;&quot;;
		xSubject = &quot;&lt;cfoutput&gt;#privateMessagesQuery.subject[rowtouse]#&lt;/cfoutput&gt;&quot;;
		xFrom = &quot;&lt;cfoutput&gt;#privateMessagesQuery.fromUserName[rowtouse]#&lt;/cfoutput&gt;&quot;;
		xMessage = &quot;&lt;cfoutput&gt;#privateMessagesQuery.message[rowtouse]#&lt;/cfoutput&gt;&quot;;
		showMessageDetails(xPrivatemessageid,xRead,xSubject,xFrom,xMessage);
	}
}
function showMessageDetails(messageid,read,subject,from,message){
....
}
&lt;InvalidTag&gt;&lt;/code&gt;

The showMessageDetails just sets values in span tags, DHTML Ajax stuff. Any ways, you can see here how I&apos;m using ColdFusion inside of Javascript to use back in ColdFusion, or HTML to be technically correct.
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>JavaScript/Ajax</category>
				
				<pubDate>Wed, 09 Sep 2009 06:30:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/9/9/ColdFusion-with-Javascript-with-ColdFusion</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Trigger Javascript after loading ColdFusion page</title>
				<link>http://www.cfcdeveloper.com/index.cfm/2009/9/9/Trigger-Javascript-after-loading-ColdFusion-page</link>
				<description>
				
				Once apon a time, and still only if I must, I used the &lt;body&gt;&apos;s onLoad attribute to call a Javascript function after a page loaded. I no longer follow that pattern opting instead to use a window DOM method, window.onload, also called a global event handler.

Here is an example of calling a Javascript function on page load in the script block.

&lt;code&gt;
&lt;$cript language=&quot;javascript&quot;&gt;
&lt;!--
window.onload = selectFormField;
function selectFormField(){
	document.paymentForm.x_first_name.focus();
}
--&gt;
&lt;/script&gt;
&lt;/code&gt;
It sets the cursor focus to a selected field in my form on page load.

And I found this cool resource while looking around, it&apos;s a book: &lt;a href=&quot;http://mitpress.mit.edu/sicp/full-text/book/book.html&quot; target=&quot;_blank&quot;&gt;Structure and Interpretation of Computer Programs&lt;/a&gt; or SICP. What does that have to do with this you ask? Well if you need something like the following example of a complexed javascript onload, it might come in handy.

&lt;code&gt;
&lt;$cript language=&quot;javascript&quot;&gt;
&lt;!--
function createMultiDelegate(f1, f2) {
    return function() {
        if (f1) f1();
        if (f2) f2();
    }
}
window.onload = makeMultiDelegate(window.onload, aFunction );
--&gt;
&lt;/script&gt;
&lt;/code&gt;
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>JavaScript/Ajax</category>
				
				<pubDate>Wed, 09 Sep 2009 05:04:00 -0700</pubDate>
				<guid>http://www.cfcdeveloper.com/index.cfm/2009/9/9/Trigger-Javascript-after-loading-ColdFusion-page</guid>
				
			</item>
			
		 	
			</channel></rss>
	

