com.flagstone.transform
Class FSGetUrl2

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSActionObject
          extended by com.flagstone.transform.FSGetUrl2
All Implemented Interfaces:
java.lang.Cloneable

public class FSGetUrl2
extends FSActionObject

The FSGetUrl2 action is used to either load a web page or movie clip or load or submit variable values to/from a server.

It extends the functionality provided by the FSGetUrl action by allowing the variables defined in a movie to be submitted as form values to a server. Variables defined in a movie can also be initialised by loading a file containing variable name / value assignments.

Attributes
type Identifies the action when it is encoded. Read-only.
requestType The type of request generated by the action.

FSGetUrl2 is a stack-based action, however the type of request being submitted to the server is defined by the requestType attribute. Two arguments, url and target/level are popped from the stack. The url is the first argument popped from the stack and is a fully qualified uniform resource location where the movie clip or web page will be retrieved from. The second argument is either a target - the name of a specific movie clip, e.g. _root.movieClip or the name of a level in the main movie into which a movie clip has been loaded, e.g. _level1.

Request Types
The request type is specified as an attribute of the FSGetUrl2 action. Whether a new web page, movie clip or variable values are loaded is specified by the following types of request:

Type of Request Description
MovieToLevel Load a movie to the specified level.
MovieToLevelWithGet Load a movie submitting the movie variables using the HTTP GET method.
MovieToLevelWithPost Load a movie submitting the movie variables using the HTTP POST method.
MovieToTarget Load a new Flash movie or web page to the specified target.
MovieToTargetWithGet Load a new Flash movie or web page to the specified target, submitting the movie variables using the HTTP GET method.
MovieToTargetWithPost Load a new Flash movie or web page to the specified target, submitting the movie variables using the HTTP POST method.
VariablesToLevel Load values for selected movie variables to the specified level.
VariablesToLevelWithGet Load values for selected movie variables to the specified level, submitting the movie variables using the HTTP GET method.
VariablesToLevelWithPost Load values for selected movie variables to the specified level, submitting the movie variables using the HTTP POST method.
VariablesToTarget Load values for selected movie variables to the specified level.
VariablesToTargetWithGet Load values for selected movie variables to the specified target, submitting the movie variables using the HTTP GET method.
VariablesToTargetWithPost Load values for selected movie variables to the specified target, submitting the movie variables using the HTTP POST method.

When variables are submitted they are encoded using standard x-www-urlencoded encoding.

Targets
The target can either be the name of the frame can be one of the following reserved words:

Levels
Levels are virtual layers (analogous to the layers in the Display List). Higher levels are displayed in front of lower levels. The background of each level is transparent allowing movie clips on lower levels to be visible in areas not filled by the movie clip on a given level. The main movie is loaded into level 0. Movie clips are loaded into any level above this (1, 2, 124, etc.). If a movie clip is loaded into a level that already contains a movie clip then the existing clip is replaced by the new one. The level follows the general form: "_leveln" loads a movie clip into the current movie at level n.

Examples

Display a movie in the named frame:

 FSDoAction frameActions = new FSDoAction();
 
 // Push the target followed by the url
 
 frameActions.add(new FSPush("http://www.server.com/movie.swf"));
 frameActions.add(new FSPush("aFrame"));
 frameActions.add(new FSGetUrl2(FSGetUrl2.MovieToTarget));
 

Load a movie clip into the current movie at level 1:

 frameActions.add(new FSPush("http://www.server.com/movieClip.swf"));
 frameActions.add(new FSPush("_level1"));
 frameActions.add(new FSGetUrl2(FSGetUrl2.MovieToLevel));
 

Submit the value of a variable as an argument to a server script:

 // Set the variable
 
 frameActions.add(new FSPush("MyVariable"));
 frameActions.add(new FSPush(23));
 frameActions.add(FSAction.SetVariable());
 
 // Submit it to the server script
 
 frameActions.add(new FSPush("http://www.server.com/cgi-bin/form.php"));
 frameActions.add(new FSPush(""));
 frameActions.add(new FSGetUrl2(FSGetUrl2.VariablesToTargetWithPost));
 

Initialise the variables in a movie clip using name/value pairs returned from a server script:

 
 // Specify the level where the movie clip is loaded.
 
 frameActions.add(new FSPush("http://www.server.com/cgi-bin/form.php"));
 frameActions.add(new FSPush("_level1"));
 frameActions.add(new FSGetUrl2(FSGetUrl2.VariablesToLevelWithGet));
 

History

The FSGetUrl2 is a class for representing the ActionGetUrl2 action of the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 4.


Field Summary
static int MovieToLevel
          Load a movie without submitting the movie variables.
static int MovieToLevelWithGet
          Load a movie submitting the movie variables using HTTP GET.
static int MovieToLevelWithPost
          Load a movie submitting the movie variables using HTTP POST.
static int MovieToTarget
          Load a movie or web page without submitting the movie variables.
static int MovieToTargetWithGet
          Load a movie or web page submitting the movie variables using HTTP GET.
static int MovieToTargetWithPost
          Load a movie or web page submitting the movie variables using HTTP POST.
static int VariablesToLevel
          Load variables without submitting the movie variables.
