<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Alex’s Flex Closet</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.adobe.com/aharui/atom.xml" />
   <id>tag:blogs.adobe.com,2009:/aharui//126</id>
    <link rel="service.post" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126" title="Alex’s Flex Closet" />
    <updated>2009-05-29T19:25:36Z</updated>
    <subtitle>A collection of Flex-related things.  Warning: contains cobwebs, decaying matter and skeletons, but maybe some jewels as well.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.38</generator>
 
<entry>
    <title>More on Finding Memory Leaks</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2009/05/more_on_finding_memory_leaks.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=10879" title="More on Finding Memory Leaks" />
    <id>tag:blogs.adobe.com,2009:/aharui//126.10879</id>
    
    <published>2009-05-29T18:58:53Z</published>
    <updated>2009-05-29T19:25:36Z</updated>
    
    <summary>It seems that the most common scenarios involving memory leaks are the ones involving loading and unloading multiple SWFs like modules and sub-applications. Every day, we learn more and more about how the player manages memory and its other idiosyncracies,...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Troubleshooting and FAQ" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>It seems that the most common scenarios involving memory leaks are the ones involving loading and unloading multiple SWFs like modules and sub-applications.  Every day, we learn more and more about how the player manages memory and its other idiosyncracies, so it is time for another summary.</p>

<p>When debugging suspected memory leaks when loading/unloading SWFs, I generally do the following:</p>

<p>1) Set up the app or a test harness to load and unload the SWF multiple times (at least 3) and force a garbage collection pass after each unload or unload, then use the profiler to see how many copies of the module's xxx_FlexModuleFactory or the subapplication's xxx_SystemManager are in memory.  If more than 1, keep loading and unloading and see if that number continues to grow.  Any module or SWF that introduces a new component with styles will register those styles with the StyleManager and stick around forever the first time it loads.  You can prevent that from happening by pre-loading the styles in the main app or via a CSS module.  A second copy might stay around if it was the last thing loaded because the player or FocusManager might still be hanging onto it.  If you see more than 2, that's definitely a leak and you should use the profiler to find the leak.</p>

<p>2) After several loads and unloads, I take a memory snapshot, then do more loads and unloads and take another snapshot.  I clear all filters, remove percentages, sort by class name and compare manually the number of instances of every class.  They should match exactly, except maybe for a few Strings and sometimes, WeakReference.  Everything else is suspect and deserves investigation.</p>

<p>3) Once I think I got all references to the SWF cleaned up, I next run several loads and unloads in the debugger and check the console.  I am looking for lines in the debug output that start with:<br />
[UnloadSWF]<br />
That tells me that the player thought everything was cleaned up and unloaded the SWF.  Note that it may not say that right away, even after GC requests as sometimes the player has internal references to a SWF that get cleaned up "later".  If I don't see that, I go back to step 2 and compare memory snapshots looking for other things that might be leaking</p>

<p>4) Now that I'm convinced that even the player thinks it is ok to unload the SWF, if System.totalMemory is still increasing, the final test is to export release builds for all swfs and run them in a release player.  The debugger player seems to hang onto debug information in the SWFs and can skew System.totalMemory.  In recent tests, once I get past step 3, the release player's reporting of System.totalMemory is much more acceptable, capping at a much smaller and acceptable maximum memory value.</p>

<p>5) Once you get past that, some of you might still see memory attributed to the player still growing when using OS tools to examine the player process.  That remains an open area of investigation by the player team.  For Internet Explorer, one often finds that minimizing IE causes its claim on memory to shrink, implying that it is something to do with IE's memory management and not the Flash Player or your application.  We don't know of any way to programatically force IE to give up that memory.  We also have seen reports of other browsers reporting memory growth even though Flash thinks things should be unloaded.  If you can reproduce that in a small test case, file bugs with those test cases.<br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Tree and Lazy or Paged Data</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/12/tree_and_lazy_or_paged_data_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=8324" title="Tree and Lazy or Paged Data" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.8324</id>
    
    <published>2008-12-07T05:14:41Z</published>
    <updated>2008-12-07T05:37:34Z</updated>
    
    <summary>The Flex Tree control (mx.controls.Tree) is the subject of many complaints. It&apos;s pretty finicky if you don&apos;t use a dataProvider where the data is &quot;all there&quot;. Any attempts to lazily load in nodes must be coded carefully. If you don&apos;t...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Advanced Topics" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>The Flex Tree control (mx.controls.Tree) is the subject of many complaints.  It's pretty finicky if you don't use a dataProvider where the data is "all there".  Any attempts to lazily load in nodes must be coded carefully.  If you don't tweak the DataDescriptor properly it won't work.</p>

