From the category archives:

ActionScript

In a previous example, “Parsing ISO dates with Flex and ActionScript”, we saw how to parse ISO formatted dates (2008-01-25T06:14:23Z) and convert them into an ActionScript 3.0 Date object.

The following example shows how you can convert a Java formatted date (Wed Jul 22 14:29:30 PST 2009) and convert the timezone into an ActionScript 3.0 friendly format (UTC-0700) so you can use the static Date.parse() method to convert them into an ActionScript 3.0 Date object.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can use Regular Expressions to globally replace carriage returns and line feeds with the newline character (“\n”) in a string using Flex.

Full code after the jump.

[click to continue…]

{ 8 comments }

The following example shows how you can open a new browser window/tab by double clicking a Flex Image control by setting the doubleClickEnabled property to true and calling the navigateToURL() method

Full code after the jump.

[click to continue…]

{ 5 comments }

The following example shows how you can add custom context menu items to a Flex application by creating new ContextMenuItem objects and adding them to the Flex application’s customItems array (via the contextMenu property).

Full code after the jump.

[click to continue…]

{ 9 comments }

The following example shows how you can set mouse cursors in Flash Player 10 by setting the Mouse object’s cursor property to one of the static constants in the MouseCursor class.

Full code after the jump.

[click to continue…]

{ 6 comments }

The following example shows how you can determine the total bytes of your Flex application by accessing the loaderInfo.bytesTotal property.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can determine your Flex SDK version within a Flex application by using the internal mx_internal::VERSION property.

You can also find the version number by doing one of the following:
(a) Viewing the flex-sdk-description.xml file in your Flex SDK’s root directory:

<?xml version="1.0"?>
<flex-sdk-description>
    <name>Flex 4.0</name>
    <version>4.0.0</version>
    <build>3934</build>
</flex-sdk-description>

(b) At a command prompt, navigate to your Flex SDK’s /bin/ directory and type mxmlc -version:

C:\\dev\\flexSDKs\\4.0.0.3934\\bin>mxmlc -version
Version 4.0.0 build 3934

Full code after the jump.

[click to continue…]

{ 3 comments }

In a previous example, “Changing the background color of an error tip in Flex”, we saw how you could change the background color of a Flex error tip by setting the borderColor style on the .errorTip CSS selector.

The following example shows how you can style the Flex .errorTip style dynamically using ActionScript using the static StyleManager.getStyleDeclaration() and setStyle() methods.

Full code after the jump.

[click to continue…]

{ 0 comments }

Inspecting the properties in a class using the describeType() method and E4X/XML

by Peter deHaan September 19, 2008

The following example shows how you can use the describeType() method to inspect a class’s accessor methods.
Full code after the jump.

Read the full article →

Creating a component instance by class name in ActionScript 3.0

by Peter deHaan August 28, 2008

The following example shows how you can create a new Flex component instance by using its class name by calling the getDefintionByName() method.
Full code after the jump.

Read the full article →

Parsing XML nodes and Objects with dashes in their names in ActionScript 3.0

by Peter deHaan August 28, 2008

The following example shows how you can parse an XML node with a dash in its node name (<font-family />) as well as parsing an Object with a dash in it’s identifier using the square bracket notation ([]).
Full code after the jump.

Read the full article →

Using a clipboard menu in Flex with Flash Player 10

by Peter deHaan August 27, 2008

The following example shows how you can set a clipboard menu and specify custom clipboard items on a context menu by setting the contextMenu and clipboardItems properties.
Full code after the jump.

Read the full article →