Sunday, October 31, 2010

Flash Builder 4 (Flex) : Failed to connect; session timed out

Flash Builder 4 (Flex) +Google Chrome : Failed to connect; session timed out
Or  "Show redraw regions" don't appear although tou have the Flash Player Debugger installed  

Environment:  Flex or Flash and Google Chrome

When running a Flash Builder project in debug mode  and your default browser is Google Chrome you might get the following failure message:
Failed to connect; session timed out.
Ensure that:
1. You compiled your Flash application with debugging on.
2. You are running the debugger version of Flash Player

Solution: Disable manually the Google Chrome integrated Flash Player plug-in.
  1. Open your Google Chrome Browser
  2. Type in the URL  "about:plugins" + enter
  3. Find the Flash plugin and expand the section by clicking the "+Details"
  4. In the expanded flash section find and disable the Flash Player that use the "gcswf32.dll"
  5. That's it, the Google Chrome should use now the Flash Player Plugin content debugger.

Sunday, May 23, 2010

Error #1046: Type was not found or was not a compile-time constant: TextField.

Flash, Action Script 3 

publishing FLA and getting the error "Error #1046: Type was not found or was not a compile-time constant: TextField"

You have not imported everything you are including in your movieClip. For example if you are using dynamic textField inside your movieClip and you didn't imported the TextFiled class
Even if you create a dynamic text field and yet you didn't create the code to handle this dynamic text field you'll see this error.

Import the the relevant class.
In this case:
import flash.text.TextField;

Monday, May 17, 2010

TraceLog - Seeing the output window on-line

Trace Log

Trace Log is a free open source software that enables you to perform real-time monitoring on any server logs simultaneously. The main goal is to group all related log files into one tool so that you don't have search and dig for them. This tool enables you to attach any log files, such as Tomcat logs, WAS logs, IIS logs, etc.

If this is the first time you are use Trace Log, you need to configure and attach any necessary log files. Once attached, a configuration file will be stored locally in your user profile of that computer. The next time you use this software again, it will load the configuration automatically and you can begin monitoring the log contents immediately.

Related links:

Project home page

Required software                                                                                                                                                
Trace Log

Java Runtime Environment (JRE)

Adobe Flash Player 10 — Debugger Version
Java Runtime Environment 

Edit > Options > Log Configuration > Log Files

Windows XP:
C:\Documents and Settings\\Application Data\Macromedia\Flash Player\Logs\flashlog.txt

Windows 7:
C:\Users\\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt

Create a file named “mm.cfg” in one of the following locations:
§  Windows XP; C:\Documents and Settings\\mm.cfg
§  Windows 7; C:\Users\\mm.cfg
§  OSX; /Library/Application Support/Macromedia/mm.cfg
§  Linux; home//mm.cfg
Open the newly created mm.cfg file in a text editor and add the following text:
The flashlog.txt file will be created in the following location:
§  Windows; C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
§  OSX; /Users/username/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt
§  Linux; home/username/Macromedia/Flash_Player/Logs/flashlog.txt don't save the file

Flash, Action Script 3 

When creating a  for downloading a file to user local hard drive the download dialog is open as it should but when I click the "Save" button I can't find the saved file.

The FileReference variable is declared inside the download function and as a result of that he is a "local variable" (obviously :-) ).
When the download dialog is opened, the FileReference is unknown since he was declared inside the function. code sample 1

Declare the FileReference variable outside the download function as a "Global variable". code sample 2

Code sample 1:

 private function startDownload(e:Event):void  
 var fileRefToDownload:fileRefToDownload = new FileReference(); 
 fileRefToDownload.addEventListener(Event.COMPLETE, downloadCompleted); URLRequest(fileToDownloadURL), "this_is_my_file_name.jpg"); 

Code sample 2:

var fileRefToDownload:fileRefToDownload; 
  private function startDownload(e:Event):void  
  fileRefToDownload = new FileReference();  
  fileRefToDownload.addEventListener(Event.COMPLETE, downloadCompleted); URLRequest(fileToDownloadURL), "this_is_my_file_name.jpg");  

Check max profit by buying & selling day

See the Pen Check max profit by buying & selling day by Ariel Barkan ( @ArielBarkan ) on CodePen .