<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>David Ortinau</title>
    <link>http://www.davidortinau.com/blog/index/</link>
    <description></description>
    <dc:language>en</dc:language>
    <dc:creator>dave@davidortinau.com</dc:creator>
    <dc:rights>Copyright 2013</dc:rights>
    <dc:date>2013-05-31T13:25:49+00:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

    <item>
      <title>Automated UI Testing: Xamarin Test Cloud &amp;amp; Calabash</title>
      <link>http://www.davidortinau.com/site/automated_ui_testing_xamarin_test_cloud_calabash/</link>
      <guid>http://www.davidortinau.com/site/automated_ui_testing_xamarin_test_cloud_calabash/#When:13:25:49Z</guid>
      <description>At our monthly Interactive Developers of St. Louis meeting last night I presented this overview of the newly announced Xamarin Test Cloud. We then went deeper into Calabash exploring the various pieces making up a test, as well as how to inspect an application&#8217;s UI interactively via console. Big thanks to all that came out!




Xamarin Evolve Videos
Intro to Calabash: http://xamarin.com/evolve/2013#session&#45;xcjpj20d6s
TestCloud: http://xamarin.com/evolve/2013#keynote&#45;80:44  

Calabash
http://calaba.sh/ 
iOS: https://github.com/calabash/calabash&#45;ios
Android: https://github.com/calabash/calabash&#45;android

https://github.com/aduggin/calabash&#45;ios&#45;tutorial

Xamarin Field Service Example with Calabash Tests
https://github.com/calabash/field&#45;service&#45;example

Cucumber
http://cukes.info/
http://pragprog.com/book/hwcuc/the&#45;cucumber&#45;book

Frank
http://www.testingwithfrank.com/At our monthly Interactive Developers of St. Louis meeting last night I presented this overview of the newly announced Xamarin Test Cloud. We then went deeper into Calabash exploring the various pieces making up a test, as well as how to inspect an application&#8217;s UI interactively via console. Big thanks to all that came out!




Xamarin Evolve Videos
Intro to Calabash: http://xamarin.com/evolve/2013#session&#45;xcjpj20d6s
TestCloud: http://xamarin.com/evolve/2013#keynote&#45;80:44  

Calabash
http://calaba.sh/ 
iOS: https://github.com/calabash/calabash&#45;ios
Android: https://github.com/calabash/calabash&#45;android

https://github.com/aduggin/calabash&#45;ios&#45;tutorial

Xamarin Field Service Example with Calabash Tests
https://github.com/calabash/field&#45;service&#45;example

Cucumber
http://cukes.info/
http://pragprog.com/book/hwcuc/the&#45;cucumber&#45;book

Frank
http://www.testingwithfrank.com/</description>
      <dc:subject>iPhone, Xamarin</dc:subject>
      <dc:date>2013-05-31T13:25:49+00:00</dc:date>
    </item>

    <item>
      <title>Xamarin Evolve: Crafting Interactions with Core Animation</title>
      <link>http://www.davidortinau.com/site/xamarin_evolve_core_animation/</link>
      <guid>http://www.davidortinau.com/site/xamarin_evolve_core_animation/#When:17:04:51Z</guid>
      <description>The Xamarin Evolve 2013 conference has come and gone, fueling me with inspiration. What an amazing conference! The Xamarin team and community are truly awesome. 

At Evolve, I had to honor of presenting &#8220;Crafting Interactions with Core Animation&#8221;. Thanks to all that attended and indulged my enthusiasm for Interaction Design. Slides and code are below, and the session video is now available on the Evolve site.




Demos: https://github.com/davidortinau/monotouch&#45;samples/tree/master/CoreAnimationThe Xamarin Evolve 2013 conference has come and gone, fueling me with inspiration. What an amazing conference! The Xamarin team and community are truly awesome. 

At Evolve, I had to honor of presenting &#8220;Crafting Interactions with Core Animation&#8221;. Thanks to all that attended and indulged my enthusiasm for Interaction Design. Slides and code are below, and the session video is now available on the Evolve site.




Demos: https://github.com/davidortinau/monotouch&#45;samples/tree/master/CoreAnimation</description>
      <dc:subject>Xamarin</dc:subject>
      <dc:date>2013-04-22T17:04:51+00:00</dc:date>
    </item>

    <item>
      <title>MonoTouch: How to Tell If The User Is Selecting Text or Tapping</title>
      <link>http://www.davidortinau.com/site/monotouch_how_to_tell_if_the_user_is_selecting_text_or_tapping/</link>
      <guid>http://www.davidortinau.com/site/monotouch_how_to_tell_if_the_user_is_selecting_text_or_tapping/#When:01:03:41Z</guid>
      <description>Goal