static int VariablesToLevelWithGet
          Load variables submitting the movie variables using HTTP GET.
static int VariablesToLevelWithPost
          Load variables submitting the movie variables using HTTP POST.
static int VariablesToTarget
          Load variables without submitting the movie variables.
static int VariablesToTargetWithGet
          Load variables submitting the movie variables using HTTP GET.
static int VariablesToTargetWithPost
          Load variables submitting the movie variables using HTTP POST.
 
Fields inherited from class com.flagstone.transform.FSActionObject
Call, ExceptionHandler, GetUrl, GetUrl2, GotoFrame, GotoFrame2, GotoLabel, If, Jump, length, NewFunction, NewFunction2, Push, RegisterCopy, SetTarget, Table, type, WaitForFrame, WaitForFrame2, With
 
Constructor Summary
FSGetUrl2(FSCoder coder)
          Construct an FSGetUrl2 object, initialising it with values decoded from an encoded object.
FSGetUrl2(FSGetUrl2 obj)
          Constructs an FSGetUrl2 object by copying values from an existing object.
FSGetUrl2(int aType)
          Constructs an FSGetUrl2 using the specified request type.
 
Method Summary
 void appendDescription(java.lang.StringBuffer buffer, int depth)
          AppendDescription is used to present a string description of the object including all nested objects up to a specified depth.
 void decode(FSCoder coder)
           
 void encode(FSCoder coder)
           
 boolean equals(java.lang.Object anObject)
          Returns true if anObject is equal to this one.
 int getRequestType()
          Gets the request type.
 int length(FSCoder coder)
           
 void setRequestType(int aType)
          Sets the request type.
 
Methods inherited from class com.flagstone.transform.FSActionObject
getType, length
 
Methods inherited from class com.flagstone.transform.FSTransformObject
clone, name, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MovieToLevel

public static final int MovieToLevel
Load a movie without submitting the movie variables.

See Also:
Constant Field Values

MovieToLevelWithGet

public static final int MovieToLevelWithGet
Load a movie submitting the movie variables using HTTP GET.

See Also:
Constant Field Values

MovieToLevelWithPost

public static final int MovieToLevelWithPost
Load a movie submitting the movie variables using HTTP POST.

See Also:
Constant Field Values

MovieToTarget

public static final int MovieToTarget
Load a movie or web page without submitting the movie variables.

See Also:
Constant Field Values

MovieToTargetWithGet

public static final int MovieToTargetWithGet
Load a movie or web page submitting the movie variables using HTTP GET.

See Also:
Constant Field Values

MovieToTargetWithPost

public static final int MovieToTargetWithPost
Load a movie or web page submitting the movie variables using HTTP POST.

See Also:
Constant Field Values

VariablesToLevel

public static final int VariablesToLevel
Load variables without submitting the movie variables.

See Also:
Constant Field Values

VariablesToLevelWithGet

public static final int VariablesToLevelWithGet
Load variables submitting the movie variables using HTTP GET.

See Also:
Constant Field Values

VariablesToLevelWithPost

public static final int VariablesToLevelWithPost
Load variables submitting the movie variables using HTTP POST.

See Also:
Constant Field Values

VariablesToTarget

public static final int VariablesToTarget
Load variables without submitting the movie variables.

See Also:
Constant Field Values

VariablesToTargetWithGet

public static final int VariablesToTargetWithGet
Load variables submitting the movie variables using HTTP GET.

See Also:
Constant Field Values

VariablesToTargetWithPost

public static final int VariablesToTargetWithPost
Load variables submitting the movie variables using HTTP POST.

See Also:
Constant Field Values
Constructor Detail

FSGetUrl2

public FSGetUrl2(FSCoder coder)
Construct an FSGetUrl2 object, initialising it with values decoded from an encoded object.

Parameters:
coder - an FSCoder containing the binary data.

FSGetUrl2

public FSGetUrl2(int aType)
Constructs an FSGetUrl2 using the specified request type.

Parameters:
aType - the type of request to be performed. Must be one of the constants defined in this class.

FSGetUrl2

public FSGetUrl2(FSGetUrl2 obj)
Constructs an FSGetUrl2 object by copying values from an existing object.

Parameters:
obj - an FSGetUrl2 object.
Method Detail

getRequestType

public int getRequestType()
Gets the request type.

Returns:
the type of request to be performed.

setRequestType

public void setRequestType(int aType)
Sets the request type.

Parameters:
aType - the type of request to be performed. Must be one of the constants defined in this class.

equals

public boolean equals(java.lang.Object anObject)
Description copied from class: FSActionObject
Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

Overrides:
equals in class FSActionObject
Returns:
true if this object would be identical to anObject when encoded.

appendDescription

public void appendDescription(java.lang.StringBuffer buffer,
                              int depth)
Description copied from class: FSTransformObject
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

Specified by:
appendDescription in class FSTransformObject
Parameters:
buffer - a StringBuffer to which the description of each object is appended.
depth - the maximum level of nesting up to which objects will be displayed.

length

public int length(FSCoder coder)
Overrides:
length in class FSActionObject

encode

public void encode(FSCoder coder)
Overrides:
encode in class FSActionObject

decode

public void decode(FSCoder coder)
Overrides:
decode in class FSActionObject