Tag Archive for 'flex-error'

22
Apr

Flex Error Handling Example

 

This example is associated with the blog “Dustin’s Software
Cogitations and Speculations.”

The Flash Players, regular and debugger, can be downloaded
at http://www.adobe.com/support/flashplayer/downloads.html. –>

<mx:Script>
import mx.utils.ObjectUtil;

/**
* Test Flex exception handling.
*/
public function testException():void
{
try
{
intentionallyThrowException();
}
catch (error:Error)
{
stackTraceText.text = ObjectUtil.toString(error.getStackTrace());
messageText.text = error.message;
toStringText.text = error.toString();
nameText.text = error.name;
errorIdText.text = String(error.errorID);
}
finally
{
// I get called whether an exception is caught or not.
}
}

/**
* Intentionally throw an exception for use in Flex exception
* testing.
*/
public function intentionallyThrowException():void
{
throw new SyntaxError(“That was some bad syntax!”);
}
</mx:Script>

<mx:VBox id=”mainDisplay”>
<mx:Form>
<mx:FormItem id=”stackTraceItem” label=”Exception Stack Trace”>
<mx:Text id=”stackTraceText” />
</mx:FormItem>
<mx:FormItem id=”messageItem” label=”Message”>
<mx:Text id=”messageText” />
</mx:FormItem>
<mx:FormItem id=”toStringItem” label=”toString”>
<mx:Text id=”toStringText” />
</mx:FormItem>
<mx:FormItem id=”nameItem” label=”Name”>
<mx:Text id=”nameText” />
</mx:FormItem>
<mx:FormItem id=”errorIdItem” label=”Error ID”>
<mx:Text id=”errorIdText” />
</mx:FormItem>
</mx:Form>
</mx:VBox>

</mx:Application>

A significant portion of the above code is actually comments. If you remove the explanatory comments, the code is pretty small. Either way, the code is straightforward, especially if you have written Java exception handling code before. Continue reading ‘Flex Error Handling Example’

29
Nov

Exception Handling with Flex

A common hurdle a developer may face is dealing with exceptions in BlazeDS. When an exception is thrown in Java, how do we handle this in flex? Here is a simple and flexible approach inspired by Scott Morgan.

1. Create a Java Class that extends RuntimeException.

package com.flexpasta.exception;
public class FlexException extends RuntimeException
{
public FlexException(String message)
{
super(message);
}
}

Continue reading ‘Exception Handling with Flex’

28
Nov

Creating a simple image gallery with the Flex TileList control

Flex Photo gallery in Flex using the TileList control, Image control, and the PopUpManager class.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"layout="vertical"verticalAlign="middle"

backgroundColor="white">
<mx:Style>

 Continue reading 'Creating a simple image gallery with the Flex TileList control'
12
Jun

Flex Error Handling

Applications are created to handle many different conditions affected by the system itself and outside players. Error handling allows applications to define the normal flow of execution and act upon exceptions.

Error Types

To understand the breadth of error handling, an outline of the error types and their functions is explored. The two main types of errors are compile-time and run-time errors. The Flash Player historically is capable of both synchronous and asynchronous method calls. There are ways to handle errors in both situations. Then, finally, the act of not catching errors is also considered a method of error handling.

Compile-time Errors

Continue reading ‘Flex Error Handling’



Get Adobe Flash playerPlugin by wpburn.com wordpress themes