Show and hide a toolbar at the bottom of the view when the user taps.

Why
Several apps, particularly those focus on reading the content in the view, offer a UIToolbar (or a custom component with buttons) at the bottom of the view that shows or hides according to the user&#8217;s taps.

What we want to detect is a single tap. Not a swipe. Not drag. Not if the user is selecting text. 

How
Using a UITapGestureRecognizer we can handle taps on the UIWebView. 

I setup a delegate for it and assign a Selector to handle the event.

From there we need to determine if the user is selecting text or just tapping, and show/hide the toolbar.

The Code

 
Goal
Show and hide a toolbar at the bottom of the view when the user taps.

Why
Several apps, particularly those focus on reading the content in the view, offer a UIToolbar (or a custom component with buttons) at the bottom of the view that shows or hides according to the user&#8217;s taps.

What we want to detect is a single tap. Not a swipe. Not drag. Not if the user is selecting text. 

How
Using a UITapGestureRecognizer we can handle taps on the UIWebView. 

I setup a delegate for it and assign a Selector to handle the event.

From there we need to determine if the user is selecting text or just tapping, and show/hide the toolbar.

The Code

 

&amp;nbsp;</description>
      <dc:subject>iPhone, MonoTouch, Xamarin</dc:subject>
      <dc:date>2012-05-01T01:03:41+00:00</dc:date>
    </item>

    <item>
      <title>MonoTouch: Handle Events from UIWebView</title>
      <link>http://www.davidortinau.com/site/monotouch_handle_events_from_uiwebview/</link>
      <guid>http://www.davidortinau.com/site/monotouch_handle_events_from_uiwebview/#When:00:34:28Z</guid>
      <description>Goal
Handle taps on buttons and links within a UIWebView.

Why
I really like how Readability, Pinterest and other apps hide or altogether don&#8217;t use a visible UINavigationBar on appropriate views. 

 

Instead, the view is all about the content. I suspect many are using a UIWebView for the content. 

The question then becomes, how does the user navigate the view stack from within a UIWebView.

Readability has a left to right swipe gesture that pulls he page away. I suspect this may be one UIViewController that shows a UIWebView over the top of the other content instead of pushing another view onto the stack. If you take a moment in Readability to pull the article away to partially reveal the list, you can scroll the list and see the article. I could be wrong&#8230;of anyone knows different do tell. I&#8217;m sure there&#8217;s more than one way to do this.



In the meantime, I want to add a back image link at the top of my HTML content, and handle that action from the view code.



How
UIWebView provides ShouldStartLoad where we can see what the component is about to load. At that point we can intercept the request and take a different action.

The Code: 


 

In the HTML I have a link to the anchor #back like this:

&amp;nbsp;&amp;lt;a href=&amp;quot;#back&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;Images/btn_back.png&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;nbsp;

To load images into the UIWebView from the local resource bundle, I set the base URL of the request to NSBundle.MainBundle.BundleUrl.

When the user touches that link the webViewShouldStartLoad handles it and pops the view controller as desired. Goal
Handle taps on buttons and links within a UIWebView.

Why
I really like how Readability, Pinterest and other apps hide or altogether don&#8217;t use a visible UINavigationBar on appropriate views. 

 

Instead, the view is all about the content. I suspect many are using a UIWebView for the content. 

The question then becomes, how does the user navigate the view stack from within a UIWebView.

Readability has a left to right swipe gesture that pulls he page away. I suspect this may be one UIViewController that shows a UIWebView over the top of the other content instead of pushing another view onto the stack. If you take a moment in Readability to pull the article away to partially reveal the list, you can scroll the list and see the article. I could be wrong&#8230;of anyone knows different do tell. I&#8217;m sure there&#8217;s more than one way to do this.



In the meantime, I want to add a back image link at the top of my HTML content, and handle that action from the view code.



How
UIWebView provides ShouldStartLoad where we can see what the component is about to load. At that point we can intercept the request and take a different action.

The Code: 


 

In the HTML I have a link to the anchor #back like this:

&amp;nbsp;&amp;lt;a href=&amp;quot;#back&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;Images/btn_back.png&amp;quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;nbsp;