<p>Tree does have one major flaw, and that is that it can't handle a dataProvider that throws ItemPendingErrors as data sets that come from LiveCycle DataServices do.  Tree uses an undocumented pair of classes to effectively linearize the current set of open nodes into a dataProvider that its base class (List) can handle.  The code for that was scrambled together at the last minute and wasn't deemed sufficient enough for the AdvancedDataGrid, so our AdvancedDataGrid team developed their own HierarchicalCollectionView classes and beefed them up to handle ItemPendingErrors.  Due to various scheduling and logistical issues, Tree was left by the side of the road, stuck with its undocumented HierarchicalCollection classes that can't handle ItemPendingErrors.</p>

<p>At the tail end of Flex 3, several customers were in need of a Tree that could handle ItemPendingErrors.  THe shortest route to such a thing was to create a subclass of Tree that could handle the AdvancedDataGrid's HierarchicalCollectionView.  Example and source code are below.  You'll see the acronym "DMV" throughout because the AdvancedDataGrid and HierarchicalCollectionView are part of the Data Management and Visualization package (which requires the Professional versions and/or more money) so those of you trying to go the cheap route won't be able to leverage this code.  Also, you won't need this unless your data source throws ItemPendingErrors when an attempt is made to fetch data that hasn't been paged in yet, and unless you developed your own, you are using one of our data services which also cost you some money.</p>

<p>The example comes with a test tool we wrote that throws lots of ItemPendingErrors so we can try to find all the code paths that are sensitive to it.  Unlike most of the posts on my blog, this one actually got some QA time, but the usual caveats apply.</p>

<p><a href="http://blogs.adobe.com/aharui/TreeDMV/TreeDMVTest.swf">Run Example</a><br />
<a href="http://blogs.adobe.com/aharui/TreeDMV/TreeDMV.zip">Download Source</a></p>]]>
        
    </content>
</entry>
<entry>
    <title>Faster DataGrid Horizontal Scrolling</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/11/faster_datagrid_horizontal_scr.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=8183" title="Faster DataGrid Horizontal Scrolling" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.8183</id>
    
    <published>2008-11-22T04:58:48Z</published>
    <updated>2008-11-22T05:04:46Z</updated>
    
    <summary>Lately, I&apos;ve heard many complaints about horizontal scrolling performance in DataGrid. Vertical scrolling has been optimized, but horizontal has not. I found a bit of time to put together how to subclass DataGrid and try to optimize horizontal scrolling. I&apos;m...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Lately, I've heard many complaints about horizontal scrolling performance in DataGrid.  Vertical scrolling has been optimized, but horizontal has not.  I found a bit of time to put together how to subclass DataGrid and try to optimize horizontal scrolling.  I'm sure there's bugs and I don't know if I'll have time to fix them and the usual caveats apply.</p>

<p>Hope it helps.  It should work with any Flex 3 SDK version.</p>

<p><a href="http://blogs.adobe.com/aharui/dgscroll.zip">Download Source</a></p>

<p>In the example, the top DataGrid is not optimized, the bottom one is.  Make the screen bigger and you'll start to see and feel the difference.</p>

<p><a href="http://blogs.adobe.com/aharui/dgscroll.swf">Run Example</a></p>]]>
        
    </content>
</entry>
<entry>
    <title>Using the Flex Builder 3.x Profiler</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/09/using_the_flex_builder_3x_prof.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=7300" title="Using the Flex Builder 3.x Profiler" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.7300</id>
    
    <published>2008-09-05T23:15:16Z</published>
    <updated>2008-09-06T04:06:11Z</updated>
    
    <summary>I&apos;ve been getting lots of questions about memory leaks lately. I finally found some time to put my techniques for analyzing memory leaks into writing. Instead of using PowerPoint, I actually created a SWF so you can use the SWF...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Presentations" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>I've been getting lots of questions about memory leaks lately.  I finally found some time to put my techniques for analyzing memory leaks into writing.</p>

