Five great new features in Flash Builder 4 beta
Five great new features in Flash Builder 4 beta
Join the DZone community and get the full member experience.Join For Free
I have already written about the data-centric development features of Flash Builder 4 beta. This is a major theme in the release and comprises many features. However, there are many other highly anticipated and valuable features in the beta as well. In this article, I’ll briefly introduce you to five outstanding additions to the product. Each of these features were direct requests from the community–either via our public bug and enhancement system or via direct feedback when we meet with you at conferences or other events. We build the product for you and these features demonstrate that commitment.
In order to make the most of this article, you need the following software and files:
Flash Builder 4 beta
Previous experience with Flex Builder is helpful but not necessary.
Feature 1: Generation of accessor functions
Software development can be tedious. Many applications follow the same coding practices and patterns, and developers frequently spend lots of time on repetitive coding tasks—time that could otherwise be spent implementing more interesting logic. For Flash Builder 4 beta, we targeted a number of these common coding tasks and delivered ways to get them done quickly.
The task that developers most often asked us to automate was the creation of accessor functions. Developers wanted a way to generate getter and setter methods, which comprise a public interface to access private class members. With Flash Builder 4 beta, you can create these functions by simply placing your cursor on a class variable name and choosing Source > Generate Getter/Setter from either the main menu or the context menu. You can use the Generate Getter/Setter dialog box that opens to configure details about the accessor functions, and there’s even an option to preview the changes that Flash Builder 4 beta will make to your code (see Figure 1).
Feature 2: Event code generation
Another common developer request is for generating event code. This feature is helpful both for experienced Flex developers looking to spend less time on tedious coding and for beginners unfamiliar with event-based development. For example, developers with a background in procedural web scripting technologies—like PHP or ColdFusion—may have never needed to implement an event listener to handle an event, such as a button being clicked. Flash Builder 4 beta can automatically generate the event handler functions for a UI object from the Flex Properties view, the context menu for an item in Design view, or with content assist for an item in Code view.
Each UI item, including buttons, lists, scrollbars, and so on, has a default event. A Button, for example, has the click event. If you select a button in Design view and right—click, you will see a context menu option Generate Click Handler. Likewise, the Property Inspector will show a field labeled “on click” and a button to generate the event. Of course, you can generate event handlers for all events of a UI item by selecting Show All Events in the context menu or by expanding the Events node for the item in the Property Inspector. Once you generate an event handler, Flash Builder 4 beta generates a unique name for the event handler based on the object’s class name, properties, or a custom name you specify. The event handler is placed in the first script block of the file and you will be taken to that position in Code view. If you’re starting in Code view, you can also generate events for components. Place your cursor in a closed component tag and open content assist for the properties of the component by typing a space after the class name. The list of properties displayed includes events (for example, Click). Select an event and then select Generate Event Handler.
If you’re new to ActionScript and event—driven programming, the event code generation feature can help you learn the basics of connecting component events to methods. If you’re an experienced Flex developer, the feature can save you time by quickly generating stubs for all of your event functions.
Feature 3:Command—line builds
Many customers told us that as their Flex projects have grown in complexity, the need for Flex to fit into their enterprise development processes and systems has become more acute. One of the most common requests we heard from these customers was for a way to add Flex applications to nightly automated build processes. Unfortunately, previous versions made it difficult to synchronize a developer’s individual build settings with the nightly build. Flash Builder 4 beta solves this with the new <fb.ExportReleaseBuild> task and the <mxmlc> task, which you can use in custom scripts for nightly builds.
Command line builds can be used even if Flash Builder 4 beta is not installed on the nightly build machine. If Flash Builder 4 beta is present, the <fb.ExportReleaseBuild>task ensures that the nightly build’s settings exactly match the settings used by developers during their daily work. It also allows you to automate some of the common tasks included in a Flash Builder 4 beta build, for example automatically compiling associated library projects and copying assets such as JPEGs into the output directory. If Flash Builder 4 beta is not installed on the build machine, you can write a custom script, such as an Ant script, that uses the <mxmlc> task, but the build machine must have the Flex SDK available. You will also need to keep two sets of build settings to synchronize. One set is kept in Flash Builder 4 beta and used by developers during their daily work. The other set is maintained on your nightly build machine. Consult the Adobe Flex 4 Features and Migration Guide for more details about how to use both approaches.
Feature 4: Debugger enhancements
Having a full featured debugger is one of the great benefits of an integrated development environment. Flex Builder 3 has excellent debugging capabilities, but there were still many additional features and enhancements for which you’ve been asking. So for Flash Builder 4 beta, we’ve invested heavily in taking the debugger to the next level.
Sometimes, you may need to stop the debugger from executing when specific conditions are met. With Flash Builder 4 beta, you can use expressions to define these conditional breakpoints to halt execution when the expression evaluates to true, when the value of the expression changes, or when a specified hit count has been reached. Evaluation of watch expressions has also been enhanced in this release. You can use the Expressions view to watch variables you selected in the Variables view, as well as to add and evaluate watch expressions while debugging your applications.
When debugging an application, you may want to know when specific instances of variables change value. Flash Builder 4 beta allows this with a new feature called watchpoints. You set a watchpoint on a specific instance of a variable from the Variables view during a debugging session, and execution will be halted when the watched variable changes value.
Finally, if you have ever set a debugger breakpoint within a loop that repeats many times, you’ll appreciate the new run—to—line command, which can be used to break out of a loop during a debugging session.
Feature 5: Network Monitor
Nearly all Flex applications exchange data with a server or service of some sort. The requests and responses move back and forth between the client and server in different formats depending on the technique that you use as a developer. In Flex 3 you have little insight into what’s happening as the exchange occurs, no matter what technique you use. You can debug your Flex application and see what remote call is made, but then you have to wait and see what (if anything) comes back from the server. Likewise, you can debug your server—side logic, but it’s difficult to know what happens to the data once you send it back to Flex. Monitoring the actual network traffic—the requests and response data—has not been possible with Flex Builder.
Flash Builder 4 beta introduces the Network Monitor, a tool that you can use to examine the SOAP, AMF, Remote Object, XML, and HTTP traffic that flows between your Flex application and its data service or services. Now you have a simple view, active when you’re in the Debugging perspective, that provides extensive monitoring and debugging information to make building data—centric applications much easier.
To begin, click the Enable Network Monitor icon on the Network Monitor toolbar and then run the debug version of the application as you would normally. As you interact with your application, the Network Monitor captures and stores all calls to remote services in chronological order. At any time, you can switch back to the Network Monitor view to see the results of each call. The results from calls to each remote service are presented in a table listing the time of the request, the requesting service, the operation and URL (if applicable), the time of the response, and the elapsed time. You can also examine the response, including the actual data sent back. You can analyze this information as the application is running, or you can click the Save icon to write all captured information to an XML file for later analysis.
Where to go from here
In looking over this list, I realized that I really would need a top ten (or twenty or more!) article to discuss all of the amazing features in this release. Whether you are a new or experienced Flex developer, Flash Builder 4 beta has a feature that will make development easier for you. Be sure to take advantage of the other great content that we’ve created to support the beta:
- Adobe Labs page for Flash Builder 4 beta
- Adobe Forums
- Feature videos
- Flash Builder 4 beta Features and Migration Guide
Meanwhile, watch for future Adobe Developer Connection articles that will provide additional detail on some of the features discussed here, and introduce you to other valuable features in Flex Builder 4 beta.
Published at DZone with permission of Tim Buntel . See the original article here.
Opinions expressed by DZone contributors are their own.