To load images into the UIWebView from the local resource bundle, I set the base URL of the request to NSBundle.MainBundle.BundleUrl.

When the user touches that link the webViewShouldStartLoad handles it and pops the view controller as desired.</description>
      <dc:subject>iPhone, MonoTouch, Xamarin</dc:subject>
      <dc:date>2012-04-29T00:34:28+00:00</dc:date>
    </item>

    <item>
      <title>Rage Against the Framework: Flash Camp St. Louis Slides and Code</title>
      <link>http://www.davidortinau.com/site/rage_against_the_framework_flash_camp_st._louis_slides_and_code/</link>
      <guid>http://www.davidortinau.com/site/rage_against_the_framework_flash_camp_st._louis_slides_and_code/#When:01:13:36Z</guid>
      <description>We had a wonderful turnout at Flash Camp St. Louis. Most impressive were all of the new faces. JP Revel did a fantastic job putting on the event.

In my session, &#8220;Rage Against the Framework&#8221;, I basically dumped all the tips and tricks and learning I&#8217;ve been doing over the past year of Flex 4 work. It&#8217;s been, at times, frustrating and slow. But there have also been moments of &#8220;Wow, I didn&#8217;t realize you could to THAT with Flex!&#8221;

We discussed the typical promises the Flex Framework makes to draw us in, such as data binding, components, and skins. While this gets us the majority of the way to where we want to be, we often encounter frustrating hurdles when trying to implement engaging user experiences. 

Flex also provides States, State Transitions, and Layouts that, when properly understood and implemented, can help alleviate that frustration and do some really cool things.

 Rage Against the Framework   View more presentations from David Ortinau  

References

Data Binding

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64c3d&#45;7fff.html#WS2db454920e96a9e51e63e3d11c0bf69084&#45;7cc8

Binding Utils

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/binding/utils/BindingUtils.html

State Transitions

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084&#45;7fab.html

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/states/Transition.html

Effects

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/package&#45;detail.html

Layouts

http://tv.adobe.com/watch/max&#45;2010&#45;develop/having&#45;fun&#45;with&#45;layouts&#45;in&#45;flex&#45;4/

http://www.rialvalue.com/blog/2010/11/04/slides&#45;for&#45;having&#45;fun&#45;with&#45;layouts&#45;in&#45;flex&#45;4/

http://evtimmy.com/2010/04/two&#45;examples&#45;of&#45;layout&#45;animations/

http://tv.adobe.com/watch/flash&#45;camp&#45;boston/creating&#45;custom&#45;layouts&#45;in&#45;flex&#45;4&#45;

http://miti.pricope.com/2009/05/29/playing&#45;with&#45;custom&#45;layout&#45;in&#45;flex&#45;4/

http://www.tink.ws/blog/carousellayout/

&amp;nbsp;

Code Demo: http://davidortinau.com/exhibits/DataBindingTransitions/index.html

Source: DataBindingTransitions.zip
We had a wonderful turnout at Flash Camp St. Louis. Most impressive were all of the new faces. JP Revel did a fantastic job putting on the event.

In my session, &#8220;Rage Against the Framework&#8221;, I basically dumped all the tips and tricks and learning I&#8217;ve been doing over the past year of Flex 4 work. It&#8217;s been, at times, frustrating and slow. But there have also been moments of &#8220;Wow, I didn&#8217;t realize you could to THAT with Flex!&#8221;

We discussed the typical promises the Flex Framework makes to draw us in, such as data binding, components, and skins. While this gets us the majority of the way to where we want to be, we often encounter frustrating hurdles when trying to implement engaging user experiences. 

Flex also provides States, State Transitions, and Layouts that, when properly understood and implemented, can help alleviate that frustration and do some really cool things.

 Rage Against the Framework   View more presentations from David Ortinau  

References

Data Binding

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64c3d&#45;7fff.html#WS2db454920e96a9e51e63e3d11c0bf69084&#45;7cc8

Binding Utils

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/binding/utils/BindingUtils.html

State Transitions

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084&#45;7fab.html

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/states/Transition.html

Effects

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/effects/package&#45;detail.html

Layouts

http://tv.adobe.com/watch/max&#45;2010&#45;develop/having&#45;fun&#45;with&#45;layouts&#45;in&#45;flex&#45;4/

http://www.rialvalue.com/blog/2010/11/04/slides&#45;for&#45;having&#45;fun&#45;with&#45;layouts&#45;in&#45;flex&#45;4/

http://evtimmy.com/2010/04/two&#45;examples&#45;of&#45;layout&#45;animations/

