Archive

Archive for the ‘Flex(Amazing Errors)’ Category

Flex application not working without debug version of Flash Player

Recently, I was having a requirement to develop the Flex Log management functionality. After doing lots of research and investing a time for 3 to four days I successfully managed the things to achieve the flex logging Mechanism which can log Line Number, Function Name, Class name into log File.

After delivering the functionality I was happy that I have done it  Its really a nice feeling. I was hoping for appreciation but result was bit different I have received a clients mail saying that on some of the machines Flex app not working without debug version of Flash Player , It was really an Head scratching experience when application just stopped running with a white background in screen with clock display.  I was quite surprised that application which were running perfectly well on my PC, wasn’t displayed properly on some of the PCs.

Hmm.. No Clues at all. I must say Adobe Sometimes handles such situation in very ugly, and with very unprofessional manner, its a horrible handling of such situation by Adobe Flex Framework Developers must criticized them for such things.

After lots of efforts and lots of revision to the newly added code, after doing everything finally the application showed up on one of the problematic machine when I changed the Flash Player version from standard one to debug.

Scenario and Solution

I was using following code

//Call To The Function traceDetails(new Error())

private function traceDetails(err:Error):void { err.getStackTrace(); } On My part i was using the method “getStackTrace()” Here the thing to remember is that getStackTrace() method is only available with Flash Debugger and Not With Flash player. So wherever i do not have Flash Debugger installed my application stops running.

So Things to do

1. Check if You’re using any API call that are only available in Flash Debugger and Not in Flash player (If You found Try commenting that line Application will start running).

2. Solutions may be Install Flash Debugger Version wherever you are running your application but not feasible considering end user because your application is not loaded successfully and you cannot prompt user.

3. In wrapper class put a check with JavaScript for Flash Debugger version availability and if it is not available through JavaScript Message Saying you need to have flash layer Debugger version installed along with link to install it J

4. Simply before your Flash Debugger API calls Check if(Capabilities.isDebugger) only then use those API or Skip those lines.

I am sure this will solve many peoples problem.

Following thread discussed the same problem

http://stackoverflow.com/questions/1137223/flex-app-not-working-without-debug-version-of-flash-player

Another Example how developer suffer due to some mismanaged framework things

http://stackoverflow.com/questions/867788/compile-flex-application-without-debug-optimisation-options-for-flex-compiler

Best Luck & Happy coding :)

Thanks and regards

Shashank Kulkarni

Feel free to comment on the post :)

Compilation Error: An internal build error has occurred. Right-click for more information.

This is another chapter to the amazing errors, which does not leave behind any signals how to solve it, and more interestingly what is the exact reason for it.

When we have a pretty large code base where many developers check in and check out the code regularly, it is very hard to find the exact cause of the error which comes while compiling the code. Same thing happened with me and to find the exact cause and the solution for it took a lot of time and interestingly and amazed feeling why it is happening so,

For Demo let’s compile the following code,

Case 1: Error :An internal build error has occurred. Right-click for more information

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="init()">

<mx:Script>
<![CDATA[
private function init():void{
var type:String;
switch(type) {
/* case "test":
break; */
}
}

]]>

</mx:Script>

<mx:Label text="Blank Switch"/>
</mx:Application>

While Compiling we get the Compilation error as “An internal build error has occurred. Right-click for more information.” No line number in error and we start scratching our head. But solution is simple just remove the switch block and application will get compiled again and we can move on with coding.

Case 2: Error : Classes must not be nested.

Replace the init() method and compile the code we get the error Classes must not be nested. same problem here but at least this time we will get the error at function call so it is bit easier to track

private function init():void {

var type:String;

switch(type)  {

case “hi”:

//var i:int = i+1;

break;

}

}

]]>

solution is simple just remove the switch block and application will get compiled again and we can move on with coding.

Same Problem is been discussed here as common problem but some times it becomes hard to find it so.

http://learn.adobe.com/wiki/display/Flex/Flex+Builder+3+Compiler+Errors

Case 3: 1047: Parameter initializer unknown or is not a compile-time constant.

Possible Solutions:

Checking the constant at function argument,Constructor is one of the big cause of such error,

like

package

{

public class Test {

//Constants is Class

//public class Constant{    public static const  LOGINNAME:String=”test”       }

public function Test(s:Sting=Constants.LOGINNAME){          

}//Function test Ends Here

}//Class Ends Here

}

Solution: Here if  we replace s:Sting=Constants.LOGINNAME by s:Sting=”test” Error is resolved

1047: Parameter initializer unknown or is not a compile-time constant. Error will be solved. Note that for error to display we must instatiate the Test class

Some other reasons :

Missing semicolon in Anycode where you have defined constants and Forgot to enter the Semicolon.

Especially if you use ArrayCollection in Constant you mest give a semicolon or else be ready for Unexpeted error.

See if Server is in restart mode then some times project doesnot get cleaned up properly and deployed properly so check Server status as “Started” and clean project it will do for you.

Thanks and regards

Shashank Kulkarni

Feel free to comment on the post :)

Flex Builder cannot locate the required debug version of the Flash Player problem, Simple Two Step Solution

April 22, 2008 shashankkulkarni 17 comments

Hi, This problem is what regularly me and many Flex guys faces,

C:\WINDOWS\system32\Macromed\Flash\Flash9d.ocx

Flex Builder cannot locate the required debug version of the
Flash Player. You may need to install the debug version of Flash Player 9.0
or reinstall Flex Builder. Do you want to try to debug with the
current version?

Well my personal experience is, After installing the latest flash player version too the issue remains unresolved and i keep getting the same error. lastly I decided to reinstall flex, But amzingly after reinstallling Flex Builder I was facing the same problem and really it was very frustrating,

After spending some time Well its programmers mind afterall may not be great one, I thought before installing new version lets reinstall the First one and thats how i got the solution,

Simple Two steps Solution

1. Reinstall the flash player with flashplayer Uninstaller.

2. Install the Flash plyer.

Wait…….. I know Ur Question would be where to get uninstaller and Latest player version :) then click the following link

http://www.adobe.com/support/flashplayer/downloads.html

Follow the steps mentioned above and :) Here you are ready to Rock Again with debugging facility :)

Best Luck :)

Thanks and regards

Shashank Kulkarni

Feel free to mail me :) shashank.pawan@gmail.com