Mobile ItemRenderer in ActionScript (Part 1) - AsFusion If you are starting to do mobile development and are used to create all your ItemRenderers in MXML, you may notice that the small devices like phones and tablets do not perform as well as the desktop does and you need to start looking closely to different ways to optimize you app. One of the ways to optimize your mobile app is to create your ItemRenderers in ActionScript. Narciso Jaramillo wrote a good article for Devnet with great tips for mobile development and one of the items was exactly that, to keep your ItemRenderers in pure ActionScript. Narciso mentions the Flex Framework comes with two ItemRenderers one is LabelItemRenderer that extends UIComponent and the other is IconItemRenderer that extends LabelItemRenderer. Those classes are great, but sometimes you have a different use case that needs a different set of classes. So in my examples I will not use those renderers. Basic Example Let's start with the most simple renderer, a TextField that displays some text. Application Styles
Flex Mobile Development: skinning the ActionBar component One of the important pieces of the Flex framework for mobile development is the ActionBar class. This class lets you create an application title bar with three distinct areas. Starting from left to right you can have a navigation area, a title area, and an actions area. Why would you want to use this component? Here are two screen shots of the Facebook application running on Android and iOS that illustrates this idea: Using the ActionBar component Using the ActionBar component is quite easy. If you want to add them inside of a View here is how you do it: This code produces the following ActionBar: If you want to set it globally then the method differe slightly depending on what Application root tag you chose when creating the project (ViewNavigatorApplication or TabbedViewNavigatorApplication). And for TabbedViewNavigatorApplication you’d add one for each tab you have in your application. And here is how this code looks like at runtime: Understanding how the ActionBar component works
Important Considerations When Building Single Page Web Apps Single page web applications - or SPAs, as they are commonly referred to - are quickly becoming the de facto standard for web app development. The fact that a major part of the app runs inside a single web page makes it very interesting and appealing, and the accelerated growth of browser capabilities pushes us closer to the day, when all apps run entirely in the browser. Technically, most web pages already are SPAs; it's the complexity of a page that differentiates a web page from a web app. In my opinion, a page becomes an app when you incorporate workflows, CRUD operations, and state management around certain tasks. Let's start with this common understanding, and dive into some of the more important things that should be considered when building SPAs. There are numerous points to consider before building a new app; to make matters worse, the expansive web development landscape can be intimidating at the outset. I will expand on each of the points above in the following sections.
Tutorial: Styling the ActionBar The ActionBar appears at the top of your application when you use ViewNavigatorApplication or TabbedViewNavigatorApplication in your project. It’s a skin part in the ViewNavigator that updates as Views are pushed and popped. Since it’s built into the default ViewNavigatorSkin, you don’t normally create it on your own in MXML. Because it’s built in, styling the ActionBar a little less obvious. chromeColor ActionBar supports the chromeColor style introduced with Spark in Flex 4. titleAlign By default, the ActionBar title is left aligned. defaultButtonAppearance By default, the ActionBar uses flat-styled button skins for Buttons inside the navigationContent or actionContent of the application or view. The ActionBar has two built-in button styles that are controlled by the defaultButtonAppearance style. Using defaultButtonAppearance=”beveled” is a shortcut for setting several different style values besides the Button skinClass values. Advanced CSS Selectors Next Steps
Understanding Flex Mobile View and ViewNavigator The Flex framework “Hero” makes the task of creating mobile applications for BlackBerry Tablet OS, Android, and soon iOS extremely simple. I think that one of the best looking apps for Android is MAX Companion 2010 and please bear in mind that this app was created using an early build of Flex “Hero”. This is a reasonably complex application with lots of screens and social integration (Twitter) and yet on my Nexus One and Samsung Galaxy Tab it still works great. This is exactly where the Flex framework can shine on mobile devices: fast and easy development of applications that can connect to virtually anything (web services, REST services, RPC). In this article I will talk about Flex Mobile Views and ViewNavigator. If you want to use Flex “Hero” to create mobile apps you need to understand how these components work. Oh and one more thing, if you want to try this yourself you’ll need the Flash Builder “Burrito”. Screen Metaphor Flex Mobile Project Views and ViewNavigator ActionBar <?
webgl Create a Custom Select Box with jQuery In this tutorial I will be teaching you how to transform boring select boxes into well styled form elements that are perfect for custom web applications. Using custom form elements such as select boxes can give your website a unique feel and make it stand out from the crowd. By the end of the tutorial you will have a fully functioning custom select box. The HTML Code Firstly lets go over the HTML required for a normal select box. Now in order to create our custom select box we need to duplicate this HTML structure using div and span elements. In the normal select box the outer wrapper is a select tag this can be easily replicated by using a couple of div and span tags as below: As you can see we now have the first blocks of our select box. Next is the select options, these are to be placed after the selectArrow span tag like so: Each option is represented as a span tag which holds the value attribute and inner text like a normal option tag. Here is a shot of what we have so far: The CSS Code