http://tv.adobe.com/watch/flash&#45;camp&#45;boston/creating&#45;custom&#45;layouts&#45;in&#45;flex&#45;4&#45;

http://miti.pricope.com/2009/05/29/playing&#45;with&#45;custom&#45;layout&#45;in&#45;flex&#45;4/

http://www.tink.ws/blog/carousellayout/

&amp;nbsp;

Code Demo: http://davidortinau.com/exhibits/DataBindingTransitions/index.html

Source: DataBindingTransitions.zip</description>
      <dc:subject>General</dc:subject>
      <dc:date>2011-09-17T01:13:36+00:00</dc:date>
    </item>

    <item>
      <title>Practical Interaction Design for Developers: Slides and Code</title>
      <link>http://www.davidortinau.com/site/practical_interaction_design_for_developers_slides_and_code/</link>
      <guid>http://www.davidortinau.com/site/practical_interaction_design_for_developers_slides_and_code/#When:19:53:33Z</guid>
      <description>This summer we had a fantastic Designer/Developer Workflow Conference (D2WC) run by Dee Sadler. I love the mix of visual creatives and code slingers all putting their minds together to learn from each other and discover better ways to work together towards amazing results. It&#8217;s great to dive deep into our own core disciplines, but we cannot neglect our teammates and understanding what it takes to work together. 

Anyone who&#8217;s played an organized sport knows on some level that you need to know something about all of the positions in order to play your position well.

Here are the slides from my presentation, &#8220;Practical IxD for Developers&#8221;. It&#8217;s full of great quotes and references to books that I highly recommend. They are also listed on my bookshelf.

 Practical IxD for Developers   View more presentations from David Ortinau  

And the code demo from the end of the presentation is below showing basic data binding and how to manage transitions via custom Layouts:

Code Demo: http://davidortinau.com/exhibits/DataBindingTransitions/index.html

Source: DataBindingTransitions.zip
This summer we had a fantastic Designer/Developer Workflow Conference (D2WC) run by Dee Sadler. I love the mix of visual creatives and code slingers all putting their minds together to learn from each other and discover better ways to work together towards amazing results. It&#8217;s great to dive deep into our own core disciplines, but we cannot neglect our teammates and understanding what it takes to work together. 

Anyone who&#8217;s played an organized sport knows on some level that you need to know something about all of the positions in order to play your position well.

Here are the slides from my presentation, &#8220;Practical IxD for Developers&#8221;. It&#8217;s full of great quotes and references to books that I highly recommend. They are also listed on my bookshelf.

 Practical IxD for Developers   View more presentations from David Ortinau  

And the code demo from the end of the presentation is below showing basic data binding and how to manage transitions via custom Layouts.

Code Demo: http://davidortinau.com/exhibits/DataBindingTransitions/index.html

Source: DataBindingTransitions.zip</description>
      <dc:subject>Flex, Interaction Design</dc:subject>
      <dc:date>2011-09-10T19:53:33+00:00</dc:date>
    </item>

    <item>
      <title>Upcoming Speaking Engagements</title>
      <link>http://www.davidortinau.com/site/upcoming_speaking_engagements/</link>
      <guid>http://www.davidortinau.com/site/upcoming_speaking_engagements/#When:22:33:36Z</guid>
      <description>This past May I had the opportunity to present at XPLANE on a topic I&#8217;m very passionate about, Interaction Design. This was a fun joint event with Gateway Chi, the St. Louis usability professionals group, and Flex and Fuse the Arch, my home Flex and Cold Fusion group.&amp;nbsp; 

July looks to be another busy month of speaking for me. If you happen to be near Kansas City or Chicago, and have any interest in Interaction Design and the designer/developer workflow, please come out and join us. As much as I enjoy presenting, I derive much greater pleasure from the ensuing discussions and exchange of knowledge.

July 14&#45;16, 2011 
D2W &#45; Designer To Developer Workflow Conference
Crowne Plaza
Kansas City, MO
http://d2wc.com/
(I can give you a speaker discount, just contact me)

July 20, 2011
Chicago Flex
Chicago, IL
http://chicagoflex.org/

“The big difference that’s arisen in this new agile world is how integrated the team is. No longer is UX design owned by the UX designers: everyone on the team now has design responsibilities. That means that everyone needs to be informed about what the design is trying to do.”
&#45; Jarod Spool
This past May I had the opportunity to present at XPLANE on a topic I&#8217;m very passionate about, Interaction Design. This was a fun joint event with Gateway Chi, the St. Louis usability professionals group, and Flex and Fuse the Arch, my home Flex and Cold Fusion group.&amp;nbsp; 

