Posts Tagged ‘flash’

Trace dump any object in Actionscript

Thursday, February 24th, 2011

When debugging Actionscript code you often want to see what’s inside your custom objects.

For instance here is a simple user object:

public class User
{
		public var id:Number = 123456;
		public var name:String = "Valiant Gladiator";

		public function User()
		{
		}
}

A simple trace will not work as it will return only the type of the object:

var u:User = new User;
trace(u);

returns:

[object User]

which is not very informative, while

var u:User = new User;
trace(ObjectUtil.toString(u));

returns:

(user.object::User)#0
id = 123456
name = “Valiant Gladiator”

Here we can see inside the guts of the object with all its members variables listed along with their value.

Bottom line: use ObjectUtil.toString()

When Adobe Flash Builder 4 cannot locate Adobe Flash Player

Wednesday, February 23rd, 2011

After installing the latest Flash Builder 4, ready to launch the app in debug mode, and bang! Flash Builder doesn’t find Flash!

Here is the ominous message:

Flash Builder cannot locate the required version of Adobe Flash Player. You might need to install the Flash Player or reinstall Flash Builder.

Do you want to try to run your application with the current version?

So Flash Builder, the tool used to compile Flash apps, cannot even launch its own result of compilation?

After the usual drill of uninstalling Flash Player and installing it again with all debug flavors of it, the problem is still there.

By the way this process is not trivial, you must:

1/ uninstall Flash Player by running a special tool making sure your web browsers are not running
2/ install the debug flavors you want:

The debug version for IE on Windows:

Download the Windows Flash Player 10.2 ActiveX control content debugger (for IE) (EXE, 2.99MB)

The debug version for Firefox on Windows:

Download the Windows Flash Player 10.2 Plugin content debugger (for Netscape-compatible browsers) (EXE, 2.95MB)

Now you would think after reinstalling Flash Player as suggested in the error message it would work?

No.

The problem arises when you don’t use the HTML wrapper to launch the app.

By default in the Project Properties (Project / Properties / Flex Compiler / HTML wrapper), “Generate HTML wrapper file” is checked.

This mean that when you run the app (or debug it), an HTML wrapper will be created and your default browser (or the one you manually set in Windows / Preferences / General / Web Browser) will be launched pointing to the location of that wrapper.
And most of the time it will work as the Flash Player installation above usually does its job.

But if the “Generate HTML wrapper file” is unchecked, Flash Builder will attempt to launch it without web browsers.
The problem is that it doesn’t even know the path to the Flash Player by default, even though it’s located in one of its own subfolders:
C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\player\win\10.1\FlashPlayerDebugger.exe

The solution is to make sure your .swf files are associated to the debug Flash Player:
1/ In the Windows Explorer, right click on any .swf file you find
2/ “Open with…”, “Choose default program…”, “Browse…”
3/ find your Debug Flash Player, most likely located somewhere in the vicinity of C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\player\win\10.1\FlashPlayerDebugger.exe

Now the error message should be gone and all is fine.

Would that be possible for Flash Builder 4 to try this location by itself?
Or at least write a more meaningful message than reinstalling Flash Player and/or Flash Builder?

Tooltip over a Flash object

Monday, October 13th, 2008

Add the following parameter to the OBJECT tag:

<param name="wmode" value="transparent">

Add the following attribute to the EMBED tag:

wmode="transparent"

Source