Adobe Flash Player Security

Ever got the following error and never found out how to solve it? Here’s the solution.

Error:

Adobe Flash player has stopped a potentially unsafe operation.
The following local application ….
C:\somewhere\file.swf
is try to communicate with…
somedomain.com
To let this app…

Solution:
Create a file with the extension .cfg in the <user>/macromedia/Flash_Player/#Security/FlashPlayerTrust folder (under windows XP this will be: C:\Documents and Settings\_username_\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust) and create two lines in it using a regular text editor.

C:\somewhere\
http://somedomain.com

Save the file and rerun your application.

Error checking

I ran into the really nice problem of not being able to use Flash’s build in classes today.

Two things to check when you get an error like “The class or interface ‘flash.display.BitmapData’ could not be loaded.”

  1. Flash player settings in the publish settings
  2. The class paths

Turns out I had the player settings wrong. Pretty easy to overlook and it gives you a lot of aggravation.

XML and Latin-1 characters

You should use the decimal character references for these characters to use them in your XML. So instead of writing รƒยก, you should write ‘& # 2 2 5 ;’ (remove the spaces). This way Flash will display the characters correctly.
A list of the char references can be found at: http://www.bbsinc.com/iso8859.html

EDIT: Another way of solving this is setting the XML encoding to UTF-8.

  1. &lt;?xml version="1.0" encoding="utf-8"?&gt;

Bye bye buttons

I knew code dedicated to button functionality doesn’t work when the button instance isn’t on the timeline at the same time (or before) the AS, what I didn’t know is this. When you jump forward and back on your timeline and your button instances aren’t on the timeline anymore, you loose your functionality as well… :S

“Solution”: Hiding your buttons with AS instead of keyframing them.

DHTML

The simplest of things can be so much fun.

Like changing the background color of a website when you change pages in a flash document. How you do this is quite simple. You just call a pice of JavaScript from Flash, like this:

ActionScript

  1. getURL("js:method(params)", "_self");

An example of this: http://vwg.net/test/su/

note: replace “js” above with “javascript”, somehow wordpress isn’t happy with me using that word… ๐Ÿ˜‰

Class name conflict

Familiar with this error?

The name of this class, 'b', conflicts with the name of another class that was loaded, 'b'.

This can happen when you’re working with files on a server. If the server time is ahead of your computer’s time Flash (at least MX 2004) doesn’t want to compile them.

The solution is simple: either adjust your server’s or computer’s time (and date).