Archive for August, 2008

Trace from the browser, using standard trace()Trace from the browser, using standard trace()

August 22, 2008
Some great 3rd party debug tools have been released in the past few months that expand upon the standard trace() in Flash. I recently wrote about one of them. Unfortunately, I’ve noticed myself not using these tools as often as I would like because its usually easier and quicker to just use trace(). The biggest drawback about trace, however, is that there’s no way to output from the browser … or is there?
The other day I stumbled upon an article by Josh Buhler at actionscript.org that shows you how to install the Flash Debug Player that’s buried in the application folders of Flash. The Debug Player, along with a text file, allows you to view standard traces from a swf in the browser. Now, if you’ve already read his article skip on down to the bottom of this page because I’ve added a step that will make you even happier. If you haven’t read his article yet, go on what are you waiting for? If, on the other hand, you like step-by-step instructions that get you up and running the fastest, I’ve recapped his process below. I’ve done this on both the mac and pc and can’t live without it now.
1) Uninstall your Flash Player
Find the uninstaller here: Adobe Flash Player Uninstallers.

Even though this is the first step, this is the one that you’re going to question the most, should I really uninstall my Flash Player and install the Debug Player? The answer is an emphatic “yes”. The Flash Debug Player is the exact same player with a very nice extra feature.

2) Install the Flash Debug Player

Find the installer here: Adobe Flash Debug Players

3) Verify installation of the Flash Debug Player

Restart your browser and right-click (ctrl-click) on a swf. You should have the “Debugger” option in the context menu, like the example below. Flash Debug Player

4a) Create a text file named “mm.cfg”

Save the file here:

OSX -
MacHD:Library:Application Support:Macromedia:mm.cfg
Windows XP -
C:\Documents and Settings\username\mm.cfg
Windows 2000 -
C:\mm.cfg
Linux -
home/username/mm.cfg
4b) Add properties to mm.cfg
ErrorReportingEnable=0
TraceOutputFileEnable=1
MaxWarnings=0
FLASH DEBUG PLAYERS 9,0,28,0 AND NEWER
4c) The property TraceOutputFileName is no longer needed in mm.cfg. The default location of flashlog.txt has changed and cannot be modified from the following locations:
OSX -
MacHD:Users:username:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt
Windows -
C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
Linux -
home/username/Macromedia/Flash_Player/Logs/flashlog.txt
FLASH DEBUG PLAYERS 9,0,16,0 AND OLDER
4c) Add the property TraceOutputFileName to mm.cfg
OSX -
TraceOutputFileName=MacHD:Users:username :D esktop:flashlog.txt
Windows -
TraceOutputFileName=C:\Documents and Settings\username\Desktop\flashlog.txt
ALL FLASH DEBUG PLAYERS
5) Test the Flash Debug Player

Either publish a swf that uses trace() and view it in the browser, or surf around and find out what other people have been tracing in their movies (that’s one of my favorite options). The traces have been output from the browser to the text file. Open up flashlog.txt and see for yourself, you know you want to.

And there you go. I’m sure many of you are extremely happy right now, and you should be, this is a great tip. But after a few uses, you’re going to get really annoyed opening and closing the text file to view the new traces … if only there was a way to view the text file being updated in real time like the Output window in Flash. Here’s the new step that will make you rejoice.
NEW STEP …
6) View the text file updating in real time
OSX -
Open Terminal
At the prompt type:
>> cd <path to flashlog’s directory>
>> tail -f flashlog.txt
Windows -
Go to Windows Server 2003 Tools, and download Windows Server 2003 Resource Kit Tools near the bottom of the page. Although it says Windows Server 2003 all over the page, its also made for Windows XP.
Install
Open Command Prompt
At the prompt type:
> cd <path to flashlog’s directory>
> tail -f flashlog.txt
Browse to a swf online that uses trace() and watch the magic. Terminal and Command Prompt display the contents of flashlog.txt as it changes … its just like having Flash’s Output window, except this one works in the browser!!
Isn’t this great? Like I said earlier, I’ve gotten this to work on both the mac and the pc and can’t live without it now. If you have any questions about these steps, feel free to email me or comment below and I’ll be glad to help.
OPTIONAL WINDOWS STEPS …
7) Create a batch file to quickly load up the flashlog in tail
Create a text file and rename it flashlog.bat
Right-click on the batch file and select “Edit”
Add the following content to flashlog.bat:
cd <path to flashlog’s directory>
tail -f flashlog.txt
Double-click on the batch file to see it working.
8) Create a shortcut to the batch file to set the Command Prompt colors and options
Right-click on the batch file and select “Create Shortcut”
Right-click on the shortcut and select “Properties”
To view the Command Prompt maximized change the pulldown under “Run:”
To change the colors of the Command Prompt select the “Colors” tab
Unfortunately the “Font” tab options are very limited
Under the “Options” tab, select “QuickEdit mode” to be able to easily select and copy and paste
Tip for copying and pasting in the Command Prompt:
Select the text you want to copy and then right-click it, this puts the selected text into the clipboard … now just hit ctrl-v or paste in any other program.

