Tag Archive for 'flex-samples'

11
Jan

Flex ActionScript 3.0 book download

In this post i am sharing a free actionscript 3.0 book. you can download this book from adobe site.

1) ActionScript 3.0 pdf book

Download link

2) You can get more pdf docs here:
Download here

if you have other source file or books please add up through comments.

22
Apr

Handling Java Exceptions in Flex application

 

Accessing the Throwable object in Flex

RemoteObject component invokes the fault event when an error occurs while remote method invocation. The fault event handler is provided with the FaultEvent object. This FaultEvent object has property named message of type mx.messaging.messages.ErrorMessage. The message property holds the Throwable object from the Java method in the rootCause property. We need to use this rootCause property to retrieve the properties which are set to the Throwable object in Java. All the public properties from the Throwable object are available.

We will see a sample application. In this application I am creating a custom Exception and adding a getter method to that, which will return my custom data. From the Flex application I will access both the error message and the custom data.

MyException.java

public class MyException extends Exception {

public MyException(String message) {

super(message);

}

public String getMyName(){

return “Sujit Reddy G”;

}

}

 

Method throwing exception

This method will throw the custom exception created above, add this method to a Java class. Invoke the below method using RemoteObject component in Flex.

 

public void throwCheckedException() throws Exception{

throw new MyException(”This is a checked exception”);

}

Reading values in Flex application

We add the method below as the fault event handler to the RemoteObject component in the Flex application. You can see that we accessed the rootCauseobject to retrieve the properties of the custom Exception object returned from the Java method. Continue reading ‘Handling Java Exceptions in Flex application’

29
Jan

styling the last button in a buttonbar control in flex

 

The following example shows how you can style the last button in a Flex ButtonBar control
by setting the lastButtonStyleName style.
<?xml version="1.0" encoding="utf-8"?>

<mx:Application name="ButtonBar_lastButtonStyleName_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Style>
        .lastButton {
            color: red;
            cornerRadius: 10;
            fontWeight: normal;
            themeColor: haloGreen;
        }
    </mx:Style>

    <mx:ButtonBar id="buttonBar"
            dataProvider="[Red,Orange,Yellow,Green,Blue]"
            lastButtonStyleName="lastButton" />

</mx:Application>
 Continue reading 'styling the last button in a buttonbar control in flex'
29
Nov

Getting URL Parameters in Flex Actionscript

Get the full url with the host name and port in actionscript?

There are several methods to help with this:

getHostName()
getPort()
getProtocol() -such as http or https
getContext() -The path after the hostname but before the url parameters

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’



Get Adobe Flash playerPlugin by wpburn.com wordpress themes