Imports needed to align your Flash text in AS3.
import flash.text.TextField;Alignments you can do with your text:
import flash.text.TextFieldAutoSize;
TextFieldAutoSize.LEFTSyntax needed to align your dynamic text in AS3.
TextFieldAutoSize.RIGHT
TextFieldAutoSize.CENTER
TextFieldAutoSize.NONE
_textField.autoSize = TextFieldAutoSize.LEFT;Make sure that you assign the autoSize before you set the text. If you set the text first the alignment will not work correclty.
_textField.text = "Hello World! This is my text.";
Example Flash Movie with Right Click Functionality Disabled.stage.showDefaultContextMenu = false;
I got the classic #2044 Error today when I moved a project I have been working on from local to test environment. Usually you receive this error because the file doesn't exist. That wasn't the case for me.
I am building a papervision project and the file that was causing the #2044 error was the Collida .DAE file. Since the test environment was IIS, I had to add the .DAE file the the MIME Map. After I added the .DAE file to the MIME Map I was able to load my Collida .DAE into my PaperVision project.
Add the following code to your Web.config file
<system.webServer>This is is more common when trying to dynamically load a .flv file on the server.
<staticContent>
<mimeMap fileExtension=".dae" mimeType="application/octet-stream"/>
</staticContent>
</system.webServer>
var c:Color = new Color(); //Create a color object
c.setTint(Math.random() * 0xffffff, 1); //Set tint to a random color
mcObject.transform.colorTransform = c; //Apply tint to your MovieClip
When the video play listener is called you need to call the media play function.// mediaName :: Name of video
// mediaLength :: Duration of video
// mediaPlayName :: Name of video players.Media.open(mediaName, mediaLength, mediaPlayerName);
s.Media.play(mediaName, mediaOffset); When a user pauses the video or it stops you need to call the media stop function.s.Media.stop(mediaName, mediaOffset);When the video is finished you need to call the media close function.s.Media.close(mediaName);The tracking call to Omniture doesn't get fired until the close() function gets called.Omniture Media Tracking Reports
Sometimes you may want to store information on the clients machine. You can do this using a Flash Shared Object, this is basically a Flash Cookie. A Flash Cookie is actually a little better than a normal cookie. Flash Cookies are a little more secure and cannot be deleted like your browser's normal cookies are. Very few users know how to delete them, which is pretty cool for us Flash Developers.
Here is how you set a SharedObject in ActionScript 3:
var __so:SharedObject = SharedObject.getLocal("theactionscripter");
__so.data.favoriteWebsite = "http://www.theactionscripter.com";
__so.data.userId = "123";
__so.flush(); //Immediately writes a locally persistent shared object to a local file. var __so:SharedObject = SharedObject.getLocal("theactionscripter");
trace(__so.data.favoriteWebsite ); //http://www.theactionscripter.com Here is how you clear a SharedObject in ActionScript 3:
var __so:SharedObject = SharedObject.getLocal("theactionscripter");
__so.clear();