Close out of the properties and double-click on the shortcut to see the flashlog with your colors and options.

General Known Issues in Flash Player 9.0

August 21, 2008

General Known Issues in Flash Player 9.0

· Flash Player cannot progressively load files that are greater than 2Gb

· UILoader ignores scaleContent when content is loaded through loadBytes

· Memory utilization could substantially increase when large numbers of bitmaps that are subject to mipmapping are loaded

· Flash Player supports up to 30 frames per second playback for video.

· Opera and Netscape do not allow recursive calls using the ExternalInterface API into the Flash Player. This issue has been reported to Opera and Netscape.

· In certain browsers, full-screen does not render correctly when the window is split between two monitors where one monitor has a higher resolution than the other.

· Socket connecting to port under 1024 throws ioError, not securityError

· When using the Flex profiler, if FlashPlayerTrust is incorrectly created as a file, the Flex profiler will crash. Please ensure FlashPlayerTrust is properly configured as a directory.

· On the Windows standalone Flash Player, empty POST actions are changed to GET.

· Subsequent loads of ActionScript 2.0 SWFs containing components into a parent ActionScript 3.0 SWF may cause some components to break. The components will work on the first load, but loading new, or unloading ActionScript 2.0 components of the same class may exhibit this behavior.

· Developers should not rely on garbage collection if immediate clean up of active objects, such as display objects, streams and media, is expected. Use the appropriate ActionScript 3.0 APIs (close, removeEvent Listener, etc.) to get immediate behavior when cleaning up active objects.

· The delete operator is intended to remove properties of an object, and cannot be used to remove members of a class. For more details on the delete operator, see the ActionScript 3.0 Language Reference.

· Flash Player sound input does not work for OSX Audio MIDI sample rate settings higher than 48Khz. The microphone will either record noise or nothing. Some third party applications and MIDI breakout boxes will change the systemwide Audio settings on launch, and fail to return settings to default on close. To workaround this issue, go to Applications-> Utilities-> Audio MIDI Setup. Select Sound Input and change the properties for the ‘Built-in Input’ and/or ‘Built-in Microphone’ to a setting less than or equal to 48Khz.

· The standalone player cannot self-register SWF and FLV file associations under Vista without administrator privileges. Workaround: Users should launch SAFlashPlayer.exe once with administrator privileges by right-clicking on the EXE and selecting “Run as administrator” so it can correctly set the registry properties.

· Bitmap effects and filters cannot be printed.

· Button label text may not redraw correctly upon exiting full screen mode. User must mouse over the text to force the redraw.

· Transform Matrix transformations are not reflected in respective MovieClip/DisplayObject properties. Properties like scaleX, scaleY, and rotation are not changed as the result of changes to a DisplayObject’s transformation matrix (flash.geom.Transform, flash.geom.Matrix). However, changes to those properties are reflected in the matrix. If you change a property after changing the matrix, the matrix also resets to its original value. Affects ActionScript 2.0 and ActionScript 3.0. Workaround: If using matrix transformations, avoid using scaleX, scaleY, and rotation in favor of their respective matrix transformations.

· Triggering stage.invalidate() during a “render” event listener fails.

· Empty strings passed through External Interface API via JavaScript are converted to null.

· Some users are experiencing sound problems under Windows due to lack of support for WaveOut with drivers for some video cards, such as Realtek and SoundMax.

· Launching the context menu when in full-screen mode may temporarily reduce FLV video playback performance on Macintosh systems.

· Although full-screen mode does not support text input, the text input cursor will display over input text fields. Workaround: dynamically convert input fields to dynamic text fields or disable TextInput components when in full-screen mode.

MXML ActionScript Classes

August 10, 2008

As you know, all MXML files are converted to ActionScript Classes which are later compiled in SWF file. If you want to view / study these automatically generated classes, you can use Compiler Argument -keep-generated-actionscript in Flex Builder Project.

In Flex Builder navigate to Project > Properties > Flex Compiler > Additional compiler arguments and add following configuration: -keep-generated-actionscript

This will create a folder named generated in project source folder which will have all ActionScript classes which Flex Builder automatically generates from MXML ({MXML file name}-generated).