July looks to be another busy month of speaking for me. If you happen to be near Kansas City or Chicago, and have any interest in Interaction Design and the designer/developer workflow, please come out and join us. As much as I enjoy presenting, I derive much greater pleasure from the ensuing discussions and exchange of knowledge.

July 14&#45;16, 2011 
D2W &#45; Designer To Developer Workflow Conference
Crowne Plaza
Kansas City, MO
http://d2wc.com/
(I can give you a speaker discount, just contact me)

July 20, 2011
Chicago Flex
Chicago, IL
http://chicagoflex.org/

“The big difference that’s arisen in this new agile world is how integrated the team is. No longer is UX design owned by the UX designers: everyone on the team now has design responsibilities. That means that everyone needs to be informed about what the design is trying to do.”
&#45; Jarod Spool</description>
      <dc:subject>General</dc:subject>
      <dc:date>2011-06-26T22:33:36+00:00</dc:date>
    </item>

    <item>
      <title>Create a Twitter OAuth Application With Tweetr Using Single Access Token</title>
      <link>http://www.davidortinau.com/site/create_a_twitter_oauth_application_with_tweetr_using_single_access_token/</link>
      <guid>http://www.davidortinau.com/site/create_a_twitter_oauth_application_with_tweetr_using_single_access_token/#When:21:25:01Z</guid>
      <description>What do you do when you want to use the Twitter API with your own account, and don&#8217;t need or want users to login via the PIN OAuth dance? You can use a single access token/secret in place of the authenticated token/secret and get all the access you need. 

Note: the authenticated user in this scenario is you, the owner of the application.

For this example I&#8217;m using Tweetr, an AS3 library for accessing Twitter from your Flash or Flex application. Tweetr requires as3crypto. Details and downloads here: http://wiki.swfjunkie.com/tweetr:downloads

Make sure you grab the proxy php and load that up on your server so you can have a service host. Run the install.php so it&#8217;s ready to go. This is a nice script providing caching so you get a little speed boost and don&#8217;t run over your Twitter API limit.

Ok, let&#8217;s get to it.

Create your&#8230; What do you do when you want to use the Twitter API with your own account, and don&#8217;t need or want users to login via the PIN OAuth dance? You can use a single access token/secret in place of the authenticated token/secret and get all the access you need. 

Note: the authenticated user in this scenario is you, the owner of the application.

For this example I&#8217;m using Tweetr, an AS3 library for accessing Twitter from your Flash or Flex application. Tweetr requires as3crypto. Details and downloads here: http://wiki.swfjunkie.com/tweetr:downloads

Make sure you grab the proxy php and load that up on your server so you can have a service host. Run the install.php so it&#8217;s ready to go. This is a nice script providing caching so you get a little speed boost and don&#8217;t run over your Twitter API limit.

Ok, let&#8217;s get to it.

Create a Twitter Application, and make note of the Consumer key and secret on the settings page. Then on the right side of the profile click the button labeled &#8220;My Access Token&#8221;. Grab that Access Token and Access Token Secret. This is referred to as a &#8220;single access token&#8221;, &#8220;one access token&#8221;, or &#8220;single user access token&#8221;. Docs: http://dev.twitter.com/pages/oauth_single_token

In your Flash application, implement Tweetr with OAuth. Import and other implementation details are omitted below.

&amp;nbsp;var serviceHost : String = &amp;quot;http://your_twittr_proxy_php_setup&amp;quot;;&amp;nbsp;var tweetr:Tweetr = new Tweetr&#40;&#41;;tweetr.serviceHost = serviceHost;           &amp;nbsp;oauth = new OAuth&#40;&#41;;oauth.serviceHost = serviceHost;&amp;nbsp;oauth.consumerKey = &amp;quot;CONSUMER_KEY&amp;quot;;oauth.consumerSecret = &amp;quot;CONSUMER_SECRET&amp;quot;;oauth.oauthToken = &amp;quot;MY_ACCESS_TOKEN&amp;quot;;oauth.oauthTokenSecret = &amp;quot;MY_ACCESS_TOKEN_SECRET&amp;quot;;tweetr.oAuth = oauth;    &amp;nbsp; 


And then you need to&#8230;wait, sorry, that&#8217;s all there is. Start making calls to the API and listening for results.