<p>Instead of using PowerPoint, I actually created a SWF so you can use the SWF to both view the presentation and learn how to use the Profiler.  I cover the differences between profiler memory, System.totalMemory and process memory and show how I analyze the two most common memory leak scenarios.</p>

<p><a href="http://blogs.adobe.com/aharui/profiler/ProfilerScenarios.swf">Run Presentation</a></p>

<p>As usual, caveats apply.</p>

<p>The SWF also demonstrates an approach to another topic I've heard about often, and that is how to do XML-driven or data-driven UI.  The presentation in this SWF is controlled by an XML file.  A single engine parses the XML and creates the UI widgets as dictated by the XML.  To change the presentation, all I have to do is change the XML.  I can also add new widgets easily.  Source is available here:</p>

<p><a href="http://blogs.adobe.com/aharui/profiler/ProfilerScenarios.zip">Download FlexBuilder Project</a></p>

<p>The SWF also demonstrates a technique for improving startup time.  Because our blog system is painful to use, I don't like uploading more than one or two files per blog post, but this presentation had more than a dozen images.  So, instead of loading images externally, I embedded them into the SWF, but normally, that delays startup by the download time of all of those images.  To get around that, I pack all the images into frame 3 of the SWF so that Flex can get up and running while the images download at the end of the SWF.  I can get away with that because the images are not needed right away. </p>

<p>Hope this helps.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Flex Authority Magazine</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/08/flex_authority_magazine.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=6954" title="Flex Authority Magazine" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.6954</id>
    
    <published>2008-08-20T00:04:05Z</published>
    <updated>2008-08-20T00:10:18Z</updated>
    
    <summary>I think I can finally say I got something published! Gordon Smith and I contributed to the first issue of Flex Authority, a new magazine (made of actual paper!) that focuses on Flex and AIR. We hope to be regular...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>I think I can finally say I got something published!  Gordon Smith and I contributed to the first issue of Flex Authority, a new magazine (made of actual paper!) that focuses on Flex and AIR.  We hope to be regular contributors.  The link to find out more is: <a href="http://www.flex-authority.com/">http://www.flex-authority.com/</a>.  Buy your subscription today.  We won't make any money from it, but this post is to thank them for working with us and to help them get the word out so they can make some money.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Marshall Plan At 360Flex Conference</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/08/marshall_plan_at_360flex_confe.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=6952" title="Marshall Plan At 360Flex Conference" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.6952</id>
    
    <published>2008-08-19T20:23:30Z</published>
    <updated>2008-08-19T21:05:34Z</updated>
    
    <summary>Today I presented more information about the Marshall Plan at the 360Flex conference in San Jose. The PowerPoint presentation can be downloaded here. Download Presentation There is a series of demos in the presentation. The code and source are linked...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Presentations" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Today I presented more information about the Marshall Plan at the 360Flex conference in San Jose.  The PowerPoint presentation can be downloaded here.<br />
<a href="http://blogs.adobe.com/aharui/Flex360/Flex360%20Versioning%20Support%20For%20Large%20Applications%20And%20Portals%203.pptx">Download Presentation</a></p>

<p>There is a series of demos in the presentation.  The code and source are linked below.  To get the third child to load you will need to download zoomer.swf and copy it to a server somewhere and fix the URL that loads it</p>

<p>Zoomer is a simple app that has a rectangle you drag around and it will magnify the area under the rectangle.  The demo shows how it needs to be modified for being loaded by a main application in different applicationDomain and securityDomain configurations</p>

<p>Pattern 1 would the the standard first attempt.  You can run zoomer.swf and see how it works on its own, run mainApplication.swf and see how, when zoomer is loaded, you can't drag the rectangle out of the area owned by zoomer.  See slide Demo #1.</p>

<p><a href="http://blogs.adobe.com/aharui/Flex360/Pattern1/zoomer.swf">Run Zoomer</a><br />
<a href="http://blogs.adobe.com/aharui/Flex360/Pattern1/mainApplication.swf">Run Zoomer as a sub-app</a></p>

<p>Pattern 2 works for the first copy of Zoomer, but not for the second or third.  See the slides for Demo#2</p>

