<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8545986298620350368</id><updated>2011-10-12T21:05:18.679-07:00</updated><title type='text'>Before I forget...</title><subtitle type='html'>Flash, Flex + ActionScript discoveries!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8925885118057243785</id><published>2011-10-10T19:54:00.000-07:00</published><updated>2011-10-10T21:40:37.549-07:00</updated><title type='text'>Blog has moved...</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="color: #444444; font-size: large;"&gt;This blog has moved. It has migrated to:&lt;/span&gt;&lt;span style="font-size: large;"&gt; &lt;a href="http://craiggrummitt.wordpress.com/"&gt;http://craiggrummitt.wordpress.com/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8925885118057243785?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8925885118057243785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8925885118057243785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8925885118057243785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8925885118057243785'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2011/10/blog-has-moved.html' title='Blog has moved...'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-6798749370970650884</id><published>2011-02-09T21:02:00.000-08:00</published><updated>2011-02-09T21:35:48.091-08:00</updated><title type='text'>video white</title><content type='html'>A recent task I had to achieve was to play a video for several seconds and extract a frame as a JPG several seconds in. I did not know the dimensions of the video ahead of time, so hoped to extract that information out of the video metadata, and create the video object at this point. Sounds simple enough!&lt;br /&gt;&lt;br /&gt;However, this only seemed to work about 75% of the time. Occasionally I was seeing just white in certain videos, like they weren't attached correctly to the Video object(despite receiving the metadata correctly). My theory was that perhaps the metadata was received after the FLV began playing, and that perhaps there can be problems creating a Video object and attaching a NetStream to it, after it has begun playing.&lt;br /&gt;&lt;br /&gt;So I tried creating the Video object and then resizing after receiving the FLV metadata, but the resize seemed to have no effect when extracting the Bitmap Data.  But finally found a solution - the Bitmap Data extracted correctly, if I placed the Video object inside a MovieClip and extracted the Bitmap Data of the MovieClip instead of the resized Video object.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-6798749370970650884?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/6798749370970650884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=6798749370970650884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6798749370970650884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6798749370970650884'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2011/02/video-white.html' title='video white'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-4191041751798349977</id><published>2010-11-27T01:48:00.000-08:00</published><updated>2010-11-27T01:54:13.764-08:00</updated><title type='text'>SharedObject not updating between tabs</title><content type='html'>&lt;span style="font-family: arial;font-size:100%;" &gt;Just created an app which required persistent data, so used a local SharedObject. However discovered that if one person had the app open in two different places(eg. 2 tabs) the persistent data in one tab wasn't updating in the other tab. To remedy this I tried reloading the SharedObject(SharedObject.getLocal) every time I extracted a variable, and yet this SharedObject variable still wasn't updating.&lt;br /&gt;&lt;br /&gt;Discovered that, strangely, the only way to update the SharedObject, is to first set it to null. Set it to null and then reload it forces an update.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-4191041751798349977?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/4191041751798349977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=4191041751798349977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4191041751798349977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4191041751798349977'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2010/11/sharedobject-not-updating-between-tabs.html' title='SharedObject not updating between tabs'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8706265629294707151</id><published>2010-10-18T03:13:00.000-07:00</published><updated>2010-10-18T03:14:37.076-07:00</updated><title type='text'>Frustrating Flex problems solved #7 - Removing DragDrop animation</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: arial;"&gt;In Flex was building a simple drag and drop from a library list to another simple list. I also wanted to build the functionality of dragging the item out of the simple list to automatically remove the item from the list, and return the item to the library.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;I managed to handle this with one problem remaining. As the dragged item thought it wasn't going to be accepted, it automatically played an animation of it returning to the simple list before my code displayed it back in the library. The animation was completely misleading but I couldn't find a way to turn it off!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;My solution in the end was to create a custom ListItemDragProxy component. I included this in the list with:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: arial;"&gt;dragIndicatorClass="display.CustomListItemDragProxy"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;and in the custom class, I merely set visible=0 onMouseUp. Simple solution that works perfectly.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8706265629294707151?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8706265629294707151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8706265629294707151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8706265629294707151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8706265629294707151'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2010/10/frustrating-flex-problems-solved-7.html' title='Frustrating Flex problems solved #7 - Removing DragDrop animation'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-9084882406159133018</id><published>2010-09-09T14:24:00.001-07:00</published><updated>2010-09-09T14:27:39.114-07:00</updated><title type='text'>Frustrating Flex problems solved #6 - Keydown</title><content type='html'>&lt;span style="font-family:arial;"&gt;Spent some time screaming "Why can't my component receive keyboard events? "&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Crazy,  I'm not sure why i never knew this, but for a component to receive  keyboard events, it needs to implement IFocusMangerComponent. And then,  however you're trying to receive keyboard events, by overriding  keyDownHandler, or listening for a keydown event, it should now receive  these events...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;easy when you know how!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;implements="mx.managers.IFocusManagerComponent"&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-9084882406159133018?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/9084882406159133018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=9084882406159133018' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/9084882406159133018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/9084882406159133018'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2010/09/frustrating-flex-problems-solved-6.html' title='Frustrating Flex problems solved #6 - Keydown'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-7981935875718993941</id><published>2010-09-03T03:18:00.000-07:00</published><updated>2010-09-22T07:20:53.674-07:00</updated><title type='text'>Frustrating Flex problems solved #5 - ButtonBarButton bugs</title><content type='html'>&lt;span style="font-family:arial;"&gt;So i had a series of custom Buttons all set up perfectly in a ButtonBar, when I realised that the design dictated that one of the buttons was a different size than was happening with the automatic sizing system...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So after discovering that the ButtonBar does not allow facility for resizing the width of a button, I had the choice. If i was going to extract the buttons from the ButtonBar, it probably would make sense to have them as a different type - Button for example. But reskinning my buttons as a different type could be time-consuming so I thought I'd see how I go just using ButtonBarButtons that aren't in a ButtonBar!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;All turned out fine, except that my labels weren't appearing. A little delving into the code and I discovered the following code inside spark.components.supportClasses.ButtonBase:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;// Push down to the part only if the label was explicitly set&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;            if (_content !== undefined)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;                labelDisplay.text = label;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;For my two cents, there's something strange going on there... So to set the label, I need to put the text inside the label property, and i need to ensure that content is not undefined. Set content to something arbitrary and the label appears! weird...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;s:ButtonBarButton label="Title" content="nada"/&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;s:buttonbarbutton label="Title" content="nada"&gt;&lt;/s:buttonbarbutton&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-7981935875718993941?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/7981935875718993941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=7981935875718993941' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7981935875718993941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7981935875718993941'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2010/09/frustrating-flex-problems-solved-5.html' title='Frustrating Flex problems solved #5 - ButtonBarButton bugs'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-4095246670388139610</id><published>2010-04-08T12:58:00.000-07:00</published><updated>2010-04-20T07:22:45.381-07:00</updated><title type='text'>XML read error in AIR</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;Back to blogging, working on a couple of projects:&lt;br /&gt;&lt;br /&gt;I was importing an XML file using the standard technique of using a URLLoader, and in the result handler, setting the XML file with:&lt;br /&gt;&lt;span style="font-size:78%;"&gt;var result:XML = new XML(event.target.data);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;But I found I had to move this to the FileStream class in an AIR application because the user had to specify the XML file to load. So I used:&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;var result:XML  &lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;span style="font-size:78%;"&gt;= new XML(stream.readUTFBytes(stream.bytesAvailable));&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Suddenly I was getting a 1088 error on this line:&lt;br /&gt;&lt;span style="font-size:78%;"&gt;TypeError: Error #1088: The markup in the document following the root element must be well-formed.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;After checking and rechecking the XML, I found that for some reason, there was a byte at the beginning of the byteString, which was causing havoc with reading the XML. So the String being returned by the readUTFBytes method had to truncate the first character. Like so:&lt;span style="font-size:78%;"&gt;&lt;br /&gt;var fileData:String = stream.readUTFBytes(stream.bytesAvailable);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;var result:XML&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;span style="font-size:78%;"&gt; = new XML(fileData.substr(1));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-4095246670388139610?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/4095246670388139610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=4095246670388139610' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4095246670388139610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4095246670388139610'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2010/04/back-to-blogging-working-on-couple-of.html' title='XML read error in AIR'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-3142740105008724233</id><published>2009-11-16T10:04:00.001-08:00</published><updated>2009-11-16T10:28:58.437-08:00</updated><title type='text'>latin flash tour</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_c566dmwpTzs/SwGZmPy433I/AAAAAAAABAQ/E5AIcLVOjZE/s1600/IMG_2579.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5404769910175358834" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 300px" alt="" src="http://4.bp.blogspot.com/_c566dmwpTzs/SwGZmPy433I/AAAAAAAABAQ/E5AIcLVOjZE/s400/IMG_2579.JPG" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;Went to the Latin Flash tour last week in Bogotá, and met Lee Brimelow. He went over and demonstrated some of the latest updates to Flash CS5 and the FlashPlayer 10.2.&lt;br /&gt;&lt;br /&gt;Features that got my interest: &lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;code snippets panel(frequently used code - similar to the old flash simple mode in old versions of Flash that people have complained about disappearing for years!)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;code hinting(although I´ll probably keep using FlashDevelop)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;FLA format is now an open format XML based file (with extension XFL) with all media external.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Font embedding panel - embedded fonts can be managed more easily&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;TLF text - a new text layout format which allows columns more easily(with editable text too!)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Multitouch event handling(if your hardware can handle it of course!)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Access to microphone data(turn your voice into darth vader apps coming up!)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Uncaught error event - Finally you don´t have to ensure you are catching every error possible to avoid the user ever getting a Flash uncaugh error message.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;AIR - open a filetype with the default app&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;AIR - Filemanager API can now catch volume state change events(i.e. if the user plugs in a hard drive)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;BUT of course! The feature that everyone talking and every question from the audience was about, was that Flash now has a feature to publish apps for the IPhone! No IPhone still doesn´t have a Flash Player, Flash packages for a native IPhone runtime. And the answer to almost every question about ´can the iphone apps do this´and ´can the iphone apps do that´was yes, it can do everything that the Flash player can do!(with the caveat that you just have to consider that performance might be worse on the Iphone)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-3142740105008724233?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/3142740105008724233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=3142740105008724233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3142740105008724233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3142740105008724233'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/11/latin-flash-tour.html' title='latin flash tour'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_c566dmwpTzs/SwGZmPy433I/AAAAAAAABAQ/E5AIcLVOjZE/s72-c/IMG_2579.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-113562668715994578</id><published>2009-11-03T15:03:00.000-08:00</published><updated>2009-11-03T15:20:10.826-08:00</updated><title type='text'>Where in the world is Craig?</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_c566dmwpTzs/SvC6Hb7RU4I/AAAAAAAABAA/pOHrckp8-n8/s1600-h/4057084622_03fec50efd.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5400020590135432066" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 163px" alt="" src="http://1.bp.blogspot.com/_c566dmwpTzs/SvC6Hb7RU4I/AAAAAAAABAA/pOHrckp8-n8/s400/4057084622_03fec50efd.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;There´s been not much movement in this blog for a while because I´ve been travelling South America for a few months and am currently in Bogotá, Colombia. If by chance anyone in Bogotá is reading this, give me a shout. Would be very interested in meeting local Flash developers.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;In other Flash news, I´m heading to the Adobe Latin Flash Tour next Friday with Lee Brimelow speaking, will post an update here afterwards.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-113562668715994578?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/113562668715994578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=113562668715994578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/113562668715994578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/113562668715994578'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/11/where-in-world-is-craig.html' title='Where in the world is Craig?'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_c566dmwpTzs/SvC6Hb7RU4I/AAAAAAAABAA/pOHrckp8-n8/s72-c/4057084622_03fec50efd.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-3655429311552246279</id><published>2009-06-28T23:49:00.000-07:00</published><updated>2009-06-28T23:53:06.405-07:00</updated><title type='text'>Embedded fonts disappearing when loaded into another SWF</title><content type='html'>&lt;span style="font-family:arial;"&gt;I once found that when an AS3 flash movie(let's call it parent) that contained a UIComponent, loaded another AS3 flash movie(let's call it child) that contained a UIComponent with embedded fonts, the component within the child lost its embedded fonts.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I also discovered that if the parent contained the font, then the component in the child was then able to find the embedded font, and all was well.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;However, this isn't an ideal situation, because I could imagine that you sometimes want the child movie to be able to operate independent of the parent, manage its own font embedding, or maybe not waste loading time of fonts in the main parent movie that may not even be required if the child isn't navigated to.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I was prompted to revisit this dilemma in a &lt;/span&gt;&lt;a style="font-family: arial;" href="http://forums.adobe.com/thread/453351?tstart=0"&gt;forum post&lt;/a&gt;&lt;span style="font-family:arial;"&gt;, and it got me wondering what was going on. I can't find documentation to confirm, but I have a theory that once the parent has a UI Component it then tries to take over handling of the list of global Fonts that the child tries to access. This list of global Fonts maintained by the parent, doesn't by default have access to Fonts embedded in SWFs it loads.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;However to give the parent access to the font, the child needs to register its font with the global list with:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;Font.registerFont(ComicSans);   //ComicSans for example&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;This ensures that when the parent takes over handling of the global list of fonts, it has access to the font the child has embedded.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-3655429311552246279?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/3655429311552246279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=3655429311552246279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3655429311552246279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3655429311552246279'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/06/i-once-found-that-when-as3-flash.html' title='Embedded fonts disappearing when loaded into another SWF'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-6433315947616095178</id><published>2009-05-20T19:44:00.000-07:00</published><updated>2009-05-20T21:57:02.365-07:00</updated><title type='text'>Component styling utility function</title><content type='html'>&lt;span style="font-family: arial;font-size:100%;" &gt;In addition to an earlier post &lt;a href="http://craiggrummitt.blogspot.com/2008/02/styling-text-in-instances-of-components.html"&gt;here&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;I have put the sample code into a simple utility function that will apply a TextFormat style to any component or TextField, without needing to consider the specific syntax of the component.&lt;br /&gt;&lt;br /&gt;You can download this &lt;a href="http://craiggrummitt.x10hosting.com/store/StyleUtils.as"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-6433315947616095178?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/6433315947616095178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=6433315947616095178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6433315947616095178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6433315947616095178'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/05/component-styling-utility-function.html' title='Component styling utility function'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-1291806377563457766</id><published>2009-05-13T23:37:00.000-07:00</published><updated>2009-05-13T23:39:05.998-07:00</updated><title type='text'>'as' isn't the equivalent of typing.</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: arial;"&gt;I guess I hadn't thought too deeply about it, but I always thought that the 'as' Operator was the equivalent of typing a variable.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;pseudo code example:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;type(x) = as type&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;or to give a real world example:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: arial;"&gt;var myVar:String='3';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;var myInt:int=int(myVar);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;//or alternatively:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;var myInt2:int=myVar as int;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;trace(myInt,myInt2);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;But this code will trace:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: arial;"&gt;3 0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;I've realised that while typing a variable actually converts the variable to the requested datatype, 'as' merely informs the compiler to expect a certain variable to be of a certain datatype.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;In the above example, 'myString as int' doesn't work because myString isn't an int.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;However, if initially we had defined myVar like so:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: arial;"&gt;var myVar:*=3;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;The code would have no problem as myVar is an int.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-1291806377563457766?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/1291806377563457766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=1291806377563457766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/1291806377563457766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/1291806377563457766'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/05/as-isnt-equivalent-of-typing.html' title='&apos;as&apos; isn&apos;t the equivalent of typing.'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8538037699259455714</id><published>2009-03-03T18:12:00.000-08:00</published><updated>2011-10-10T21:33:20.757-07:00</updated><title type='text'>ComboBox direction</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2009/03/04/combobox-direction/"&gt;moved.&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;I needed to force the Flex ComboBox to open in a specific direction. (I'm using a &lt;a href="http://drumbeatinsight.com/"&gt;HTML Component FCKEditor&lt;/a&gt;, which has to be on top, so I need to aim the ComboBox away from it, so it doesn't animate underneath it)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;It seems as though the only way to do this in Flex is to edit the mx.controls.ComboBox class itself.  With some help from &lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;a href="http://www.typeoneerror.com/forcing-combobox-component-open-direction-in-flex/" style="font-family: arial;"&gt;typeoneerror&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;,  I went ahead and did just that:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;i added two booleans to the class to use to force the comboBox's direction:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;public var forceDirectionDown:Boolean = false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;public var forceDirectionUp:Boolean   = false;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;now in the displayDropdown method, inside the 'opening the dropdown' section,  i just changed the if statement:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;if (forceDirectionUp || (!forceDirectionDown &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;point.y + _dropdown.height &amp;gt; screen.height &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;point.y &amp;gt; _dropdown.height))&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;There is still a problem, however - when I set the Combo to 'forceDirectionDown' and there isn't enough room at the bottom of the screen, when the dropdown closes, it assumes to animate the dropdown down, away from the combo. To resolve this, I added to the 'closing the dropdown' section, where it sets endY. I changed the condition line to:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;endY = (forceDirectionUp || (!forceDirectionDown &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;(point.y + _dropdown.height &amp;gt; screen.height || tweenUp)) &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8538037699259455714?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8538037699259455714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8538037699259455714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8538037699259455714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8538037699259455714'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/03/combobox-direction.html' title='ComboBox direction'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-2581731838120672421</id><published>2009-02-28T22:28:00.000-08:00</published><updated>2009-03-01T14:13:28.260-08:00</updated><title type='text'>"Color" component parameter</title><content type='html'>&lt;span style="font-family:arial;"&gt;I never really understood why when you define a component parameter, you can define its type. Wouldn't the variable type that the parameter is related to, always define the type of the parameter? Aren't parameter and variable types synonymous? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Well, it turns out that they are not necessarily.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I've never paid much attention to the fact that you can specify the 'type' of a parameter in the Inspectable tag, as it was obvious to me that this would be the same as the variable type.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;But I've discovered at least one case where this is not so.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Attempting to define an Inspectable variable as type 'fl.motion.Color' seems to work okay - it invokes the Color Picker in the Component Inspector when you click on the component on the stage. However when in the Component Inspector when you change the color from the default, and run the file, you'll get:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;1067: Implicit coercion of a value of type int to an unrelated type fl.motion:Color." error.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Obviously Flash expects the parameter of type 'color' to be related to a variable of type 'int'. Seems a little strange but there is a way to get around this apparent conflict between parameter and variable types of 'color':&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Specify the parameter to be of type 'Color' and the variable to be of type 'int'.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;package &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    import flash.display.MovieClip;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    &lt;/span&gt;&lt;span style="font-family:arial;"&gt;public class test extends MovieClip&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        &lt;/span&gt;&lt;span style="font-family:arial;"&gt;private var _color:int;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        [Inspectable (type = "Color")]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        public function get color():int { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            return _color; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        &lt;/span&gt;&lt;span style="font-family:arial;"&gt;public function set color(value:int):void &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            _color = value;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        &lt;/span&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-2581731838120672421?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/2581731838120672421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=2581731838120672421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2581731838120672421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2581731838120672421'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/02/color-component-parameter.html' title='&quot;Color&quot; component parameter'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8577113689932394193</id><published>2009-02-10T19:20:00.000-08:00</published><updated>2011-10-10T21:33:37.045-07:00</updated><title type='text'>Flex - skinning the DateField icon</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2009/02/11/flex-skinning-the-datefield-icon/"&gt;moved&lt;/a&gt;. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;When adjusting the Date icon skin in a DateField component, its not sufficient to just use the css that Flex auto-generates when importing the Skin Artwork. In addition to 'skin', you must also specify that upSkin, overSkin, downSkin, disabledSkin are all set to null. otherwise they will supersede 'skin'. you do this for example, like so:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;DateField {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;    skin: Embed(skinClass="DateField_skin");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;    upSkin: ClassReference(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;    overSkin: ClassReference(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;    downSkin: ClassReference(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;    disabledSkin: ClassReference(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8577113689932394193?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8577113689932394193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8577113689932394193' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8577113689932394193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8577113689932394193'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/02/flex-skinning-datefield-icon.html' title='Flex - skinning the DateField icon'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-7396901009185806646</id><published>2009-01-19T15:15:00.000-08:00</published><updated>2009-01-19T15:38:05.417-08:00</updated><title type='text'>adding classes dynamically Part II</title><content type='html'>&lt;span style="font-family:arial;"&gt;A little addition to a &lt;/span&gt;&lt;a style="font-family: arial;" href="http://craiggrummitt.blogspot.com/2007/11/adding-symbol-dynamically-from-library.html"&gt;previous post&lt;/a&gt;&lt;span style="font-family:arial;"&gt; on adding symbols dynamically from the library. I was having difficulty adding classes(that weren't in the library) dynamically - they weren't being recognised. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; &lt;span style="font-size:78%;"&gt;var classRef:Class = getDefinitionByName("Square") as Class;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; var shape:IShape= new classRef() as IShape;&lt;br /&gt;//Flash displays: ReferenceError: Error #1065: Variable Square is not defined.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;With help from Aaron Beall(on &lt;/span&gt;&lt;a style="font-family: arial;" href="http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=665&amp;amp;threadid=1393183"&gt;adobe forums&lt;/a&gt;&lt;span style="font-family:arial;"&gt;) who was having the same problem, i've realised that obviously flash doesn't know to compile the class if it only exists in a string. So we need to ensure that flash compiles every possible class that we may refer to dynamically. We can do this simply by declaring a variable of that class type.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:78%;"&gt;var squareRef:Square;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-7396901009185806646?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/7396901009185806646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=7396901009185806646' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7396901009185806646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7396901009185806646'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2009/01/adding-classes-dynamically-part-ii.html' title='adding classes dynamically Part II'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-3227420565040911986</id><published>2008-12-10T15:29:00.000-08:00</published><updated>2008-12-10T15:30:20.910-08:00</updated><title type='text'>CS4 component icon library bug.</title><content type='html'>&lt;span style="font-family: arial;"&gt;I've been wondering why items in my library disappear occasionally - including the library buttons and column headers!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;I've narrowed the problem down to a CS4 bug.&lt;/span&gt; &lt;span style="font-family: arial;"&gt;Steps to reproduce bug:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 1.Create a MovieClip&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 2. Select 'Component Definition'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 3. Add a parameter so that the component icon will become visible.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 4. Select 'Seek Bar Control Icon' or 'Buffering Control Icon' as custom component icon.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 5. Select 'OK'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; 6. Watch the craziness ensue!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-3227420565040911986?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/3227420565040911986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=3227420565040911986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3227420565040911986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3227420565040911986'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/12/cs4-component-icon-library-bug.html' title='CS4 component icon library bug.'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-1796882266243421471</id><published>2008-11-18T21:07:00.000-08:00</published><updated>2008-12-09T22:42:54.828-08:00</updated><title type='text'>jerky raster animations</title><content type='html'>&lt;span style="font-family:arial;"&gt;It has always bothered me that animations of raster images are always jerky when they get to the point of animating less than a pixel per frame. Flash assumes that rasters should only live on the exact pixel. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;This can be resolved with bitmaps that are created with ActionScript with the Bitmap.pixelSnapping value but for pure animation is a little more complicated.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I've just discovered that if you adjust the scale, rotation or skew of the image, Flash will turn pixelSnapping off. So giving a slight degree(more than 0.1%) of one of these factors is the simplest way to demand no pixelSnapping, without requiring one line of ActionScript.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-1796882266243421471?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/1796882266243421471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=1796882266243421471' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/1796882266243421471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/1796882266243421471'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/11/jerky-raster-animations.html' title='jerky raster animations'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-4123833648041856879</id><published>2008-10-14T22:29:00.000-07:00</published><updated>2008-10-14T23:02:19.965-07:00</updated><title type='text'>Stage dimension limitation - 214x137</title><content type='html'>&lt;span style="font-family: arial;"&gt;I was trying to work out why the Flash Player Settings window was not appearing when i attached a webcam to a Video object, when i discovered that my stage was too small. Although i can't find documentation for this feature anywhere, I have found through experimentation that for the Settings Window to appear, the stage must be a minimum of 214x137.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-4123833648041856879?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/4123833648041856879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=4123833648041856879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4123833648041856879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4123833648041856879'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/10/stage-dimension-limitation-214x137.html' title='Stage dimension limitation - 214x137'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-5521118790150507261</id><published>2008-09-15T18:37:00.001-07:00</published><updated>2008-09-15T18:37:56.900-07:00</updated><title type='text'>stage.mouseLeave and wmode=transparent</title><content type='html'>&lt;span style="font-family: arial;"&gt;noted a strange incompatibility today - the stage.mouseLeave event doesn't get triggered when you hold a mouse button down, and drag off stage on a flash object which has wmode set to transparent. in fact doing so takes the focus off the flash object so that regular stage events no longer get triggered until it receives focus again(say by the user clicking on the object).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;sounds obscure, but if someone's dragging a slider and somehow drags off the object, releases the mouse button and then returns to the object, the slider continues to move around with the mouse even though the mouseButton isn't down.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-5521118790150507261?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/5521118790150507261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=5521118790150507261' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/5521118790150507261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/5521118790150507261'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/09/stagemouseleave-and-wmodetransparent.html' title='stage.mouseLeave and wmode=transparent'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8895323375437138454</id><published>2008-08-13T18:46:00.000-07:00</published><updated>2008-11-04T04:51:10.628-08:00</updated><title type='text'>dynamic text fields part II</title><content type='html'>&lt;span style="font-family:arial;"&gt;just got back from a six week holiday, so was wondering if i'd lost my mind while i was away...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;steps to recreate weird problem:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1. set up two dynamic text boxes on the stage - one bold and one not bold - both with letter spacing of 1.(hint at solution) give them instance names - text1 and text2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. set their text attributes in actionscript eg.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;text1.text="hello";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;text2.text="there";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. run out - notice that neither text box is bold.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;for some bizarre reason, giving the text box a letter spacing value!=0 means that it loses its formatting when you set its text value.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;to resolve either set letter spacing to 0, or follow my earlier post in setting text with a letter spacing value.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8895323375437138454?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8895323375437138454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8895323375437138454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8895323375437138454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8895323375437138454'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/08/dynamic-text-fields-part-ii.html' title='dynamic text fields part II'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8057331360693235345</id><published>2008-06-30T22:16:00.000-07:00</published><updated>2008-06-30T22:30:01.520-07:00</updated><title type='text'>Frusting Flex problems solved #4 - preventing a DataGrid column from resizing</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;What a laborious problem this was!&lt;br /&gt;&lt;br /&gt;I had set up a DataGrid that resized with the browser, and the user could also resize the column widths. However one column contained a button, and needed to not be resizable by the user or by browser resizing. But in practice, the button was resizing smaller and smaller every time the browser was resized. After many forum postings a solution was suggested(thanks VarioPegged) that is not the most elegant but works:&lt;br /&gt;&lt;br /&gt;To recap, three steps must be followed:&lt;br /&gt;&lt;br /&gt;1. add a dummy datagridcolumn to the far right of the datagrid that is not resizable and has a width of 0.&lt;br /&gt;2. give the column you don't want to resize a minWidth value.&lt;br /&gt;3. set up an updateComplete event handler on the datagrid, which resizes the button column and then calls validateNow() on the datagrid.&lt;br /&gt;&lt;br /&gt;you can follow the newsgroup post on this issue &lt;a href="http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&amp;amp;threadid=1370825"&gt;&lt;span style="text-decoration: underline;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;.&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8057331360693235345?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8057331360693235345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8057331360693235345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8057331360693235345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8057331360693235345'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/06/frusting-flex-problems-solved-4.html' title='Frusting Flex problems solved #4 - preventing a DataGrid column from resizing'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8279546860238839869</id><published>2008-06-18T22:59:00.000-07:00</published><updated>2011-10-10T21:13:56.330-07:00</updated><title type='text'>dynamic text field part I - letter spacing</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2008/06/19/dynamic-text-field-part-i-letter-spacing/"&gt;moved&lt;/a&gt;. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;Just discovered that flash resets the author-time letter spacing of a dynamic textfield when the textfield's text is set in ActionScript.&lt;br /&gt;&lt;br /&gt;To maintain the authortime &lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;letter spacing &lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;settings of the textfield, you need to record the textfield's textformat, set the text, and then reset the textfield's textformat to what it was. For example, if your textfield's instance name is test:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 78%;"&gt;var fmt:TextFormat = test.getTextFormat();&lt;br /&gt;test.text="New text";&lt;br /&gt;test.setTextFormat(fmt);&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;something to check is that if the textfield does not contain any text, the author-time TextFormat &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;letter spacing &lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;property is not recorded. So if you don't want your textfield to contain any text, make sure the textfield contains at least one space to ensure it maintains its author-time TextFormat &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;letter spacing &lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;property.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8279546860238839869?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8279546860238839869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8279546860238839869' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8279546860238839869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8279546860238839869'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/06/kerning-of-dynamic-text-field.html' title='dynamic text field part I - letter spacing'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-2090184971716630851</id><published>2008-04-22T20:02:00.000-07:00</published><updated>2008-04-22T20:05:03.201-07:00</updated><title type='text'>Frustrating Flex problems solved #3 - DataGrid scrolling error</title><content type='html'>&lt;span style="font-size:100%;"&gt;I'm currently working on a project that requires me to be using Flex 2 rather than Flex 3(I'm using an older version of Zinc, and avoiding upgrading if possible as we'll probably be moving to AIR after this project). But - issues in Flex 2 are no longer supported...&lt;br /&gt;&lt;br /&gt;The problem i encountered was when changing the DataGridColumns and dataProvider of a DataGrid, it gave a #1010 error 'A term is undefined and has no properties.' when scrolling vertically.&lt;br /&gt;&lt;br /&gt;After trawling the web for answers, I found a diamond &lt;a href="http://www.wietseveenstra.nl/blog/2007/03/27/flex-listbase-scroll-vertically-error/"&gt;here&lt;/a&gt; from Marc Sulinski, who suggested the hack of extending the DataGrid class and overriding updateDisplayList with the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;override protected function updateDisplayList(w:Number, h:Number):void {&lt;br /&gt;var b:Boolean = false;&lt;br /&gt;&lt;br /&gt;if( rendererChanged ) b = true;&lt;br /&gt;&lt;br /&gt;super.updateDisplayList(w, h);&lt;br /&gt;if( b ) {&lt;br /&gt;while( rowInfo.length &gt; listItems.length ) rowInfo.pop();&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-2090184971716630851?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/2090184971716630851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=2090184971716630851' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2090184971716630851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2090184971716630851'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/04/frustrating-flex-problems-solved-3.html' title='Frustrating Flex problems solved #3 - DataGrid scrolling error'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-7581974839665798921</id><published>2008-04-01T15:45:00.000-07:00</published><updated>2008-09-29T23:58:09.476-07:00</updated><title type='text'>ObjectCollection</title><content type='html'>&lt;span style="font-family:arial;"&gt;i'd set up a repeater to display data returned from a ColdFusion call - which would either be a Y or N. I wanted to adjust how this appears to YES or NO, and thought a straightforward way of doing this would be set up an associative array:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;[Bindable]&lt;br /&gt;public static var yesNoTranslator:Object={N: "No",Y: "Yes"};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and my text component would look something like:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&amp;lt;text="{Constants.yesNoTranslator[repeater.currentItem.rsvpStatus]}"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Flex Builder produced warnings on this, however:&lt;br /&gt;"Data binding will not be able to detect changes when using square bracket operator. For Array, please use ArrayCollection.getItemAt() instead."&lt;br /&gt;&lt;br /&gt;Though in this case, i could ignore the warning and the app would work as desired, i could see that sometimes you may want your associative array to change and the binding wouldn't detect changes. Anyway, warnings are annoying to have hanging around, and for some strange reason they seem to propogate themselves in Flex Builder...&lt;br /&gt;&lt;br /&gt;As the warning describes, if yesNoTranslator was an array, i could use ArrayCollection.getItemAt() instead. yesNoTranslator was an object and there is no equivalent with objects(for some reason), so i thought the simplest thing to do would be to create one, which i've called ObjectCollection:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;package&lt;br /&gt;{&lt;br /&gt;import mx.utils.ObjectProxy;&lt;br /&gt;&lt;br /&gt;public class ObjectCollection extends ObjectProxy&lt;br /&gt;{&lt;br /&gt;public function ObjectCollection(item:Object=null, uid:String=null, proxyDepth:int=-1)&lt;br /&gt;{&lt;br /&gt;super(item, uid, proxyDepth);&lt;br /&gt;}&lt;br /&gt;[Bindable(event="propertyChange")]&lt;br /&gt;public function getItemAt(index:String):Object {&lt;br /&gt;return(this[index]);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and modify my above code to:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;[Bindable]&lt;br /&gt;public var yesNoTranslator:ObjectCollection=new ObjectCollection({Y:"Yes",N:"No"});&lt;br /&gt;&lt;br /&gt;&lt; text="{yesNoTranslator.getItemAt(repeater.currentItem.rsvpStatus)}"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-7581974839665798921?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/7581974839665798921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=7581974839665798921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7581974839665798921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7581974839665798921'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/04/id-set-up-repeater-to-display-data.html' title='ObjectCollection'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-7055696051279408438</id><published>2008-03-27T19:31:00.000-07:00</published><updated>2008-03-27T19:32:29.059-07:00</updated><title type='text'>An Internal Build Error has occurred...</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;span style="font-family: arial;"&gt;public var interactionType:String=INTERACT_DRAG=INTERACT_FORM;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;This line of code just wasted 4 hours of my life.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Flex didn't notice that there was a problem, and it was only in building that a problem arose with the line 'Classes must not be nested.' and then the more obscure 'An internal build error has occured' Location: UNKNOWN.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;So it was down to me looking through my thousands of lines of code to find the problem. I ended up restoring a backup  of my code and comparing the two until i narrowed it down to the above line...&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-7055696051279408438?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/7055696051279408438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=7055696051279408438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7055696051279408438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7055696051279408438'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/03/internal-build-error-has-occurred.html' title='An Internal Build Error has occurred...'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-2668187913102998233</id><published>2008-03-19T21:28:00.000-07:00</published><updated>2008-03-27T05:45:54.117-07:00</updated><title type='text'>deployment issues</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;just finishing up an alpha version of a Flex project and discovering a couple of deployment issues that are worth getting down for future -&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;i was getting a persistent 'Where is the debugger or host application running?' popup window for my swf. i discovered that this occurs for specific versions of the flash player and the most recent flash player ignores the lack of debugger. however i wasn't too keen in forcing my users to install the very latest flash player if it was otherwise unnecessary, so found that i could also add the compiler argument: (in the Flex Project Properties, Flex Compiler tab)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;-debug=false&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Next i was getting a #2032 error. I discovered that this meant that the framework.swf file wasn't being found. This was happening because the final html file that displayed the swf was not where flex was putting it, so it wasn't finding the framework.swf(which was set to RSL, rather than Merged with Code, to save the user download time). To resolve this, I adjusted the path to the framework url. (in the Flex Project Properties, Flex Build Path, Library Path, Flex 3..., framework.swc, RSL URL)&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-2668187913102998233?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/2668187913102998233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=2668187913102998233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2668187913102998233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2668187913102998233'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/03/deployment-issues.html' title='deployment issues'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-735557062163309427</id><published>2008-02-03T16:01:00.000-08:00</published><updated>2011-10-10T21:17:04.577-07:00</updated><title type='text'>Styling Text In Instances Of Components Using TextFormat</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2008/02/04/styling-text-in-instances-of-components-using-textformat/"&gt;moved&lt;/a&gt;. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;this is&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt; an extension of a previous entry &lt;a href="http://craiggrummitt.blogspot.com/2007/09/it-took-me-quite-while-and-variety-of.html"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;&lt;br /&gt;&lt;br /&gt;Text in components or TextFields can be formatted in several ways - applying styles manually in the case of TextFields, applying a style using a TextFormat object, StyleSheets for styling html formatted text, or the StyleManager for setting global styles or styles for all instances of a component.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;This article focuses on styling instances of components or TextFields with an embedded font in a TextFormat object.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;The TextFormat Object would look something like this:&lt;/span&gt;&lt;br /&gt;&lt;div class="codetitle" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;//let's use red Comic Sans to make it obvious when it's working.&lt;br /&gt;//first embed Comic Sans in the library&lt;br /&gt;//select Linkage Properties on the font, select 'Export for ActionScript' and give it the Class name of 'ComicSans'.&lt;br /&gt;var format:TextFormat=new TextFormat();&lt;br /&gt;format.font=new ComicSans().fontName;&lt;br /&gt;format.color=0xFF0000;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;Use the following code to apply this TextFormat style to the following display object types(all of which i've assumed have the instance name 'whichObject'.)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small; font-weight: bold;"&gt;TextField&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;whichObject.embedFonts=true;&lt;br /&gt;whichObject.defaultTextFormat=format;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small; font-weight: bold;"&gt;Button, TextArea, TextInput, Label, NumericStepper, RadioButton, CheckBox&lt;/span&gt;&lt;br /&gt;&lt;div class="codetitle" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;whichObject.setStyle("embedFonts", true);&lt;br /&gt;whichObject.setStyle("textFormat", format);&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small; font-weight: bold;"&gt;ComboBox&lt;/span&gt;&lt;br /&gt;&lt;div class="codetitle" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;whichObject.textField.setStyle("embedFonts", true); //textField is the item displayed in the combo box&lt;br /&gt;whichObject.textField.setStyle("textFormat", format);&lt;br /&gt;whichObject.dropdown.setRendererStyle("embedFonts", true); //dropdown is the list of options&lt;br /&gt;whichObject.dropdown.setRendererStyle("textFormat", format);&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small; font-weight: bold;"&gt;List&lt;/span&gt;&lt;br /&gt;&lt;div class="codetitle" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;whichObject.setRendererStyle("embedFonts", true);&lt;br /&gt;whichObject.setRendererStyle("textFormat", format);&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small; font-weight: bold;"&gt;DataGrid&lt;/span&gt;&lt;br /&gt;&lt;div class="codetitle" style="font-family: arial;"&gt;&lt;span style="font-size: xx-small;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codecontent" style="font-family: arial;"&gt;&lt;span style="font-size: 78%;"&gt;&lt;span style="font-size: xx-small;"&gt;whichObject.setRendererStyle("embedFonts", true);&lt;br /&gt;whichObject.setRendererStyle("textFormat", format);&lt;br /&gt;whichObject.setStyle("headerTextFormat", format); //styles the datagrid's header&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: xx-small; font-weight: bold;"&gt;STOP PRESS:&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;br /&gt;Update to this post &lt;a href="http://craiggrummitt.blogspot.com/2009/05/component-styling-utility-function.html"&gt;here&lt;/a&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-735557062163309427?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/735557062163309427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=735557062163309427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/735557062163309427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/735557062163309427'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/02/styling-text-in-instances-of-components.html' title='Styling Text In Instances Of Components Using TextFormat'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-4577499922184665162</id><published>2008-01-15T02:49:00.000-08:00</published><updated>2008-01-15T02:53:38.583-08:00</updated><title type='text'>Embedding external assets</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: arial;"&gt;Strange, strange. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;If you've embedded a Flash object inside a html page, and the Flash object loads external assets(images, SWFs, audio), the flash object locates the assets relative to the location of the html file and NOT relative to the swf file. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;However, if you're playing an FLV file using progressive download, the FLV is located relative to the SWF file and NOT relative to the html file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;I've actually been aware of this for a few years but thought that they'd resolve its inconsistency with one of the latest iterations of Flash. but no.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-4577499922184665162?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/4577499922184665162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=4577499922184665162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4577499922184665162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/4577499922184665162'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/01/embedding-external-assets.html' title='Embedding external assets'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-212803646435585838</id><published>2008-01-06T15:57:00.000-08:00</published><updated>2009-05-19T14:46:41.294-07:00</updated><title type='text'>positioning the cursor in a text field</title><content type='html'>positioning the cursor in flash can be a little tricky and sometimes temperamental, but we should be able to control where the cursor is with setSelection, with both beginIndex and endIndex set to the same position, for example the end of the input box:&lt;br /&gt;  testBox.setSelection(testBox.text.length,testBox.text.length);&lt;br /&gt;&lt;br /&gt;We may also need to first set the focus to the text box, if the focus may be elsewhere. If our 'text input' is a TextField of type 'input text', then set focus through the stage object:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;    stage.focus=testBox;&lt;br /&gt;  &lt;/span&gt;&lt;span style="font-size:78%;"&gt;testBox&lt;/span&gt;&lt;span style="font-size:78%;"&gt;.setSelection(testBox.text.length,testBox.text.length);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if we're using a TextInput component, use its built in setFocus method:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;     testBox.setFocus();&lt;br /&gt;  testBox.setSelection(testBox.text.length,testBox.text.length);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-212803646435585838?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/212803646435585838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=212803646435585838' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/212803646435585838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/212803646435585838'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2008/01/positioning-cursor-in-text-field.html' title='positioning the cursor in a text field'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8983765318210780730</id><published>2007-12-20T20:28:00.000-08:00</published><updated>2011-10-10T21:19:13.515-07:00</updated><title type='text'>printAsBitmap - object must be on stage</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2007/12/21/printasbitmap-object-must-be-on-stage/"&gt;moved&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;just for future reference, I've discovered today something that appears to be undocumented - when setting a PrintJob to printAsBitmap=true OR you are printing from a mac,(using the PrintJobOptions class) it is suddenly important that the &lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;object &lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;is on the stage, or it won't print.&lt;br /&gt;&lt;br /&gt;so if you didn't want your object on the stage, the simple solution is to surround your send with an addChild and removeChild like so:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;this.addChild(page);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;page.visible=false; //for macs only - otherwise they display the page while the print dialogue is open.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;var myOption:PrintJobOptions = new PrintJobOptions(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;my_pj.addPage(page,null,myOption);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;my_pj.send();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;this.removeChild(page);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8983765318210780730?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8983765318210780730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8983765318210780730' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8983765318210780730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8983765318210780730'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/12/printasbitmap-object-must-be-on-stage.html' title='printAsBitmap - object must be on stage'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-7842930668197490760</id><published>2007-12-16T15:08:00.000-08:00</published><updated>2011-10-10T21:32:32.032-07:00</updated><title type='text'>preloader absorbing application FlashVars</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2007/12/16/preloader-absorbing-application-flashvars/"&gt;moved&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;As has happened frequently, after completing a Flash application, I find that the size of the application demands a preloader swf to load the application swf (complete with progress bar). the problem i have found with this preloader swf is that it now absorbs any FlashVars that the application swf was expecting to be passed to it from the html. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;how to get the preloader to pass the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;FlashVars &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;to the application? well, the preloader could extract the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;FlashVars &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;and explicitly send them to the application in a function call once the application is loaded. but this would mean that the application would work differently than it would have prior to the loader. it could also mean that the preloader may have to be modified for each project, whereas a generic preloader would be much simpler.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;here is a solution that means the application works exactly the same, and the preloader can remain generic - within the preloader extract all the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;FlashVars&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;, and pass them along to the application&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt; as URLVariables&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt; in the URLRequest.data property&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;var ldr:Loader = new Loader();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;var url:String = "application.swf";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;var urlReq:URLRequest = new URLRequest(url);&lt;br /&gt;urlReq.data=getObjectURLVariables(this.loaderInfo.parameters)&lt;br /&gt;ldr.load(urlReq);&lt;br /&gt;this.addChild(ldr);&lt;/span&gt;&lt;span style="font-family: arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;public function getObjectURLVariables(whichObject:Object):URLVariables {&lt;br /&gt;var variables:URLVariables=new URLVariables();&lt;br /&gt;for (var i in whichObject) {&lt;br /&gt;variables[i]=whichObject[i];&lt;br /&gt;}&lt;br /&gt;return(variables);&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;You could quite easily set this up as a custom Loader class that automatically passes the FlashVars along to the loaded application.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-7842930668197490760?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/7842930668197490760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=7842930668197490760' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7842930668197490760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/7842930668197490760'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/12/preloader-absorbing-application.html' title='preloader absorbing application FlashVars'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-964556836789420466</id><published>2007-11-06T15:12:00.000-08:00</published><updated>2009-02-18T16:24:09.219-08:00</updated><title type='text'>adding a symbol dynamically from the library</title><content type='html'>&lt;span style="font-family:arial;"&gt;how to add a symbol from the library?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;in AS2,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;this.attachMovie("square", "square", 1);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and in AS3, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;var square1:square=new square();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;but how do you add a symbol dynamically from the library? say if you have a shape stored in a variable:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;var shape:String = "square";&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and you want to add the symbol in the library with this name.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;in AS2, simple! you could have written:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;this.attachMovie(shape, shape, 1);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;however the AS3 syntax doesn't obviously allow for dynamic references. so how is it done? (credit to kglad for assisting in this discovery)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;getDefinitionByName is what you need to extract the class from the library like so:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:arial;"&gt;import flash.utils.getDefinitionByName;&lt;br /&gt;&lt;br /&gt;var classRef:Class = getDefinitionByName(shape) as Class;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;var square1:* = new classRef();&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-964556836789420466?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/964556836789420466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=964556836789420466' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/964556836789420466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/964556836789420466'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/11/adding-symbol-dynamically-from-library.html' title='adding a symbol dynamically from the library'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-5543559673540317745</id><published>2007-11-06T14:47:00.000-08:00</published><updated>2011-10-10T21:35:02.486-07:00</updated><title type='text'>Frustrating Flex problems solved #2 - addChild</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial;"&gt;This blog has &lt;a href="http://craiggrummitt.wordpress.com/2007/11/06/frustrating-flex-problems-solved-2-addchild/"&gt;moved&lt;/a&gt;. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;this.addChild(new Sprite())&lt;br /&gt;&lt;br /&gt;looks simple enough doesn't it? especially if you've been working solely in Flash AS3. But if you try this line within a Flex component, you'll receive the error: 'Type Coercion failed: cannot convert flash.display::Sprite@86cc0e1 to mx.core.IUIComponent.'&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;This is because Flex components implement a different addChild method. although addChild is described as accepting a DisplayObject as a parameter, this DisplayObject must implement the IUIComponent interface.&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;How to add a sprite then? You can either:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;specify a UIComponent. eg:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;this.addChild(new UIComponent())&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial; font-size: xx-small;"&gt;This sort of works in this case as UIComponent implements the Sprite. However the additional implementation of UIComponent may at best be unnecessary and at worst cause problems with your code. Also, this alternative won't work in some cases, say if for some reason you wanted to add a MovieClip.&lt;br /&gt;&lt;br /&gt;so an alternative is that you can add your child to the component's rawChildren, a property which contains a list of ALL of the container's children - not just the children that the container wants you to know about! (this.numChildren&amp;lt;=this.rawChildren.numChildren) see flex help for more info on this. this alternative looks like:   &lt;/span&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="font-family: arial;"&gt;this.rawChildren.addChild(new Sprite())&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-5543559673540317745?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/5543559673540317745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=5543559673540317745' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/5543559673540317745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/5543559673540317745'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/11/how-to-add-children-in-flex.html' title='Frustrating Flex problems solved #2 - addChild'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-6287325329303981743</id><published>2007-09-25T23:42:00.000-07:00</published><updated>2007-09-26T00:03:20.454-07:00</updated><title type='text'>Embedding a font in a component</title><content type='html'>&lt;span style="font-family:arial;"&gt;it took me quite a while and a variety of sources to work out how to set an embedded font for use in a comboBox component in AS3, so i thought i would record the solution for others(and myself in future when i forget!).&lt;br /&gt;&lt;br /&gt;Here are steps to follow:&lt;br /&gt;&lt;br /&gt;Step 1. add the font you wish to embed to the library, set it to 'Export for ActionScript' and give it a Class name.(in this case 'ComicSans')&lt;br /&gt;Step 2. add a comboBox component to your stage.&lt;br /&gt;Step 3. add the following script:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;var Comic:TextFormat=new TextFormat();&lt;br /&gt;Comic.font=new ComicSans().fontName;&lt;br /&gt;Comic.size=12; //let's say we want to change the font size&lt;br /&gt;&lt;br /&gt;combo.textField.setStyle("embedFonts", true);&lt;br /&gt;combo.textField.setStyle("textFormat", Comic);&lt;br /&gt;combo.dropdown.setRendererStyle("embedFonts", true);&lt;br /&gt;combo.dropdown.setRendererStyle("textFormat", Comic);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A couple of points to be aware of:&lt;br /&gt;&lt;br /&gt;when setting your TextFormat font, don't use the font's linkage identifier directly, this property requires the name that the system uses when referring to the font.&lt;br /&gt;rather request the name of the font through the font class.&lt;br /&gt;i did this above with the line:&lt;br /&gt;&lt;span style="font-size:78%;"&gt;Comic.font=new ComicSans().fontName;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the font of the textfield within the combo needs to set, and the text within the list component(dropdown property) within the combo also needs to be set.&lt;br /&gt;these are set differently.&lt;br /&gt;while the textfield is set directly with setStyle, the list component is set indirectly, with setRendererStyle as there will be multiple textfields within the list component.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-6287325329303981743?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/6287325329303981743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=6287325329303981743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6287325329303981743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/6287325329303981743'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/09/it-took-me-quite-while-and-variety-of.html' title='Embedding a font in a component'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-3614316441290714590</id><published>2007-09-25T23:09:00.000-07:00</published><updated>2007-09-30T17:49:47.792-07:00</updated><title type='text'>ENTER_FRAME problem</title><content type='html'>&lt;span style="font-family:arial;"&gt;i've got an interesting conundrum for you all. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;According to Flash help, ENTER_FRAME "...does not go through a 'capture phase' and is dispatched directly to the target, whether the target is on the display list or not." &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and it is true that an object with an ENTER_FRAME event does seem to work okay if it's not on the display list. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;however, if you start loading external assets, it seems to forget about this ENTER_FRAME event at some random point in time! insert the code below into a frame, and replace imageFile with an actual external asset. the enterFrame function should count up from 1 to infinity, but instead at around 30(for me) it stops!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;however, if you add the MovieClip to the stage, it receives the ENTER_FRAME event without fail.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;const imageFile:String="put a swf here.swf";&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;var tally:int=0;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;var loadertally:int=0;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;setUpEnterFrame();&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;nextLoader();&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;function setUpEnterFrame() {&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    var newObject:MovieClip=new MovieClip();&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    newObject.addEventListener(Event.ENTER_FRAME,enterFrame);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    //this.addChild(newObject);  -------works when these comments are removed...&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;}&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;function nextLoader() {&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      var loader:Loader = new Loader();&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderDisplayed);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    var request:URLRequest = new URLRequest(imageFile);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    loader.load(request);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    moveToRandomPlace(loader);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    this.addChild(loader);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;}&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;function enterFrame(event:Event):void {&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    tally++;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    trace("&gt;&gt;&gt;&gt;enterFrame - "+tally);&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;}&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;function loaderDisplayed(event:Event):void {&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    loadertally++;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;    if (loadertally&lt;200)&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-family:arial;"&gt;        nextLoader();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-family:arial;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-family:arial;"&gt;    trace("loader complete - "+loadertally);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function moveToRandomPlace(whichObject:DisplayObject):void {&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-family:arial;"&gt;    whichObject.x=(Math.random()*stage.stageWidth);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;      &lt;/span&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;&lt;span style="font-family:arial;"&gt;    whichObject.y=(Math.random()*stage.stageHeight);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;STOP PRESS!&lt;br /&gt;&lt;br /&gt;I've resolved this issue with some credit to kglad in forums - the problem is that as newObject is a variable local to the nextLoader function, when this function is complete and is garbage collected, the EnterFrame no longer triggers... i initially encountered this problem with Tweens - it is a very easy mistake to make - something to be cautious of!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-3614316441290714590?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/3614316441290714590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=3614316441290714590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3614316441290714590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3614316441290714590'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/09/enterframe-flash-bug.html' title='ENTER_FRAME problem'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-9012866702588099404</id><published>2007-09-20T00:19:00.000-07:00</published><updated>2007-09-20T00:44:05.443-07:00</updated><title type='text'>labels that are numbers</title><content type='html'>&lt;span style="font-family:arial;"&gt;today i was given a movieClip of a candle slowly burning down. it had 15 states represented by numbered frame labels, and i wanted to go to the appropriate label based on the number of days the candle had been burning. the problem is, even if you convert the variable to a string, flash treats it as a number. so:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;days=14;&lt;br /&gt;gotoAndStop(String(days));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;even though this is a string, flash still interprets this as frame number rather than a frame label. it goes to frame 14, rather than label '14'. there may be a solution out there, but the only one i know is renaming all of the labels to include an alpha character. laborious...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;AS3 to the rescue!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;we now have access to available frame labels and the related frame numbers in an array. so assuming we know where which number label we're after - which is easy in my case where the labels where numbered from 1 to 15, we can easily access the label even if its name is a number:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;font-size:78%;" &gt;days=14;&lt;br /&gt;this.gotoAndStop(this.currentLabels[days-1].frame);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-9012866702588099404?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/9012866702588099404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=9012866702588099404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/9012866702588099404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/9012866702588099404'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/09/labels-that-are-numbers.html' title='labels that are numbers'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-2568722729327377924</id><published>2007-09-12T22:29:00.000-07:00</published><updated>2007-09-12T22:52:04.155-07:00</updated><title type='text'>double click problems</title><content type='html'>&lt;span style="font-family:arial;"&gt;Let's say we want to set up a standard doubleClick interaction on a movie-clip(draw a square inside this clip) with instance name square:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"  &gt;square.doubleClickEnabled=true;&lt;br /&gt;square.addEventListener(MouseEvent.DOUBLE_CLICK,double);&lt;br /&gt;function double(event:MouseEvent):void {&lt;br /&gt;trace("doubleclick");&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Compile, it should work fine - "doubleclick" should trace when you double click the square.&lt;br /&gt;&lt;br /&gt;Now place a movie-clip inside square with instance name circle(draw a circle inside this clip).&lt;br /&gt;&lt;br /&gt;Recompile. Notice that double-click isn't recognised if you double click on the circle...&lt;br /&gt;&lt;br /&gt;For some reason the circle movieClip is preventing the double-click event from bubbling up to square. forcing 'circle' to ignore the double-click and allow the event to continue on its merry way to 'square' is the best solution i have found:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:78%;"&gt;square.circle.mouseEnabled=false;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-2568722729327377924?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/2568722729327377924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=2568722729327377924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2568722729327377924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/2568722729327377924'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/09/double-click-problems.html' title='double click problems'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8050804939630883902</id><published>2007-08-17T01:56:00.000-07:00</published><updated>2007-09-02T18:14:57.640-07:00</updated><title type='text'>Weird sizing problem</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;After a lot of pulling my hair out trying to work out why my custom scrollbars weren't resizing correctly, thinking there must be a problem with my code, i've discovered that it's actually a strange problem with flash resizing movieclips containing objects with strokes that aren't hairline.&lt;br /&gt;&lt;br /&gt;to replicate the problem, do the following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_c566dmwpTzs/RsVnenq_OZI/AAAAAAAAAAM/upH40bvN2C8/s1600-h/uneven+bars.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://bp0.blogger.com/_c566dmwpTzs/RsVnenq_OZI/AAAAAAAAAAM/upH40bvN2C8/s320/uneven+bars.jpg" alt="" id="BLOGGER_PHOTO_ID_5099595928809978258" border="0" /&gt;&lt;/a&gt;1.  draw a rectangle 350 pixels high and say 10 pixels wide with a stroke width of 1.&lt;br /&gt;&lt;br /&gt;2.  draw a rectangle beside it 30 pixels high and 10 pixels wide with a stroke width of 1. convert this second rectangle to a movieClip and give it an instance name of test. turn on 9-slice scaling.&lt;br /&gt;&lt;br /&gt;3.  draw a rectangle beside test 30 pixels high and 10 pixels wide with a hairline stroke width. convert this third rectangle to a movieClip and give it an instance name of test2. turn on 9-slice scaling for this clip also.(although it doesn't need it as it is rectangular and uses hairline stroke - do this in the interests of consistency with the other clip for this test)&lt;br /&gt;&lt;br /&gt;4.  type the following in the frame's actions:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;test.height=350;&lt;br /&gt;test2.height=350;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5.  compile the movie, and notice that the movie clip called test, with a stroke width of 1, doesn't quite make the correct height, whilst the hairline clip works fine.&lt;br /&gt;&lt;br /&gt;what's going on?&lt;br /&gt;&lt;br /&gt;flash appears to get a little confused between the height of the clip including stroke,&lt;br /&gt;and the height of the fill.&lt;br /&gt;&lt;br /&gt;to illustrate this, click on the movieClip and notice that the properties show it to be 30 pixels high.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;trace(test.height);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;and notice that flash thinks it is 31 pixels high...&lt;br /&gt;&lt;br /&gt;so when flash calculates its new height, it is 1/31st off.&lt;br /&gt;&lt;br /&gt;what we need to do is rectify these incorrect calculations. this is done by:&lt;br /&gt;clip.height=preferredHeight*(clip.height/currentHeight);&lt;br /&gt;or, in this case:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;test.height=350*(test.height/30);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if you trace test.height again, you'll see that flash now thinks it is 361.7 pixels high, but it is&lt;br /&gt;actually exactly the same height as the 350 pixel high rectangle we drew in step 1.&lt;br /&gt;&lt;br /&gt;by the way, all of this can be avoided by drawing the rectangle originally with actionScript, but i believe these workings are still necessary for cases where simple shapes are not sufficient and we need to accurately resize a designer's work.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8050804939630883902?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8050804939630883902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8050804939630883902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8050804939630883902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8050804939630883902'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/08/weird-sizing-problem.html' title='Weird sizing problem'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_c566dmwpTzs/RsVnenq_OZI/AAAAAAAAAAM/upH40bvN2C8/s72-c/uneven+bars.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-3092663435413224767</id><published>2007-07-09T16:17:00.000-07:00</published><updated>2007-07-22T22:09:46.894-07:00</updated><title type='text'>Frustrating Flex problems solved #1 - dropEnabled</title><content type='html'>&lt;span style="font-family: arial;font-size:100%;" &gt;I set up a drag-drop interaction between two components - from a custom 'dragMe' component i set up(extending Canvas) to a Tree component, but couldn't work out why my Tree wouldn't allow dragMe to drag over it. Until I started experimenting with removing properties from the Tree component. Eventually(this sort of trial and error can be soo slow going in flex) I found the source of the problem: i had dropEnabled set to true. huh? how unintuitive is that?!! as soon as i set dropEnabled to false(or left it out altogether because that's the default) the behaviour works fine.&lt;br /&gt;&lt;br /&gt;After reading up on this property it does make sense - dropEnabled refers purely to the default drop behaviour. really defaultDropEnabled would be a more intuitively named property, but anyway i put this information out there for others not to waste the time i did yesterday!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-3092663435413224767?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/3092663435413224767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=3092663435413224767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3092663435413224767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/3092663435413224767'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/07/frustrating-flex-problems-solved-1-i.html' title='Frustrating Flex problems solved #1 - dropEnabled'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8545986298620350368.post-8721774926279726151</id><published>2007-07-03T22:12:00.000-07:00</published><updated>2007-07-04T16:29:35.974-07:00</updated><title type='text'>line width</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;i was creating a dashed line function which basically drew a short line, then moved on a few pixels. i was trying to display this line with one pixel width. what i discovered was that if the dash was three pixels or less in length the width would increase to two pixels.?? have a look at this flex code(which assumes a Canvas component called 'canvas'), which displays several lines with the same linestyle, but with the length of each one increasing by one pixel:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;import flash.geom.*&lt;br /&gt;import flash.display.*&lt;br /&gt;private function drawLine():void {&lt;br /&gt;&amp;nbsp; canvas.graphics.lineStyle(1,0x000000);&lt;br /&gt;&amp;nbsp; for (var i:int;i&lt;10;i++) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; canvas.graphics.moveTo(10,(i*10));&lt;br /&gt;&amp;nbsp; &amp;nbsp; canvas.graphics.lineTo(10+i,(i*10));&lt;br /&gt;&amp;nbsp; }       &lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;what's that about? well i had a look at whether other lineStyle options had any effect and discovered pixelhinting. pixelhinting is a boolean that specifies whether to hint strokes to full pixels. you'd think that a straight horizontal line wouldn't require much in the way of hinting, but the player does seem to display it incorrectly. perhaps short lines confuses it?&lt;br /&gt;&lt;br /&gt;anyway, to resolve this issue, add pixelhinting to the lineStyle:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;canvas.graphics.lineStyle(1,0x000000,1.0,true);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8545986298620350368-8721774926279726151?l=craiggrummitt.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://craiggrummitt.blogspot.com/feeds/8721774926279726151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8545986298620350368&amp;postID=8721774926279726151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8721774926279726151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8545986298620350368/posts/default/8721774926279726151'/><link rel='alternate' type='text/html' href='http://craiggrummitt.blogspot.com/2007/07/line-width.html' title='line width'/><author><name>Craig Grummitt</name><uri>http://www.blogger.com/profile/14325143883559624630</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://2.bp.blogspot.com/_c566dmwpTzs/SlwYIH6fIfI/AAAAAAAAABY/_AXFisYO7H4/S220/craig+mongolia+320.jpg'/></author><thr:total>0</thr:total></entry></feed>
