FlashPlatformist
Articles, Information, News, & Tutorials for Adobe Flash Platform Developers and Architects

Getting Started with Flash Builder 4 beta and Flash Catalyst beta

The moment that many Flash Platform developers around the world have been waiting for is finally here – Flash Builder (beta) and Flash Catalyst (beta) are now available for download from the Adobe Labs web site.

A Milestone for Rich Application Development

After many months of rigorous testing, migrating, conducting Q-A, and discussing issues in the pre-release forums to solve complex problems, the official public betas were finally dropped early this week.

As noted by Adobe, the intent of these beta releases is to improve upon three critical facets of the development life cycle: developer productivity, designer-developer workflow, and data-centric application development. The extent of the features that have been included in what used to be labeled “Flex Builder” are so ginormous that you will likely agree that it was worth slapping an entirely different name on it. It is clearly light years beyond Flex Builder 3. The release of these two programs to the public – though still in beta – mark a significant milestone in the evolution of RIA technology as a whole nonetheless.

Getting Started, Step-by-Step

In the spirit of all Adobe beta releases, a number of valuable documents and multimedia  resources have been made available to help you get acquainted with these new products:

  1. Begin by reading Tim Buntel’s article on the Adobe Developer Connection, titled What’s new in Flash Builder 4 beta.
  2. Next, Joan Lafferty points out exactly what is different between the Flex 3 SDK and the Flex 4 SDK beta.
  3. Learn about the new Flex SDK features in Matt Chotin’s “What’s new in Flex 4 SDK beta” article.
  4. Once you’re ready to really dive in, check out the collection of tutorial videos on the Adobe Labs site. While you’re at, make sure you don’t miss Lee Brimelow’s 2-part video tutorial series. Lee made the first tweet announcing the release and followed it with a nice little tutorial to complement the announcement. A few hours later, he released Part 2 of the tutorial, also very nicely done. Great job on these Lee.
  5. Then take some time to peruse through the livedocs for the Flex 4 SDK and Flash Builder that were just recently made public.
  6. Install the programs and begin to familiarize yourself. Links to the respective pages where the betas can be downloaded are provided below.
  7. Check out this tutorial by Andrew Shorten on Building a data-centric application using Flash Catalyst beta and Flash Builder 4 beta.
  8. After you’ve installed the programs, reviewed the available resources and taken a little time to familiarize yourself with the applications, its time to take a trip over to the Flash Builder 4 user forum and the Flash Catalyst user forum to discuss and collaborate with other members of the community.
  9. Install the Tour de Flex AIR application and use the new Flex 4 SDK examples to hit the ground running in Flash Builder 4 beta.

Download the Betas

Possibly Related Posts:



Posted by Dan Orlando on May 31st, 2009 :: Filed under Flash Platform News

Designing (RED)Wire, Part 2: Taking the User Experience from Concept to Production with Flex and CSS

Introduction

In the first segment of this series on designing the user interface of (RED)Wire, you learned about the different techniques and applications of CSS with Flex and AIR applications. In part two of the series, you will learn how these techniques can be applied to application components in enterprise level Flex and AIR applications. You will also discover the value of using external stylesheets when developing your Flex user interfaces.

All of the style information for (RED)Wire was contained in a single, well-commented style sheet. Additionally, all of the assets that were part of the user interface were contained in a single SWF file and loaded on demand.

All of the style information for (RED)Wire was contained in a single, well-commented style sheet. Additionally, all of the assets that were part of the user interface were contained in a single SWF file and loaded on demand.

Applying styles in Flex

Choosing your method of CSS implementation with Flex must be based on the situation and the environment. It is important to look at the application you are designing from the conceptual 50,000-foot view when considering your options for design implementation. The following are the most common methods for using CSS with Flex:

Setting Styles on an Instance (inline)

Flex components that extend the Flex UIComponent base class will allow you to set common styles as properties “inline”, or in other words, within the MXML component declaration tag. The layout properties of a display object are often unique to that object, so it is common to see any one of the following properties set explicitly on a component: x, y, height, width, top, right, left, bottom, horizontalCenter, verticalCenter, horizontalAlign, and verticalAlign.

<mx:Button id="volumeIcon" cornerRadius="0" alpha="0.9"
	verticalCenter="0" enabled="true" toolTip="Volume Control"
	click="toggleVolumeControl();" />

The listing above exhibits a functional example of setting style properties that are unique to the specific instance of the Button component with an id value of volumeIcon. Since I know that this is the only button that will require these particular style values, I have explicitly set the cornerRadius, alpha, and verticalCenter of this particular button.

A good rule of thumb when setting style properties on an MXML component tag is that the only reason you should be setting the property this way is because you know that the particular property value you are setting is specific to that component. For instance, let’s say your application requires a container that vertically stacks display objects, but without any gap in between. At the same time, you know that other VBox containers in the application do need to have some spacing between the display objects. In this type of situation, you should explicitly set the verticalGap property on that instance of the VBox component, as the following listing demonstrates:

<mx:VBox id="myVBox" verticalGap="0"
	x="15" y="15" width="100%" height="100%">

(...)

</mx:VBox>

Embedding CSS in MXML

