HTML/CSS Service

Showcase

0 comments0 views
1 Star2 Stars

Flex Error Handling Example

Category: Flex Error    |    1,995 views    |    Add a Comment

 

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. Read more…

Share/Save/Bookmark

 

Exception Handling with Flex

Category: Flex Examples, flex tutorials    |    10,842 views    |    1 Comment

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);
}
}

Read more…

Share/Save/Bookmark

 

Creating a simple image gallery with the Flex TileList control

Category: Flex Examples    |    13,097 views    |    1 Comment

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>

Read more…

Share/Save/Bookmark