<p><a href="http://blogs.adobe.com/aharui/Flex360/Pattern2/zoomer.swf">Run Zoomer</a><br />
<a href="http://blogs.adobe.com/aharui/Flex360/Pattern2/mainApplication.swf">Run Zoomer as a sub-app</a></p>

<p>Pattern 3 uses getSandboxRoot() so the first and second copy of Zoomer works, but still the third is broken.  See slide for Demo#3.</p>

<p><a href="http://blogs.adobe.com/aharui/Flex360/Pattern3/zoomer.swf">Run Zoomer</a><br />
<a href="http://blogs.adobe.com/aharui/Flex360/Pattern3/mainApplication.swf">Run Zoomer as a sub-app</a></p>

<p>THe Final Pattern fixes that by listening for MarshalMouseEvent.  See slide Demo#4</p>

<p><a href="http://blogs.adobe.com/aharui/Flex360/zoomer.swf">Run Zoomer</a><br />
<a href="http://blogs.adobe.com/aharui/Flex360/mainApplication.swf">Run Zoomer as a sub-app</a></p>

<p>Source code is here:<br />
<a href="http://blogs.adobe.com/aharui/Flex360/zoomer.zip">Download Source</a><br />
You will need a pre-release of 3.2 to build the source.</p>

<p>Preliminary write-up on the Marshall Plan is here:<br />
<a href="http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan">Marshall Plan Wiki</a></p>

<p>As usual, caveats apply to all content</p>]]>
        
    </content>
</entry>
<entry>
    <title>DataGrid With PopUp Editor</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/08/datagrid_with_popup_editor.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=6823" title="DataGrid With PopUp Editor" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.6823</id>
    
    <published>2008-08-05T18:17:36Z</published>
    <updated>2008-08-05T18:25:23Z</updated>
    
    <summary>Some folks seem to be in need of an itemEditor in the DataGrid that can popup or float over the DataGrid. The DataGrid currently limits the editor to fit within its size and if you need more space than that,...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Item Renderers" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Some folks seem to be in need of an itemEditor in the DataGrid that can popup or float over the DataGrid.  The DataGrid currently limits the editor to fit within its size and if you need more space than that, you'll need to popup an editor.</p>

<p>It is tricky to do so because of a bug in DataGrid plus the complexities of focus handlng and how it is normally used to end the edit session.</p>

<p>Here's a workaround for the bug and my take on how to create popup editors.  Usual caveats apply.</p>

<p><a href="http://blogs.adobe.com/aharui/DataGridPopUpEditor/DataGridPopUpEditor.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/DataGridPopUpEditor/DataGridPopUpEditorTest.swf">Run Example</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>DataGrid ItemEditor with Two Input Fields</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/08/datagrid_itemeditor_with_two_i.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=6812" title="DataGrid ItemEditor with Two Input Fields" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.6812</id>
    
    <published>2008-08-04T23:12:06Z</published>
    <updated>2008-08-04T23:20:12Z</updated>
    
    <summary>Several folks have been asking about how to have a DataGrid ItemEditor with two input fields (say you want to separately edit first name and last name or something like that). It&apos;s a bit tricky because of some missing pieces...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Item Renderers" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Several folks have been asking about how to have a DataGrid ItemEditor with two input fields (say you want to separately edit first name and last name or something like that).</p>

<p>It's a bit tricky because of some missing pieces in the underlying Flash focus APIs and because of how Focus events work.  Here is my take on how to do it.  Usual caveats apply (i.e, code is not supported and may have bugs etc).</p>

<p><a href="http://blogs.adobe.com/aharui/DataGridMultiFieldEditor/DataGridMultiFieldEditor.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/DataGridMultiFieldEditor/DataGridMultiFieldEditorTest.swf">Run Example</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Flex 3.x Versioning and Portals</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/06/flex_3x_versioning_and_portals.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=6330" title="Flex 3.x Versioning and Portals" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.6330</id>
    
    <published>2008-06-10T04:23:15Z</published>
    <updated>2008-06-10T04:38:02Z</updated>
    
    <summary>While most of my colleagues are busy working on Flex 4, a few of us have been working on something we&apos;re calling the &quot;Marshall Plan&quot;. Most of you won&apos;t ever need it, but some really important customers do. If you...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Advanced Topics" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>While most of my colleagues are busy working on Flex 4, a few of us have been working on something we're calling the "Marshall Plan".  Most of you won't ever need it, but some really important customers do.  If you want to make a Flex Portal, or have the kind of application where it is impractical to update all of the SWFs that make up the application to the latest version, or if you just have a lot of time on your hands, then the following link might be of interest to you.</p>