&amp;nbsp;tweetr.addEventListener&#40;TweetEvent.COMPLETE, handleLoad&#41;;tweetr.addEventListener&#40;TweetEvent.FAILED, handleFail&#41;;tweetr.getUserTimeLine&#40;null, null, null, 0, 0&#41;;&amp;nbsp;

&amp;nbsp;var tweets:Array = &#91;&#93;;private function handleLoad&#40;event:TweetEvent&#41;:void&#123;        for&#40;var i:int = 0; i &amp;lt; event.responseArray.length; i++&#41;        &#123;            var statusData:StatusData = event.responseArray&#91;i&#93;;            tweets.push&#40;statusData&#41;;        &#125;    // ... do something magical with the tweets&#125;&amp;nbsp;private function handleFail&#40;event:TweetEvent&#41;:void&#123;     trace&#40;&amp;quot;Failed to get data&amp;quot;&#41;;     // ... handle the disappointing failure...maybe a whale...just a thought&#125;&amp;nbsp;

There are plenty of good tutorials out for using Tweetr, though beware of any too old. Twitter phased out basic authentication August 2010. 

A couple I checked out:
Mark Doherty: Tweetr App Video Walkthrough
swfjunkie: PINless OAuth with Tweetr

I also want to note that it&#8217;s difficult to secure anything in a Flash application, and the key, token, and secrets are no exception. In this example they are right there in the code, unencrypted. SWFs are easily decompiled. If you dream up a solid security solution that doesn&#8217;t require a mountain of effort, please let me know.</description>
      <dc:subject>Flash, Flex, AIR</dc:subject>
      <dc:date>2011-01-20T21:25:01+00:00</dc:date>
    </item>

    <item>
      <title>Draw Lines Under Text in Spark RichEditableText</title>
      <link>http://www.davidortinau.com/site/draw_lines_under_text_in_spark_richeditabletext/</link>
      <guid>http://www.davidortinau.com/site/draw_lines_under_text_in_spark_richeditabletext/#When:19:26:36Z</guid>
      <description>On my current project, the design calls for displaying editable text with underlines that scroll with the text. It&#8217;s a nice design, and I had no good solution. I talked to a couple people, ideas were tossed around, and after a lot of reading and a couple runs at it I had nothing to show for the effort.

You can already see a working demo below. So how did I get there?

I had a nagging feeling I&#8217;d talked to someone about a workable solution, but I couldn&#8217;t remember who. Paul Taylor (@guyinthechair) had shown me some of his excellent work with text during 360|Flex in DC last year, and I figured if anyone was going to be able to help it&#8217;d be Paul. I put out a Twitter call for help, and, sure enough, he had an idea. And it&#8217;s so simple! 

Paul extends RichEditableText and adds a handler for Event.ADDED which is triggered for each new line (or specifically for each time anything is added to the display list). Thanks Paul!

&amp;nbsp;package&#123;	import flash.display.DisplayObject;	import flash.display.Shape;	import flash.events.Event;	import flash.events.EventPhase;	import flash.text.engine.TextLine;&amp;nbsp;	import spark.components.RichEditableText;&amp;nbsp;	public class LineyRET extends RichEditableText	&#123;		public function LineyRET&#40;&#41;		&#123;			super&#40;&#41;;			addEventListener&#40;Event.ADDED, onChildLineAdded&#41;;		&#125;&amp;nbsp;		private function onChildLineAdded&#40;event:Event&#41;:void		&#123;			var line:TextLine = event.target as TextLine;			if&#40;!line&#41;				return;&amp;nbsp;			if&#40;line.getChildByName&#40;&#39;baseline&#39;&#41;&#41;				return;&amp;nbsp;			var s:Shape = new Shape&#40;&#41;;			s.name = &#39;baseline&#39;;			s.graphics.lineStyle&#40;1, 0xCCCCCC, 0.5&#41;;			s.graphics.moveTo&#40;0, line.descent + 5&#41;;			s.graphics.lineTo&#40;line.specifiedWidth, line.descent + 5&#41;;			s.graphics.endFill&#40;&#41;;			line.addChild&#40;s&#41;;		&#125;	&#125;&#125;&amp;nbsp;


  
  
  
  
  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
  
  
  
  
  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   		Either scripts and active content are not permitted to run or Adobe Flash Player version
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   		0.0.0 or greater is not installed.
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   	
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp; 
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp; 
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  

&amp;nbsp;