This method involves embedding styles or assets directly into an mxml file with the tag. For all practical purposes, there are few instances in which directly embedding style information into an mxml file makes sense. It is important to recognize that as the application grows, the design will become harder and harder to maintain if there is a lot of embedded CSS throughout the application. With that in mind, it is important to be conservative with this method and only use it when necessary. The following code illustrates an example of an embedded style declaration that really should be held within an external CSS file for greater code maintainability.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
	xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute"
	showFlexChrome="false"
	borderStyle="none"
	keyUp="{this.onKeyStrokeEvent(event);}">

	<mx:Style>
		.bGroup {
			borderSides:"left,bottom,right";
			borderStyle:"solid";
			borderColor:#6d6f71;
			borderLeftThickness:3;
			borderRightThickness:3;
			borderBottomThickness:1;
			dividerColor:#6d6f71;
			dividerThickness:3;
		}
	</mx:Style>

	<mx:Script>
		<![CDATA[ 

			(...)

However, that is not to say that it will never happen. The next code listing is a component based on the Flex AplicationControlBar. In the design that was provided, each button in the control bar is just a single word of text, and looks more like a link than a button.

Notice the seamless integration of the ApplicationControlBar component in the upper right corner (click to view enlarged version).

Notice the Unique Styling of the ApplicationControlBar component in the upper right corner (click to enlarge)

Additionally, each of these one-word links have a small bullet separator between them. Since I had the design for the full application already, I knew this bullet separator was unique to the application’s main control bar and did not appear anywhere else. Most importantly, since the bullet appeared several times within the same component, it made perfect sense to embed the image, as it’s own private class within the MXML file, so that I could bind to it from each of the Image controls that I placed between the links. Otherwise I would have ended up with multiple instances of the same exact image being created, which is nothing more than a waste of system resources.

<?xml version="1.0" encoding="utf-8"?>
<mx:ApplicationControlBar xmlns:mx="http://www.adobe.com/2006/mxml">

 <mx:Script>
        <![CDATA[

            [Embed(source="assets/bullet_black.png")]
            [Bindable]
            private var bullet:Class;            

        ]]>
    </mx:Script>

	<mx:HBox x="10" y="10" id="hbox" horizontalGap="10" width="350">
		<mx:LinkButton label="Help" styleName="appBarButton"/>
		<mx:Image source="{bullet}" />
		<mx:LinkButton label="About" styleName="appBarButton"/>
		<mx:Image source="{bullet}" />
		<mx:LinkButton label="Minimize" styleName="appBarButton" />
		<mx:Image source="{bullet}" />
		<mx:LinkButton label="Quit" styleName="appBarButton"/>
	</mx:HBox>
</mx:ApplicationControlBar>

External Style Sheets

A Flex or AIR Application will have a single MXML file at the root of the source code directory that is based on either the Application class (Flex), or the WindowedApplication class (AIR). This is the default MXML application file that starts with either or . The application’s style sheet source should immediately follow the declaration of the application’s base class, as seen below:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
	xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute"
	showFlexChrome="false"
	dropShadowEnabled="false"
	borderStyle="none"
	applicationComplete="{this.appInit(event);}"
	>

	<mx:Style source="com/passalong/assets/RED_SKIN_MAIN.css"/>

	<mx:Script>
		<![CDATA[
			...
                ]]>
        </mx:Script>

The easiest and safest way to maintain the style settings of an application is by using external style sheets. In fact, you could reasonably maintain all of the styles of a large application from a single CSS file. I choose to use only one CSS file for two reasons; first, I always know where to find my style settings, and second, it makes finding styles easy for other developers when working in a team environment. Additionally, it is good practice to keep this file well organized, because as the application grows, your CSS file will inevitably grow as well.

The custom help component went through 5 design iterations. This wasnt a problem though because it was completely driven by CSS.

The custom FAQ component I built went through 5 design iterations. This wasn't a problem though because it was completely driven by CSS (Click to see the functional component).

When building your main application CSS file, it is generally good practice to place your default component style declarations first. For instance, if you want all of your tooltips to look the same throughout your application, use ToolTip as the name of the style and place it toward the beginning of the file. I tend to place a tooltip on just about anything I can in my applications to make the application as user-friendly as possible. Therefore, the tooltip component shows up in my applications more than probably any other component. Since your default component styles have the most impact on the overall look and feel of your application, you need to have quick and easy access to them. This is why it is usually a good idea to place those styles first.

Keep in mind that in most applications, you won’t be able to get away with just creating a default style for each component and calling it a day. The Button component is a good example of this. In order to keep your CSS code tidy, also consider grouping component style subsets together. For instance, a design with three alternate button styles called: Button.musicPlayerPlay, Button.pageDown, and Button.backToMenu, would be placed one after the other in the style sheet and separated by comments from other style groupings.

Conclusion

The bottom line is that in most cases, the most lucrative method for managing and maintaining the design of a Flex user interface is by use of external style sheets. In this regard, Flex is not much different from a standard web application. The methodology is the same: the more you keep styling, layout, and behavior separated from each other, the more manageable your application will be.

Possibly Related Posts:



Posted by Dan Orlando on May 31st, 2009 :: Filed under User Experience
Tags :: , ,

Designing (RED)Wire, Part 1: How to Use CSS to Create Jaw-Dropping User Interfaces with Flex and AIR

Introduction

One of the most powerful features of Adobe Flex is the vast amount of design flexibility that it contains. This is largely due to Adobe’s implementation of Cascading Style Sheets with Flex. For instance, when developing the User Interface of (RED)Wire, an application built on Adobe AIR, I received a number of change requests 2 days before the official launch of the first public release to 160,000 users that were already pre-registered worldwide, eagerly waiting to download their application. While many developers I know would have probably spent the next thirty minutes complaining to fellow developers about how these last-minute requests were an atrocity and an abomination to mankind, I had the changes completed and checked into subversion in less than twenty minutes, thanks to the power of Flex and CSS. It took longer to convince the Technical Director that the changes were complete than it did to complete them.

The main menu State of (RED)Wire, a digital music magazine built with AIR

The main menu state of (RED)Wire, a digital music magazine built with AIR

There are certain inevitabilities that I have learned to expect and prepare for through my experience as a Developer, Architect, and most of all, as a Technical Project Manager.  One such inevitability is that regardless of how much planning is done beforehand, both the design and the functional requirements of a given software project will change, and will change often through the development life cycle (this is the reasoning for the Agile Development methodology, but we’ll save that one for another day).

Change is one of the few certainties when developing large-scale applications in a team-based environment, and the best way to play a winning game is to anticipate the moves of all the players involved and position yourself accordingly before they can make their move. When you learn how to master this development technique, then you are guaranteed to always be in the lead and hitting a moving target (the project requirements) become a lot easier all of a sudden. It is for this reason that I enjoy developing with Flex as much as I do, because Flex features like CSS integration give you the power to do exactly that.

My goal is that by the time you finish reading this series of articles on the design methodologies that I used when creating the (RED)Wire user interface components, you will have learned a number of techniques for utilizing CSS with Flex, particularly with enterprise level applications.

Why Use CSS?

Most object-oriented design patterns keep the design logic separate from behavioral functionality. Since ActionScript is an object-oriented language, it only makes sense to remain consistent with these OOP conventions. The benefits of doing so include: flexibility, keeping maintenance of the application easy as it grows, code reuse, and better performance.

In the world of web design, CSS is a standard for encapsulating the code that makes up the design of a web site. Given the power and maturity of CSS, most experienced web designers strive to implement as much of the design and layout properties of a web site in CSS. The result is much greater control and flexibility over the look and feel of the site. CSS gained most of its popularity approximately three to four years ago when web developers began to realize that when the design of a web site is independent of the site’s behavioral functionalities, the design can be easily modified without the risk of breaking or otherwise negatively impacting the site’s behavioral code. This is what propelled the rapid growth of templates, skinning, and re-skinning the same code base. For example, I am an avid user of WordPress for my blog web site. There are tens of thousands of people that use this same open source code base to power their blog site, and yet, many times you will stumble upon a site built on WordPress and you wouldn’t even know it thanks to it’s impressive separation of code from design through the use of CSS.

Many major magazines use wordpress because of the variety of layouts available thanks to the separation of layout from styling

Magazines use Wordpress largely because of the ability to plug-in new templates on the fly thanks to CSS.

CSS in Flex Improves on what you already know

First and foremost, for those of you coming from a web design background, it is important to understand that Flex CSS does not follow the same conventions as the W3C CSS spec. The hyphen that is used to separate words in the W3C CSS 2.0 specification is not used as part of the code convention in the Flex implementation. Instead, the Flex implementation of CSS uses camel case. For example, vertical-center in the W3C CSS2 spec is equivalent to verticalCenter in Flex CSS. If you are already programming in a language that uses camel case however, this is pretty easy to get used to. The good news is that most of what is available in the CSS 2.0 specification is also available with the Flex CSS implementation. Furthermore, the Flex implementation of CSS expands significantly on the CSS 2.0 W3C standard, offering additional style properties that are unique to the Flex components.

Maintaining Styles – Component vs. Style Properties

Before you begin creating Flex CSS style sheets, I recommend that you first consider how you want your styles implemented. For the sake of simplicity, I am going to show you four basic methods of declaring a style.

Components

A style can be set on a component by using the component’s class name as the style name, like so:

TitleWindow {
   borderColor: #f7f7f7;
   borderAlpha: 1;
   borderThicknessLeft: 0;
   borderThicknessTop: 0;
   borderThicknessBottom: 0;
   borderThicknessRight: 0;
   cornerRadius: 0;
   headerHeight: 0;
   highlightAlphas: 1, 1;
   headerColors: #f7f7f7, #f7f7f7;
   footerColors: #f7f7f7, #f7f7f7;
   backgroundColor: #f7f7f7;
   dropShadowEnabled: true;
}
The TitleWindow component design from (RED)Wire, driven entirely by CSS

The TitleWindow component design from (RED)Wire, driven entirely by CSS

Style Names

Styles can also be declared using a unique style name. Make sure you put a dot in front of it though and use the camel case convention:

.altText {
	fontFamily: TVNordEFCEOP-RegularCon;
	fontSize: 18;
	color: #FFFFFF;
}

Component + Style Name

A style name can also be set on a component when you need to have multiple designs for the same component, which is common for applications that have multiple view states. This also ensures that only the specified component can have that particular style assigned to it:

Text.bigYellowText {
	color:#EFB526;
	fontSize:36;
	fontWeight:Bold;
}

The Global Selector

The global selector is a special kind of selector that will impact every component within the application that contains the properties that are set inside of it. For example, I could set the cornerRadius style property of all of my display object components that contain a cornerRadius style property to a setting of 4, like so:

global {
	cornerRadius: 4;
}

Understanding Style Precedence

While the global selector basically sets a default value of a property, it is easily overridden. For instance, if I set the cornerRadius property of the Button component to 0 either inline or in my CSS file, it will take precedence over the global default setting of 4 that I have also specified, and thus all of my Buttons will contain a cornerRadius value of 0. Furthermore, I can override both the global setting of 4 and the Button setting of 0 by creating an additional style such as:

Button.altCornersButton {
	cornerRadius: 8;
}

Conclusion

Congratulations, you have learned the basics of CSS implementation in Flex and AIR applications. However, there is a lot more to cover. In part two of this series, you will learn how to apply these concepts to application components in an enterprise application development environment, as I did in the implementation of the user interface of (RED)Wire.

Possibly Related Posts:



Posted by Dan Orlando on May 30th, 2009 :: Filed under User Experience
Tags :: , ,

A Real-World Perspective into the Life of a Consultant

Generally speaking, I hope that the readers of my postings will leave having felt like they’ve gained something important – a fulfilling learning experience, if you will. This time, I decided to do something a little different. If you are, or have ever been a consultant, and feel like spending a few minutes on the lighter side of life, you’ll certainly enjoy this real world depiction of our lives, in well, a couple of “different” contexts.

Possibly Related Posts:



Posted by Dan Orlando on May 28th, 2009 :: Filed under General

Social Media Marketing with RIA and the Adobe Flash Platform, a Conceptual Analysis

Summary

The purpose of this article is to analyze the recent social media marketing trend and more specifically, how this trend applies to RIA and future development with the Adobe Flash Platform.

Introduction

There’s no denying the fact that one of the hottest topics and latest buzzwords in the online arena is “Social Media Marketing”. This is not an article intended to define social media marketing, and it assumes you already know what it is. Therefore, if you are not familiar with ths term, I suggest spending a brief moment reading the short Wikipedia entry for Social Media Marketing. Regardless of how familiar you are with it, I  suggest downloading and reading the 2009 Social Media Marketing Industry Report.

Streamlining Social Media Marketing with the Flash Platform

The ability to rapidly aggregate data from a variety of sources and organize it all into something meaningful in near “real time”, is one of the most prolific uses of the Adobe Flash Platform. I might also note that my favorite tool for this is Adobe AIR by a long shot. This is because AIR has direct access to system resources and is not forced to work within the limitations imposed on it by the web browser. As a result, social media mash-ups run faster. Tweetdeck is a good example of this.

Tweetdeck (beta) is a social media app built with Adobe AIR

Tweetdeck (beta) is a social media app built with Adobe AIR

Tweetdeck has been in beta for quite a while now, and has limited functionality. I have been hoping to see some more AIR apps developed with the intended purpose of merging all social network accounts and API’s into a single interface in the effort of streamlining Social Media Marketing.  Unfortunately, it seems as though innovation in this area has been somewhat lacking.

I recently discovered Flock, a web browser that is built on the MoZilla engine, which does a decent job of tying everything together.  It’s pretty clunky compared to a well-designed AIR interface though. Furthermore, with the powerful built-in browser capabilities of AIR, the functionality of Flock could easily be accomplished with AIR, and it could not only do it a lot more gracefully, an astonishing amount of additional functionality could be tied in to merge your favorite features of each separate social networking platform.

Flock is a social networking web browser based on the MoZilla engine

Flock is a social networking web browser based on the MoZilla engine

Part of the problem is that not everyone has an open API. It amazes me that LinkedIn has still not caught on considering the fact that Facebook was able to drive their valuation into the stratosphere by opening up their API.

Flex Data Tools for Measuring the Effectiveness of Social Media Marketing

According to the 2009 Social Media Marketing Industry Report, one of the greatest burning questions among marketers is “how do I track my social media marketing efforts?”. Right now this is not an easy task, and requires a multitude of tools and utilities that only perform a single function. Therefore, attempting to track the influence of a new branding strategy by a large enterprise is essentially the full time job of 5 or more people. This is ridiculous. Why haven’t we automated this entire process? It only takes one marketing director to monitor and take snap shots of the social media space from an all-in-one data visualization dashboard after a major news release.

The Data Visualization Toolkits that are available for the Flash Platform are absolutely staggering. There is a market opportunity out there right now for any software house that wants to take advantage of it: develop a quality dashboard using graphing components that displays near real-time information using something like the ILOG Elixir component library for Flex and AIR. Ideally, this application would include a set-up wizard where the initial information for the tracking would be entered. For example, using the Twitter API, one could enter a number of keywords to follow (such as the company name), as well as links (such as links to press releases and the company web site). Using this dashboard, a marketing department could essentially get a near real-time visual depiction of their “buzz” that they are creating in the social media atmosphere after a news or product release.

ILOG Elixir is an advanced data visualization component set for Adobe Flex and AIR

ILOG Elixir is an advanced data visualization component set for Adobe Flex and AIR

Of course, that is only one of the many potential functions that a “Social Media Penetration Dashboard” could include for the purpose of tracking market penetration. Consider how sophisticated such an application could be. Geo-targeting reports, for example, could display the level of interest for a product by location using the google maps API or Yahoo maps, identifying where the biggest “buzz” seems to be happening. That data could then be applied to other marketing campaign efforts, providing the data needed for a company, say Bed, Bath, and Beyond for example,  to do a mass mailer of coupons in a particular geographical area based on the amount of buzz that was generated in the social media space after the news of a major product release.

SEO vs. Social Media Marketing

Many compare Social Media Marketing to Search Engine Optimization. These are two different beasts and require completely different knowledge and skill sets to master. They are not one in the same and should not be treated that way. Measuring the effectiveness of SEO is different from measuring the effectiveness of social media marketing; completely different as a matter of fact.

Whether or not SMM will be exploited by black-hat trickery the way that SEO was a few years back remains to be seen, and my guess is that the answer will be that yes, someone will find a way to exploit it, and then so will others. Don’t look at that as a bad thing though. It was thanks to the black hat SEO thugs that Google is able to disseminate quality content and recognize when an attempt is being made to “trick” the robots in an effort to get higher rankings.

It will likely be a little while though before we start seeing “black hat trickery” in the world of social media marketing though. It took at least a year before it started in the world of SEO, and social media marketing has arguably been mainstream for only a few months now. This is emphasized in one of the statistics pointed out in the aforementioned industry report, which states the following:

When asked to rate their experience using social media marketing for their businesses, a significant 72% of marketers have either just started or have been using social media for only a few months.

Conclusion

In the software development arena, specifically Rich Internet Application development with the Adobe Flash Platform, a world of opportunity exists to leverage the rapidly growing popularity of Social Media Marketing.  What it really comes down to is – who will be the first to recognize and execute on this blatently obvious opportunity?

Possibly Related Posts:



Posted by Dan Orlando on May 23rd, 2009 :: Filed under Social Media
Tags :: , ,

From the Adobe Press – Flex Builder to become known as “Flash Builder”

I’ve been waiting for quite a while to write up an informal article on this, and with the official announcement coming from Adobe on Friday, the time has finally come. What I am referring to is the recent announcement that Flex Builder has officially been re-branded to Flash Builder.

Naturally, this announcement has caused quite a stir already in the community. More specifically, the announcement has been met with mixed emotions. I had a feeling that would be the case, considering the fact that when I was first told this, the first words out of my mouth were “As if we didn’t have a hard enough time distinguishing the difference between Flash Designers and Flex Developers already!” I can’t help but laugh as I recall the stark contrast between those first words and what I was saying merely 20 minutes later.

Long Live Flex in the Enterprise!

As a strong advocate for Flex in the Enterprise, one of my longest standing arguments has been for the legitimacy of Flex for large-scale “RIA” applications. The reason I have argued so adamantly in this regard is a result of constant conversations with corporate executives who refer to Flex and AIR as “unproven technology”.  Flex gained this stigma amongst a large number of businesses as a result of having watched a substantial number of large-scale RIA Flex projects either never make it to full release or make it to release with only 30% of the intended functionality. On top of that, a significant portion of these projects went way over budget and rarely met deadlines.  I’ve spent a lot of time discussing this with people, particularly business decision makers, and I consistently suggest that they not point the finger at Flex, but rather consider the micro-architecture being used, and the people they have making the technical decisions.  Personally, I believe that it is largely a result of Adobe Consulting’s attachment to the Cairngorm Framework, which is unsatisfactory for enterprise development, and I’m not the first person to suggest that (I know, how dare I!).

Nonetheless, once you get over the shock of the change in naming convention, it is easy to see that this is actually a very smart move by Adobe. Furthermore, for people like me who are constantly advocating and trying to promote the use of Flex in the enterprise, this re-branding is more of a God-send than anything.

Consider This…

First of all, the movement to the Flash Builder brand marks the separation between the Flex Framework and the IDE built on Eclipse that can be used for the development of ActionScript as well as Flex projects. A general confusion existed in this regard previously, which was blatantly obvious every time I had a Flash Designer that used the Eclipse IDE to build ActionScript classes put down “Flex Developer” on their resume.

True Flex gurus know that there is a pretty hard core learning curve if you really want to get down and dirty with Flex. That is to be expected with anything though. You don’t just gain “guru” status overnight.  I don’t want to scare anyone that’s been thinking about giving Flex a try here, so understand that my point is only that the distinction between using Flex Builder and being a true Flex Developer had to be made somehow, so this is a good thing for those of us that have dedicated our lives to Flex for the last four years.

Of course, this brings us to the argument of whether or not the rebranding of Flex Builder to Flash Builder is a trade-off in favor of the aforementioned distinction, for a lack thereof between Flash and Flex development now. In this regard, my suggestion is to consider the fact that a SWF or AIR file can be compiled from Flash Builder (there, I finally called it Flash Builder, happy now? :) ) without a single reference to the Flex framework and without coding a single MXML file.

With that in mind, if you are still questioning the naming convention, then I ask you – is it really Flex Builder if I write all my applications without ever tapping into the Flex framework, and instead opt to code all of my ActionScript classes from scratch instead? How am I using Flex then? Even moreso, how could I call myself a Flex Developer…especially if my first choice was using the Flash CS4 IDE?  Yet, this is exactly what I saw on a day-to-day basis for two years, so I see this as a welcome change.

Separation Anxiety

Furthermore, the separation of Flash Builder and the Flex SDK provides a new opportunity to push Flex back into the enterprise and no longer accept the “unproven technology” argument. Business decision-makers need to pay more attention to who they have making the technical decisions and less attention to the technology itself. To expand further on this point, the technical decision makers need to accept responsibility for employing simple and scalable architectural conventions and use logical reasoning to evaluate architectural design patterns and frameworks that are proposed to them, as well as enforce a malleable network infrastructure upon which large-scale RIA applications can be deployed.

Lee Brimelow makes a good point in his response to the community chatter, where he states that we as a community must educate the general population on the fact that Flash is not what it used to be – intros without a “skip” option and animation that truly was completely pointless. Unfortunately, that is still the way a vast majority of the web population thinks when they hear the words “Adobe Flash”.

In contrast to this popular (and clearly outdated) belief, the technology has rapidly evolved into what we now know as (drumroll) The Flash Platform. This encompasses a multitude of Adobe products: ActionScript 3, Flash Professional, Flash Lite for mobile development, Adobe AIR, the Flex framework, Flash Builder, and Flash Catalyst (soon to come).

So What’s the Issue?

There is one particular argument that I’ve read, which seems to be a pretty valid one: whether or not “Flash Builder” unintentionally suggests that it is a scaled-down version of “Flash Professional”, when in fact they are two different products. Of course, going back to my last point, if we properly educate the general population on what exactly The Flash Platform is and what it means, then this should ultimately be a non-issue. The real issue is whether or not we as leaders in the Flash Platform community can properly educate clients, businesses, students, and individuals on what being a Flash Platform Developer means – its not about being tied to one development tool or a particular SDK. It’s about leading the way as an advocate for the evolution of technology and a rich, user-centric Internet through the Flash Platform as a whole.

With that said, Happy Flash Building!

Possibly Related Posts:



Posted by Dan Orlando on May 18th, 2009 :: Filed under Flash Platform News
Tags :: , , ,

Architectural Analysis of the Swiz Framework, Part 2: Central Event Control

In this segment, we will analyze how Swiz handles events, and how to utilize this feature of Swiz in an enterprise level application. Before moving any further however, here is the “more advanced version” of the Swiz architectural diagram I created for Linux magazine once again:

Architectural Diagram of the Swiz Framework

Architectural Diagram of the Swiz Framework

In the diagram, the Bean Factory represents a pool of MXML Beans that extend the Swiz BeanLoader class. As stated in Part 1 of this series, the purpose of Beans is simply to declare objects that will be used in the application and to assign IDs to them so they can be referenced by name later when they are autowired. The interesting thing about Swiz is that when it does its introspection on the BeanLoader, it instantiates all of the objects and creates a pool, or “factory”, where the objects are handed over on demand. For larger applications, this could potentially result in a very slightly extended load time, but the benefit is immeasurable because the result is that the application runs noticeably smoother and considerably faster.

In order to simulate a somewhat larger-scale application, the diagram displays four beans, which have only been separated as a matter of convenience. In essence, beans hold a strong resemblance to object registries, especially when you consider that you are essentially registering the objects declared in the beans to be managed by Swiz.

Swiz includes a class called the CentralDispatcher, which can be accessed directly through the Swiz.as class. The CentralDispatcher extends the Flex EventDispatcher and implements a Singleton pattern. I refer to this class as the “Event Bus” because it is a centralized place in which all events can be fired from.  This makes things nice and easy for managing the code base. Consider the following example:

  1. In the main application MXML file, set an event handler on the applicationComplete event of <mx:Application/>, like so:
    applicationComplete="applicationCompleteHandler(event)"
  2. Place the following code in the event handler function:
    protected function applicationCompleteHandler(event:FlexEvent):void {
         var del:XMLParserUtil = new XMLParserUtil();
         uiController.delegate = del;
         Swiz.addEventListener(DataReadyEvent.CORE_READY, setDataProviders);
    }
  3. Create a controller class that extends the Swiz AbstractController. Here is an example:
    package com.danorlando.controller
    {
       import com.danorlando.controller.events.DataReadyEvent;
       import com.danorlando.model.Globals;
       import com.danorlando.model.MediaObject;
       import com.danorlando.model.ViewStackDataCollectionObject;
       import com.danorlando.util.XMLFactory;
       import com.danorlando.util.XMLParserUtil;
       import mx.collections.ArrayCollection;
       import org.swizframework.Swiz;
       import org.swizframework.controller.AbstractController;
    
       public class UIController extends AbstractController
       {
          public static const GLOBAL_SETTINGS:String = "config/globals.xml";
    
          private var _mediaDP1:ArrayCollection = new ArrayCollection();
          private var _mediaDP2:ArrayCollection = new ArrayCollection();
          private var _mediaDP3:ArrayCollection = new ArrayCollection();
          private var _globals:Globals;
          private var _delegate:XMLParserUtil;
    
          //getters
          public function get mediaDP1():ArrayCollection { return _mediaDP1 }
          public function get mediaDP2():ArrayCollection { return _mediaDP2 }
          public function get mediaDP3():ArrayCollection { return _mediaDP3 }
          public function get delegate():XMLParserUtil { return _delegate }
          public function get globals():Globals { return _globals }
    
          //setters
          public function set mediaDP1(ac:ArrayCollection):void { _mediaDP1 = ac }
          public function set mediaDP2(ac:ArrayCollection):void { _mediaDP2 = ac }
          public function set mediaDP3(ac:ArrayCollection):void { _mediaDP3 = ac } 
    
          [Autowire]
          public function set delegate(del:XMLParserUtil):void {
             _delegate = del
             XMLFactory.parseXML(GLOBAL_SETTINGS, _delegate.parseGlobalSettingsXML);
      // listening to the Swiz event bus for GLOBALS_READY, which informs the controller
             // that the global config file has been parsed and loaded...
             Swiz.addEventListener(DataReadyEvent.GLOBALS_READY, initGlobals);
          }
    
          public function UIController()
          {
             _globals = Globals.getInstance();
          }
    
          protected function initGlobals(event:DataReadyEvent):void {
             var dbpath:String = _globals.mediaDatabasePath + _globals.mediaDatabaseFile;
             XMLFactory.parseXML(dbpath, _delegate.parseMediaDatabaseXML);
             // listening for DATA_READY, which will be fired when the media database has been loaded
             Swiz.addEventListener(DataReadyEvent.DATA_READY, delegateData);
          }
    
          protected function delegateData(event:DataReadyEvent):void {
             if (event.collection == null) {
                throw new Error("NO MEDIA COLLECTION!"); return;
             }
             var data:ArrayCollection = event.collection;
             for each(var o:Object in data) {
             var obj:ViewStackDataCollectionObject = o as ViewStackDataCollectionObject;
             var name:String = obj.name;
             var coll:ArrayCollection = obj.collection;
             if (name == "Video Production") {
                for each(var ob1:Object in coll) {
                   var mo1:MediaObject = ob1 as MediaObject;
                   _mediaDP1.addItem(mo1);
                }
             }
             else if (name == "Video Art") {
                for each(var ob2:Object in coll) {
                   var mo2:MediaObject = ob2 as MediaObject;
                   _mediaDP2.addItem(mo2);
                }
             }
             else if (name == "Music Production") {
                for each(var ob3:Object in coll) {
                   var mo3:MediaObject = ob3 as MediaObject;
                   _mediaDP3.addItem(mo3);
                }
             }
          }
          // the main application class is listening for CORE_READY, which essentially
          // lets the application know that the data has been loaded and is ready to
          // be used. Again, the Swiz event bus is used as a way of keeping things
          // tidy and under control by ensuring that events aren't firing all over the place.
          Swiz.dispatchEvent(new DataReadyEvent(DataReadyEvent.CORE_READY));
        }
      }
    }
  4. The final piece of the equation is the XMLParserUtil, which fires two events through the Swiz event bus, GLOBALS_READY and DATA_READY, as seen in the following code:
    package com.danorlando.util
    {
       import com.danorlando.controller.events.DataReadyEvent;
       import com.danorlando.model.Globals;
       import com.danorlando.model.MediaObject;
       import com.danorlando.model.ViewStackDataCollectionObject;
       import mx.collections.ArrayCollection;
       import mx.core.IUIComponent;
       import org.swizframework.Swiz;
    
       public class XMLParserUtil
       {
          public function XMLParserUtil() { }
    
          public function parseGlobalSettingsXML(xml:XML):void {
             var globals:Globals = Globals.getInstance();
             globals.mediaDatabasePath = xml.mediaDatabasePath;
             globals.mediaDatabaseFile = xml.mediaDatabaseFile;
             globals.mediaBaseUrl = xml.mediaBaseUrl;
             globals.contentPath = xml.contentPath;
             globals.thumbsPath = xml.thumbsPath;
            // firing the event through Swiz to let the controller know that
             // the global configuration info is ready
             Swiz.dispatchEvent(new DataReadyEvent(DataReadyEvent.GLOBALS_READY));
          }
    
          public function parseMediaDatabaseXML( db:XML ):void {
             var mediaCollection:ArrayCollection = new ArrayCollection();
             for each(var x:XML in db..view) {
                var collObj:ViewStackDataCollectionObject = new ViewStackDataCollectionObject();
                collObj.id = x..@id;
                collObj.name = x..@name;
    	    for(var i:Number = 0 ; i < x.children().length(); i++) {
                   var obj:MediaObject = new MediaObject()
                   obj.type = x..mimetype[i];
                   obj.file = x..file[i];
                   obj.thumb = x..thumb[i];
                   obj.title = x..title[i];
                   obj.description = x..description[i];
                   obj.credits = x..credits[i];
                   collObj.collection.addItem( obj );
                }
               mediaCollection.addItem(collObj);
             }
           // creating a DATA_READY event and firing it through the Swiz event bus;
             // the data collection is sent along with the event when it is dispatched.
             var evt:DataReadyEvent = new DataReadyEvent(DataReadyEvent.DATA_READY);
             evt.collection = mediaCollection;
             Swiz.dispatchEvent(evt);
          }
       }
    }

The important thing here is to pay attention to the event flow between the main application file, the controller class, and the business delegate. The advantage of structuring it like this is that by centralizing the event flow, you maintain a higher level of control over what is happening and when it happens within the application. It also keeps things a lot tidier, which becomes more noticeable as the application grows.

Stay tuned for the final part to my series on the Swiz framework, where we’ll discuss the best part of the framework – autowiring.

Additionally, my article on Swiz should be published shortly by Linux magazine, in which case I will post that link here as well.

Possibly Related Posts:



Posted by Dan Orlando on May 16th, 2009 :: Filed under General
Tags :: , ,

Flex in the Enterprise: Architectural Analysis of the Swiz Framework, Part 1

I’ve spent an incredible amount of time recently working with the new Swiz framework for my latest article, which will be published soon by Linux Magazine.  Since Swiz is so new, and in consideration of the fact that very few developers even know what it is, the article was more of an “introduction to Swiz” type of article. However, as a result of the immense amount of time that I’ve spent analyzing the code and speaking with the developers, Chris Scott and Soenke Rohde, I decided to provide a more advanced architectural analysis of the framework here. If you are new to Swiz, my suggestion is to first read the introductory materials that are provided, or this article might make your head spin. I do not expect Linux to publish the article I wrote for them for at least another week, so if you need a basic introduction to the Swiz framework, I suggest taking a look at the project’s wiki on Google Code. For an excellent tutorial on creating a project with the Swiz framework, I strongly suggest taking a look at this five-part series written by Brian Koteck.

Swiz Architecture

I wanted to create a diagram to support the content of the article I was writing for Linux Magazine. However, what I ended up with was much more complex than I had intended. As a result, I created a simplified diagram for the article as a way of visualizing the application life cycle, and decided to post my original diagram here, which provides a visual depiction of both the behavior of Swiz, as well as its architecture. The diagram is shown in Figure 1. Note that you may click on the image to bring up a much larger version in another window. Viewing it that way may make it easier to comprehend as your read the following description.

5,000-foot View of the Architecture and Behavioral Foundation of Swiz

Figure 1: 5,000-foot View of the Architecture and Behavioral Foundation of Swiz

Go with the Flow

The main application file is identified by the purple shape in the diagram with the text “Default Application”. In most Flex applications, this is usually an MXML file that extends Application or WindowedApplication. Note that projects that are purely ActionScript will not be able to take complete advantage of the features of the Flex framework. You will see why in just a bit. Swiz is fired up on the preinitialize event during application initialization, which initiates what I refer to in the diagram as the “Life Cycle Manager”.  Currently, the Swiz.as class in the framework acts as both the life cycle manager and what I refer to as the “Event Bus” in the diagram. However, this will change soon, where Swiz.as will be used for global variables. The loadBeans method is what starts up the Swiz “introspection engine”, so the Life Cycle Manager can be identified by the class that the loadBeans method is called on. My guess is that this method will not move from Swiz.as, and if it does move to a separate “LifecycleManager” class, the method will still be accessible from Swiz.as.

See, the core methodology of Swiz is to maximize simplicity, and that is why we have microarchitectures and design patterns in the first place. The problem is that not every architect understands this. Often we find architectures and design patterns being used in ways that do nothing more than increase complexity, which is totally counter-intuitive. Initializing Swiz simply by calling Swiz.loadBeans is incredibly simple. That is why I suspect that even if the method is moved to a full-blown LifeCycleManager class, you will still be able to initialize Swiz by simply calling Swiz.loadBeans.

What is a Bean?

Beans in Swiz are MXML files that extend the Swiz BeanLoader class. Within the BeanLoader tags, you have a series of object declarations. Figure 2 demonstrates what this might look like for a delegates bean.

 <?xml version="1.0" encoding="utf-8"?>
<BeanLoader xmlns="org.swizframework.util.*" xmlns:del="com.danorlando.delegates.*">
   <del:UserCrudDelegate id="userCrudDelegate"/>
   <del:StatsCrudDelegate id="statsCrudDelegate"/>
   <del:VideoCrudDelegate id="videoCrudDelegate"/>
</BeanLoader>

Figure 2: In this hypothetical example, the delegates for basic CRUD operations on users, stats, and videos are registered in a file called DelegatesBean.mxml.

The Introspection Engine

Now that you have seen what a sample bean looks like, its easier to understand that when the introspection engine runs, it looks at all objects that have been registered within BeanLoader classes and the BeanFactory creates and holds instances of the objects to be wired up next. In the Figure 1 diagram, I am showing a hypthetical example where four BeanLoaders have been iterated and pooled in the BeanFactory in four categories: Services, Components, Data Model, and Commands.

In the next installment, we will go in depth in the upper half of the diagram and discuss autowiring and the Event model.

Possibly Related Posts:



Posted by Dan Orlando on May 1st, 2009 :: Filed under General
Tags :: ,