Archive for July, 2007

31
Jul

Calculating the number of days between two selected dates in a DateChooser control

Here’s a marginally more interesting sample. I was playing around with the DateChooser (calendar) control and the selectableRange property and figured I’d make a simple application to calculate the differences between two selected dates. The example creates a selectable range of dates from the current date to current date plus 1 year. Users can select any single or range of dates between the start date and end date, and Flex calculates the number of days the user selected using some basic math.

Full code after the jump.

Continue reading ‘Calculating the number of days between two selected dates in a DateChooser control’

31
Jul

Using the ColorPicker control’s colorField and labelField properties

In a previous post, “Formatting colors as strings with ActionScript“, A reader asked about the ColorPicker component. So here’s a quick little example of creating a ColorPicker control, as well as setting the labelField and colorField properties to display color names in the ColorPicker control.

Continue reading ‘Using the ColorPicker control’s colorField and labelField properties’

30
Jul

Formatting dates using the DateFormatter

Another basic little example showing how to format the text in a DateField control using the DateFormatter and the DateField control’s labelFunction property. This entry also shows the pretty basic trick of creating a separate ActionScript class file that holds the day names as constants so you don’t constantly have to think whether Monday is day 0 or day 1 (hint: it is day 1).

Full code after the jump.

Continue reading ‘Formatting dates using the DateFormatter’

30
Jul

Changing the calendar layout in the DateChooser component using the firstDayOfWeek parameter

A brief example of changing the first day of the week for the DateChooser control using the firstDayOfWeek property.

Full code after the jump.

Continue reading ‘Changing the calendar layout in the DateChooser component using the firstDayOfWeek parameter’

29
Jul

Creating ActionScript cue points with the VideoDisplay control

A simple example of creating and using ActionScript cue points with the VideoDisplay control. The example uses a VideoDisplay control to display the progressively downloaded video, a ProgressBar to display the amount of video that has played back, and two DataGrid controls to show ActionScript cue points and embedded cue points.

Full code after the jump.

Continue reading ‘Creating ActionScript cue points with the VideoDisplay control’

28
Jul

Loading name/value pairs using the mx:HTTPService tag

Semi-related to my previous post, I was playing around and figured out a way (probably not the best method) for loading a page of remote name/value pairs and putting them in a DataGrid using the HTTPService tag.

Full code after the jump

Continue reading ‘Loading name/value pairs using the mx:HTTPService tag’

28
Jul

Loading files using the URLLoader and URLVariables classes

Not sure if this is helpful to anybody, but thought I’d throw it out there. The following basic example loads some random variables from an external text file and displays the events which were dispatched in a DataGrid control, as well as the loaded name/value pairs.

Full code after the jump.

Continue reading ‘Loading files using the URLLoader and URLVariables classes’

28
Jul

Downloading files in Flex using the FileReference class

OK, enough embedding examples, lets take a look at downloading files using Flash Player’s FileReference class (flash.net.FileReference). This example demonstrates a basic usage of the FileReference class within Flex, allowing users to download a file from the server. This example also shows how you can use data tips in the DataGrid control by setting the data grid column’s showDataTips property to true and specifying a value for the dataTipField column.

Full code after the jump.

Continue reading ‘Downloading files in Flex using the FileReference class’

27
Jul

Converting an image to black and white using the ColorMatrixFilter

A quick example of converting an image to black and white using the ColorMatrixFilter class. This was originally written for the Flash documentation’s “Learning ActionScript 2.0″ book (click here), but I ported our sample to Flex below.

For more information on the ColorMatrixFilter in ActionScript 3.0, check out the Flex 3 Beta documentation on LiveDocs at: ColorMatrixFilter - Flex 3 Language Reference.

Continue reading ‘Converting an image to black and white using the ColorMatrixFilter’

27
Jul

Loading XML at run-time using the mx:HTTPService tag

In the previous post we looked at how to load an XML document in at compile-time and have it embedded in our Flex application. But that technique really only works if the XML data in question never changes. What if you had an XML document that was constantly changing on a daily, or hourly, basis. For example, consider an RSS reader application. If the XML was loaded and embedded in the XML document at compile-time, the RSS would never get updated. And while that may be good in some cases (such as a kiosk, or somewhere without an internet connection where you wanted to display static information), in many cases it may not work.

So, lets take a look at using the mx:HTTPService tag to dynamically load an XML file.

Continue reading ‘Loading XML at run-time using the mx:HTTPService tag’