<p><a href="http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan">The Marshall Plan</a></p>]]>
        
    </content>
</entry>
<entry>
    <title>Flex 3 DataGrid Footers</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/flex_3_datagrid_footers.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5393" title="Flex 3 DataGrid Footers" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5393</id>
    
    <published>2008-03-12T23:14:30Z</published>
    <updated>2008-03-12T23:23:18Z</updated>
    
    <summary>I took a few minutes to prove that there is another way to add Footers to DataGrid in Flex 3. The old blog post showed how to add footers to the border. In Flex 3 we added more hooks so...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="Item Renderers" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>I took a few minutes to prove that there is another way to add Footers to DataGrid in Flex 3.  The old blog post showed how to add footers to the border.  In Flex 3 we added more hooks so  you can add other "content areas" to the DataGrid.</p>

<p>I'm short on time so the example isn't fully fleshed out.  It could definitely use some optimization as to when and how often it refreshes.  It probably needs masking if horizontal scrollbars are on, but at least it should show up in the right place relative to the horizontal scroll bar.  There's probably bugs as well, so the usual caveats apply, but it should get you started in the right direction.  Also, I did not try this with AdvancedDataGrid.  It is actually developed by an entirely different team.</p>

<p><a href="http://blogs.adobe.com/aharui/DataGridFooter3/DataGridFooter.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/DataGridFooter3/dg.swf">Run Demo</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Custom ArrayCollections, Adding New Items to DataGrid</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/custom_arraycollections_adding.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5381" title="Custom ArrayCollections, Adding New Items to DataGrid" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5381</id>
    
    <published>2008-03-11T21:25:31Z</published>
    <updated>2008-03-11T21:31:24Z</updated>
    
    <summary>The previous posts used custom ILists to merge or concatenate other ILists. This example uses a custom subclass of ArrayCollection to fake an empty object at the end of the actual ArrayCollection which can be used to add new entries...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>The previous posts used custom ILists to merge or concatenate other ILists.  This example uses a custom subclass of ArrayCollection to fake an empty object at the end of the actual ArrayCollection which can be used to add new entries to the DataGrid.</p>

<p>If the user fills out the new entry, it is added to the actual collection and another new entry is faked.  Additional logic dictates that if the user strips all information out of an entry, that entry is removed from the actual collection.</p>

<p>Usual caveats apply</p>

<p><a href="http://blogs.adobe.com/aharui/NewEntryDG/NewEntryDataGrid.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/NewEntryDG/NewEntryDataGridApp.swf">Run Demo</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Custom ILists, ComboBox Prompts</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/custom_ilists_combobox_prompts.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5374" title="Custom ILists, ComboBox Prompts" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5374</id>
    
    <published>2008-03-10T20:53:29Z</published>
    <updated>2008-03-10T21:00:34Z</updated>
    
    <summary>Following up on the last post which showed how to use custom ILists to merge two collections, this post shows how to use a custom IList to concatenate or append two collections. Such a thing might be useful in a...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Following up on the last post which showed how to use custom ILists to merge two collections, this post shows how to use a custom IList to concatenate or append two collections.</p>

<p>Such a thing might be useful in a situation where you want to add more than one prompt to a ComboBox.  In the example, I have the days of the week to choose from, but also want to add "Every Day", "Weekdays" and "Weekends" without modifying the original days of the week collection.  Of course, if you concatenate the two collections, it offsets your selectedIndex.</p>

<p><a href="http://blogs.adobe.com/aharui/ConcatIList/PromptsComboBoxApp.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/ConcatIList/PromptsComboBoxApp.swf">Run Demo</a></p>

