You can pass additional variables to an upload script using either the POST or GET request method. To send additional POST variables to your upload script, you can use the following code:
The StageAlign class offers constant values that can be used for the Stage.align property.
The StageScaleMode class provides values for the Stage.scaleMode property.
http://help.adobe.com/nl_NL/AS3LCR/Flash_10.0/flash/display/StageAlign.html
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/StageAlign.html
Example:
This will add a dropshadow filter to a sprite (here symbolized as the variable oSprite):
For information on the parameters visit the actionscript pages on the dropshadow http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/filters/DropShadowFilter.html
To move a DisplayObject to the top of the displaylist use the following (where parent is the container of the object being moved to the front). This makes it appear like it's in front of any other DisplayObjects.
You should preload sounds in as3 before playing them to prevent awkward pauses while the sound effect loads for the first time. To load and play an external sound the following code suffices (in which the first line (pre)loads the file and the second line plays it). Place the first bit in your constructor function and the second in the event handler playing the sound
The stage object can only be accessed after an object has been added to the display list.
the geturl function that excisted in as2 has been replaced with a call to the navigateToURL method that takes an URLRequest object as it's first argument. Simple example including onclick eventlistener:
A quick example of the transitionmanager in a method:
Possible mouse events are :
to capture mouse click event and excute a function :
Use this code to show the handcursor when hovering over a displayobject in as3. The cursor turns into a pointing finger similar to the css cursor:pointer directive.
This function fades out the current stage by drawing a filled rectangle on top of it and tweening the alpha. Can be used for modal by adding a child on top of it.
This is an example showing an application of the loader class with all it's handlers - this example is from the Flash help files. Usually you don't need all of them but it's handy to have an overview.
This simple example shows how to use the URLLoader and URLRequest class in actionscript 3 to post data to a server:
To remove all children from a displayObect in as3 you can use the following loop:
When tweening, resizing / rescaling an image loaded with the as3 loader class in certain cases it looks neater if it rescales to the center of its parent.
This example shows what to include and some sample code for loading xml data in an AS3 class.
When you specify Flash vars in the embed or object tag they become available to actionscript through _root property of the flash file when it loads.
Example html with flash vars :
A Simple example of tween class usage with callback in as3:
Simple slideshow fade in / fade out script in Actionscript2. For a quick flash banner.
Small example illustrating how to get to passed flash vars in AS3
Quick example on how to call a js function via URLRequest:
For loading xml data etc. and preventing clientside caching, add it to the url of the file you're retrieving
Array shuffle function. Moves all array values to random positions in the array
Gosh it's simple.
returns true if the needle variable is found in the haystack array.
Otherwise returns false.
This loop removes iterates through an object and removes all movieclips from it.
the arguments are:
DropShadowFilter([distance:Number], [angle:Number], [color:Number], [alpha:Number], [blurX:Number], [blurY:Number], [strength:Number], [quality:Number], [inner:Boolean], [knockout:Boolean], [hideObject:Boolean])
for example - where Mc is the movieclip:
The callback is in the onMotionFinished handler function. MC is the movieclip the tween will be applied to.