26
Jul

Displaying XML data in a DataGrid

OK, hopefully this example is a bit more interesting than a few of my previous ones. Today’s handy tip comes in the form of loading and embedding an XML file in our Flex application at compile-time (as opposed to dynamically loading at run-time, which we’ll save for a future example), and displaying that information in a DataGrid control.

Continue reading ‘Displaying XML data in a DataGrid’

26
Jul

Filing bugs in the Flex public bugbase

So by now you’ve undoubtedly played around with either Flex 2.0.1, or the Flex 3 beta and you may or may not have encountered what you suspect is a bug. What next? Well, enter the public bugbase, JIRA. You can find the public Adobe Flex Builder and Flex SDK bugbase over at http://bugs.adobe.com/flex/, and you’re greeted with a few different options:

  • Search (Browse without registration) — Pretty much just what it says. Allows you to search the public bugbase for bugs without logging in or registering for an account. Searching is always recommended before filing any new bugs as it reduces the amount of duplicate bugs, and you may find that your particular bug has been fixed in a newer build of the SDK. Although you have a couple options, this view is somewhat limiting since you can really only view the bugbase (you need to register and log in to submit bugs) as well as browse certain projects to see fancy charts and graphs of where the reported bugs are versus each component/release version/who the bugs are assigned to/whether a bug is open or closed/a breakdown of bugs by priority/bugs by assignee/etc.
  • Login –If you have registered already, click here to log in to the Flex Bug and Issue Management System. If you haven’t registered, click the following link “Register / Create new account”. Note that you must be logged in to log bugs in the public bugbase. If you’ve signed up in the past but forgot your password there is a “Forgot Password” link on the login page that will let you enter your username and have a new password mailed to you. Forgot your username? Well, we got you covered as the Forgot Password page has a link to the “Forgot Username” page which lets you type in your email address and have your username emailed to you.
  • Register / Create new account — If you haven’t yet registered for an account in the public bugbase system, this is the place to go. Registration is simple and only consists of a few, easy to answer, form fields. Just type in your desired username/password (and confirm it)/full name/email address (in case you want to subscribe to bugs or wish to ever retrieve your username/password in the future — we won’t spam you)/and finally just type in the word you see in the capcha at the bottom of the page. That’s it! Six fields and you’re on your way to public bugbase goodness.
  • Bug Standards / Community process –Click here to see all sorts of useful notes and instructions for getting involved in the community, creating new accounts, browsing existing bugs, voting on existing bugs, reporting new bugs, tips on writing good bugs (Tip: always include source code with steps in how to recreate the behavior — upload SWFs and screenshots as well), how to submit source code, and finally a list of frequently asked questions (the FAQ, if you will).

It is also very important to note that the bugbase isn’t just for filing bugs. This is the main place to file any enhancement requests and other things as well. And the coolest part of the system is that Adobe uses the exact same system. No more separate bugbases for internal and external users. Continue reading ‘Filing bugs in the Flex public bugbase’

25
Jul

Changing the default button labels on an Alert control

When I first started playing with the Alert control, this tripped me up for a couple minutes. When trying to override the default text on the Alert control’s buttons, you need to set the Alert.cancelLabel, Alert.noLabel, Alert.okLabel, and/or Alert.yesLabel static properties *before* calling the Alert.show(). Sure, sounds a bit obvious in hindsight, but it is also important to remember that since those values are static, they apply to all Alerts, not just the one specific Alert. So you may have to reset the values back to their defaults once the Alert has been displayed.

Full code after the jump.

Continue reading ‘Changing the default button labels on an Alert control’

25
Jul

Formatting colors as strings with ActionScript

Here’s a pretty weak tip, but maybe somebody out there will find it useful. Often when working with colors, you need to format the text before displaying it, otherwise blue may display as “ff” and black as “0″. Here’s a semi-handy tip for making sure numbers display as hex values with at least six characters (and all uppercase, no less).

Continue reading ‘Formatting colors as strings with ActionScript’

25
Jul

Embedding assets from SWF files

Another cool way to embed assets into a Flex application is to load a SWF file and embed specific library assets using the [Embed] metadata and specifying the library symbol to embed.

Full code after the jump.

Continue reading ‘Embedding assets from SWF files’




July 2007
M T W T F S S
    Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Badge Farm

  • Firefox 2
  • Powered by Redoable 1.2
  • Feeds burnt by Feedburner
  • Feed