Melville text courtesy of Fillerati.

View and Download demo source hereOn my current project, the design calls for displaying editable text with underlines that scroll with the text. It&#8217;s a nice design, and I had no good solution. I talked to a couple people, ideas were tossed around, and after a lot of reading and a couple runs at it I had nothing to show for the effort.

You can already see a working demo below. So how did I get there?

I had a nagging feeling I&#8217;d talked to someone about a workable solution, but I couldn&#8217;t remember who. Paul Taylor (@guyinthechair) had shown me some of his excellent work with text during 360|Flex in DC last year, and I figured if anyone was going to be able to help it&#8217;d be Paul. I put out a Twitter call for help, and, sure enough, he had an idea. And it&#8217;s so simple! 

Paul extends RichEditableText and adds a handler for Event.ADDED which is triggered for each new line (or specifically for each time anything is added to the display list). Thanks Paul!

&amp;nbsp;package&#123;	import flash.display.DisplayObject;	import flash.display.Shape;	import flash.events.Event;	import flash.events.EventPhase;	import flash.text.engine.TextLine;&amp;nbsp;	import spark.components.RichEditableText;&amp;nbsp;	public class LineyRET extends RichEditableText	&#123;		public function LineyRET&#40;&#41;		&#123;			super&#40;&#41;;			addEventListener&#40;Event.ADDED, onChildLineAdded&#41;;		&#125;&amp;nbsp;		private function onChildLineAdded&#40;event:Event&#41;:void		&#123;			var line:TextLine = event.target as TextLine;			if&#40;!line&#41;				return;&amp;nbsp;			if&#40;line.getChildByName&#40;&#39;baseline&#39;&#41;&#41;				return;&amp;nbsp;			var s:Shape = new Shape&#40;&#41;;			s.name = &#39;baseline&#39;;			s.graphics.lineStyle&#40;1, 0xCCCCCC, 0.5&#41;;			s.graphics.moveTo&#40;0, line.descent + 5&#41;;			s.graphics.lineTo&#40;line.specifiedWidth, line.descent + 5&#41;;			s.graphics.endFill&#40;&#41;;			line.addChild&#40;s&#41;;		&#125;	&#125;&#125;&amp;nbsp;


  
  
  
  
  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
  
  
  
  
  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   		Either scripts and active content are not permitted to run or Adobe Flash Player version
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   		0.0.0 or greater is not installed.
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   	
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp; 
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp; 
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;   
&amp;nbsp;  &amp;nbsp;  &amp;nbsp;  &amp;nbsp;  

&amp;nbsp;

Melville text courtesy of Fillerati.

View and Download demo source here</description>
      <dc:subject>Flex</dc:subject>
      <dc:date>2011-01-15T19:26:36+00:00</dc:date>
    </item>

    <item>
      <title>Flex 4 States: The Default State?</title>
      <link>http://www.davidortinau.com/site/flex_4_states_the_default_state/</link>
      <guid>http://www.davidortinau.com/site/flex_4_states_the_default_state/#When:16:26:44Z</guid>
      <description>You can call the first state in your list of states the default as Adobe&#8217;s Kevin Hoyt does in his article about States, and as Stephen Gilson does in his Flex Doc article, but don&#8217;t expect it to always have your back. I found this out the usual way, I assumed and failed.

The Actionscript 3.0 reference docs for mx.states.State don&#8217;t clarify this issue, though it does make one reference to a &#8220;default view state&#8221;.

Let&#8217;s say you have a component with 3 states:

&amp;nbsp;&amp;lt;s:states&amp;gt;	&amp;lt;s:State name=&amp;quot;welcome&amp;quot;/&amp;gt;	&amp;lt;s:State name=&amp;quot;top_products&amp;quot;/&amp;gt;	&amp;lt;s:State name=&amp;quot;all_products&amp;quot;/&amp;gt;&amp;lt;/s:states&amp;gt;&amp;nbsp;


And you have two ArrayCollections of Products, allProducts and topProducts, that will be bound to a DataGroup depending on the currentState of the view.

&amp;nbsp;&amp;lt;s:DataGroup id=&amp;quot;productsDataGroup&amp;quot;	 dataProvider=&amp;quot;{allProducts}&amp;quot;	 dataProvider.top_products=&amp;quot;{topProducts}&amp;quot; 	... /&amp;gt;&amp;nbsp;


