»
S
I
D
E
B
A
R
«
Security.loadPolicyFile Error opening URL
Jun 17th, 2010 by admin

If you have http://www.example1.com/a.swf and the following lines in

Security.allowDomain("*");
Security.loadPolicyFile("http://example2.com/subfolder/crossdomain.xml");

When you try to compile, you will receive the following error:

Error opening URL 'http://example2.com/crossdomain.xml'

This happens due to the fact that there is a security change in Flash player 10. crossdomain.xml can no longer work in sub folder without a crossdomain.xml in root directory.

A root directory must have a crossdomain.xml with the following meta policy for crossdomain.xml in sub folder’s to work.

<cross-domain-policy>
   <site-control permitted-cross-domain-policies="by-content-type"/>
</cross-domain-policy>

Below are references from official Adobe site:

Understanding the security changes in Flash Player 10 – Policy file strictness: Phase 2
Policy file changes in Flash Player 9 and Flash Player 10 – Meta-policies

AS3 Color Brightness
Jun 13th, 2010 by admin

To adjust bitmap movieclip color brightness using AS3 (ActionScript 3) in Flash is easy. A class named ColorMatrix provides a way to adjust Brightness based on a range of numeric values as well as multiply matrices.

You can download the source as well as the example here:

http://www.gskinner.com/blog/archives/2007/12/colormatrix_upd.html

AS3 mailto
Jun 11th, 2010 by admin

To use mailto in Flash AS3 (ActionScript 3.0) like the way you use it in HTML is easy.

you can use AS3 built-in function URLRequest to create the function.

Here is an example:
navigateToUrl(new URLRequest("mailto:mail@hotmail.com"), "_self");

Flash Dynamic htmlText Bold
Jun 7th, 2010 by admin

If you use dynamic textfield in Flash and the HTML enabled text fields fail to display formatted text. There isn’t anything wrong with your ActionScript, this happens because when you embed a font, Flash does not include the entire font family automatically. Only the plain font is embedded without the bold and italic variants.

If multiple styles of the font are used in the HTML formatting, then it’s necessary to add a dynamic text field to “manage” the embedding of the entire font family.

In the Character panel, apply each style used in the movie to at least one character in the text field.
dynamic text field

AS3 Key Down Event
Jun 3rd, 2010 by admin

In AS3 (ActionScript 3), you can detect the key down event and add a function to the event. Here is an example in Flash:

package {
    import flash.display.Sprite;
    import flash.display.DisplayObject;
    import flash.events.*;

    public class KeyboardEventExample extends Sprite {
    	public function KeyboardEventExample() {
        	stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
    	}

		private function keyDownHandler(event:KeyboardEvent):void {
			trace("Key Down");
		}
	}
}
ArgumentError: Error #1063: Argument count mismatch on… Expected 0, got 1.
May 4th, 2010 by admin

In Flash ActionScript, you may receive error like:
ArgumentError: Error #1063: Argument count mismatch on… Expected 0, got 1.

If you receive the above error message while compiling your Flash movie, most probably you have an event handler callback function does not contain event parameter. The fix is easy. If you forgot to add in the event object, adding that in will fix the problem.

For instance, if you have script like the one below:

_txt.addEventListener(FocusEvent.FOCUS_OUT, txtFocusOut);

public function txtFocusOut():void {
// do something
}

change it to:

_txt.addEventListener(FocusEvent.FOCUS_OUT, txtFocusOut);

public function txtFocusOut(event:FocusEvent):void {
// do something
}