<p><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Custom ILists, CheckBoxDataGrid, Merged Arrays</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/custom_ilists_checkboxdatagrid_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5365" title="Custom ILists, CheckBoxDataGrid, Merged Arrays" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5365</id>
    
    <published>2008-03-09T07:07:21Z</published>
    <updated>2008-03-10T06:56:12Z</updated>
    
    <summary>Earlier I published how to do a CheckBoxDataGrid where the selection model uses CheckBoxes instead of mouse clicks. I should have mentioned that the example used the DataGrid&apos;s selection logic which meant that the dataprovider item&apos;s selected state was not...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Earlier I published how to do a CheckBoxDataGrid where the selection model uses CheckBoxes instead of mouse clicks.  I should have mentioned that the example used the DataGrid's selection logic which meant that the dataprovider item's selected state was not stored in the dataProvider and thus you couldn't sort by whether an item was selected or not.</p>

<p>If you have a selected field in your data, then the code to handle checkbox selection is quite different.  You basically shut down the DataGrid's selection code and update the collection instead.  You can see that in the source code for this example.</p>

<p>This example goes one step further, however.  It assumes that you want to store selection in the dataProvider, but the dataProvider items don't have a selected field and are "immutable".  The example code shows how to use a custom IList to merge two arrays or ArrayCollections into one merged collection where the data objects contain fields from both arrays.  By doing that you can "add" a selected field to each item.</p>

<p>Custom ILists are a powerful way to change data without having to process each data item.  The example code merges the items on-demand instead of up-front thus saving startup time.  It would be wasteful to process 1000 items if you only show 7 and the user doesn't scroll past 20.</p>

<p>Anyway, here's the code.  Usual caveats apply.</p>

<p><a href="http://blogs.adobe.com/aharui/CheckBoxDG/CheckBoxDataGridApp3.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/CheckBoxDG/CheckBoxDataGridApp3.swf">Run Demo</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>DataGrid Double-Click To Edit</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/datagrid_doubleclick_to_edit.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5358" title="DataGrid Double-Click To Edit" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5358</id>
    
    <published>2008-03-07T22:56:47Z</published>
    <updated>2008-03-07T23:04:45Z</updated>
    
    <summary>Several people have asked about changing the default editing behavior of a DataGrid so that starting an edit session requires a double-click instead of the default single-click. Here&apos;s my approach: Download Source Run Demo...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>Several people have asked about changing the default editing behavior of a DataGrid so that starting an edit session requires a double-click instead of the default single-click.</p>

<p>Here's my approach:</p>

<p><a href="http://blogs.adobe.com/aharui/DblClkDG/DoubleClickDataGridApp.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/DblClkDG/DoubleClickDataGridApp.swf">Run Demo</a><br />
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Smooth Scrolling List</title>
    <link rel="alternate" type="text/html" href="http://blogs.adobe.com/aharui/2008/03/smooth_scrolling_list.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.adobe.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=126/entry_id=5263" title="Smooth Scrolling List" />
    <id>tag:blogs.adobe.com,2008:/aharui//126.5263</id>
    
    <published>2008-03-03T07:05:19Z</published>
    <updated>2008-03-03T07:12:46Z</updated>
    
    <summary>One of the features that got cut from 3.0 was &quot;smooth scrolling&quot;. List and other list-related classes scroll by row/column which can be a bit choppy at times. We tried to leave the hooks in to allow someone to do...</summary>
    <author>
        <name>Alex Harui</name>
        
    </author>
            <category term="General" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.adobe.com/aharui/">
        <![CDATA[<p>One of the features that got cut from 3.0 was "smooth scrolling".  List and other list-related classes scroll by row/column which can be  a bit choppy at times.  We tried to leave the hooks in to allow someone to do it, but we ran out of time to finish the job.</p>

<p>It's too bad we didn't finish the job as there are some difficult things to workaround in trying to get smooth scrolling to work, but I cooked this prototype up to give you a sense for how you might be able to get it working in your apps.   Note that the prototype assumes that all rows are the same height.  If you have variableRowHeight, that's a whole different problem.</p>

<p>Usual caveats apply, and no, I don't currently have time to make examples for TileList and DataGrid.  Maybe some one else will have the time.</p>

<p><a href="http://blogs.adobe.com/aharui/SmoothScrollingList.zip">Download Source</a><br />
<a href="http://blogs.adobe.com/aharui/SmoothScrollingApp.swf">Run Demo</a><br />
</p>]]>
        
    </content>
</entry>

</feed> 