As you can see above I&#8217;ve declared the &#8220;main&#8221; dataProvider and a dataProvider for the state &#8220;top_products&#8221;. What data do you expect to get bound when I change currentState to &#8220;all_products&#8221; or even &#8220;welcome&#8221;? It will go back to allProducts. Great, that&#8217;s what I want. 

BUT&#8230;

If the allProducts ArrayCollection has been changed in the meantime, the DataGroup will not rebind the allProducts collection, so I&#8217;ll be looking at old data. 

The way to make sure the binding occurs as expected, and updates are reflected, is to get in the habit of being explicit.

&amp;nbsp;&amp;lt;s:DataGroup id=&amp;quot;productsDataGroup&amp;quot;	 dataProvider=&amp;quot;{allProducts}&amp;quot;	 dataProvider.welcome=&amp;quot;{allProducts}&amp;quot;	 dataProvider.top_products=&amp;quot;{topProducts}&amp;quot; 	 dataProvider.all_products=&amp;quot;{allProducts}&amp;quot;	... /&amp;gt;&amp;nbsp;


Setting currentState in the component tag declaration is a good practice to make sure you start off in the right view. The consensus yesterday from conversations on Twitter is that the initial currentState will be the first state listed in the declaration. But this is not a default you can rely on once things start changing.

When it comes to setting data providers, you are best off being explicit if you&#8217;re going to assign different sources based on state.

Thanks to @jamespolanco, @pollensoft, @derrickgrigg, @benjamminSTL, and @flexmonkeypatch for your contributions to the discussion.You can call the first state in your list of states the default as Adobe&#8217;s Kevin Hoyt does in his article about States, and as Stephen Gilson does in his Flex Doc article, but don&#8217;t expect it to always have your back. I found this out the usual way, I assumed and failed.

The Actionscript 3.0 reference docs for mx.states.State don&#8217;t clarify this issue, though it does make one reference to a &#8220;default view state&#8221;.

Let&#8217;s say you have a component with 3 states:

&amp;nbsp;&amp;lt;s:states&amp;gt;	&amp;lt;s:State name=&amp;quot;welcome&amp;quot;/&amp;gt;	&amp;lt;s:State name=&amp;quot;top_products&amp;quot;/&amp;gt;	&amp;lt;s:State name=&amp;quot;all_products&amp;quot;/&amp;gt;&amp;lt;/s:states&amp;gt;&amp;nbsp;


And you have two ArrayCollections of Products, allProducts and topProducts, that will be bound to a DataGroup depending on the currentState of the view.

&amp;nbsp;&amp;lt;s:DataGroup id=&amp;quot;productsDataGroup&amp;quot;	 dataProvider=&amp;quot;{allProducts}&amp;quot;	 dataProvider.top_products=&amp;quot;{topProducts}&amp;quot; 	... /&amp;gt;&amp;nbsp;


As you can see above I&#8217;ve declared the &#8220;main&#8221; dataProvider and a dataProvider for the state &#8220;top_products&#8221;. What data do you expect to get bound when I change currentState to &#8220;all_products&#8221; or even &#8220;welcome&#8221;? It will go back to allProducts. Great, that&#8217;s what I want. 

BUT&#8230;

If the allProducts ArrayCollection has been changed in the meantime, the DataGroup will not rebind the allProducts collection, so I&#8217;ll be looking at old data. 

The way to make sure the binding occurs as expected, and updates are reflected, is to get in the habit of being explicit.

&amp;nbsp;&amp;lt;s:DataGroup id=&amp;quot;productsDataGroup&amp;quot;	 dataProvider=&amp;quot;{allProducts}&amp;quot;	 dataProvider.welcome=&amp;quot;{allProducts}&amp;quot;	 dataProvider.top_products=&amp;quot;{topProducts}&amp;quot; 	 dataProvider.all_products=&amp;quot;{allProducts}&amp;quot;	... /&amp;gt;&amp;nbsp;


Setting currentState in the component tag declaration is a good practice to make sure you start off in the right view. The consensus yesterday from conversations on Twitter is that the initial currentState will be the first state listed in the declaration. But this is not a default you can rely on once things start changing.

When it comes to setting data providers, you are best off being explicit if you&#8217;re going to assign different sources based on state.

Thanks to @jamespolanco, @pollensoft, @derrickgrigg, @benjamminSTL, and @flexmonkeypatch for your contributions to the discussion.</description>
      <dc:subject>Flex</dc:subject>
      <dc:date>2010-12-16T16:26:44+00:00</dc:date>
    </item>

    
    </channel>
</rss>