Posts Tagged ‘Flex’

Flex Builder Cannot Locate the Required Version of Flash Player

Saturday, March 28th, 2009

I am writing this post becouse I am very “angry” and I need to say something before I explode. This error has “eat” three hours of my time (I am very angry when I lose my time with useless things).

All starts with a fresh OS. After I have install Adobe Flex Builder and import some of my projects I had try to run one project in a stand alone Flash Player BUT (big buttt) I have receive :

Flex Builder Cannot Locate the Required Version of Flash Player” .

This was not my first time when I have receive this error so I had try to fix this, the simplest way I had know, access http://www.adobe.com/support/flashplayer/downloads.html download Flash Player 10 ActiveX control content debugger and reinstall Flash Player, BUT (again big buttt) no result the Flex Builder still bother me with : ”Flex Builder Cannot Locate the Required Version of Flash Player” so I call my best friend “Google” asking him about the error.

After at least a hour of searching and reading all I have found was how to fix this error for Firefox:

Firefox was looking for the npswf32.dll in the ProgramFiles/Mozilla Fireforx/plugins directory yet Macromedia installed it in the window/system32/macromed/flash directory.”

some trash links and for a Stand Alone Flash Player to uninstall Flash Player and install the Debug version of Flash Player from http://www.adobe.com/support/flashplayer/downloads.html BUT no solution for me, nothing to work.

I tried to reinstall the Adobe Flex Builder, no luck, tried to install Flex Builder as a Eclipse plugin, no luckno luck, no luck …… So if you are “HERE” when you thing nothing can help maybe the solution I will present next will help you.

I have found this trying to open a “.swf” file and see that no default program was set to open files with .swf extension, the next thing I have done was download the Download the Adobe Flash Player 10 Update for Windows and Macintosh extract the files and copy the “Player\Debug\FlashPlayer.exe” for example in “C:\”. After that I have select a .swf file and open it with “C:\FlashPlayer.exe” making this the default program to open “.swf” files.

After this simple action, BINGO no BUT no error in Flex Builde “all good to go”. I hope this can help you spare some time.

Application Domains in Flex

Wednesday, March 4th, 2009

In this post I will try to explain the best I can why you need to know about application domains and how to use them. An application domain is the partition within which an application runs in Flash Player.  If you read the documentation you will see that application domain is a container for discrete groups of class definitions.

But what exactly an application domain does and when the understanding of application domain will helps you ? Usually there is just one application running which  implies the existence of only one application domain. Hance you will not notice or care about the application domain. However, when you load additional .swf files into your application you can create additional application domains for all the .swf files you load.

So let’s start. I will try to explain the application domain with an example. Let’s say we have an application named MyApplication that has a class HelloW with one function sayHello() and we want to load two .swf files in this application that has a class with the same name HelloW with one function sayHello() . When we load a .swf file, three possible things can occur:

1. The loaded .swf runs in an existing application domain.
2. The loaded .swf runs in a new application domain that is a child of an existing application domain.
3. The loaded .swf runs in a new application domain that is completely partitioned from all other application domains.

So let’s see for our example what will happen in each of the three cases :

1. The loaded .swf runs in an existing application domain

sameappdomain
Fig 1.0

You can load a swf in the existing application domain like this:

var context :LoaderContext = new LoaderContext( );
context.applicationDomain = ApplicationDomain.currentDomain;

var request  :URLRequest = new URLRequest(”SWF1.swf”);
var loader :Loader = new Loader( );

loader.load(request, context);

In our example, if we load our two swf files in the existing application domain the HelloW class from the first swf and HelloW class form the second swf will be lost against the HelloW class from the main application. Another problem will be that the SWFHelloW class from the second swf will be lost against the  SWFHelloW class from the first swf.  So, in the end, we will have :

- the HelloW class from MyApplication
- the SWFHelloW class from SWF1

Using this application domain we share code and use less memory, but in first SWF1 we have lost the HelloW class this can cause some big errors. All objects from SWF1 that use HelloW will now use HelloW from MyApplication and this class has different functionalities so this will cause some pretty nice errors. In the second SWF2 we have lost the HelloW and the SWFHelloW class. Which  can cause considerable  errors. In the end we will have an app with a lot of errors.

In order for this application domain  to work we must edit our example like this :

- the HelloW class from SWF1 and SWF1 must do the same things as HelloW class from MyApplication
- the SWFHelloW class from SWF2 must do the same things as SWFHelloW class from SWF1.

2. New application domain that is a child of an existing application domain

Neither of this  application domains is  good(suited) for our exemple. But let me show you what is the main difference between this application domain and the one before.

childappdomain1
Fig 2.0

In this application domain we lose the HelloW class but we don’t lose the SWFHelloW class from the second SWF.  We  achieve this application domain like this :

var context :LoaderContext = new LoaderContext( );
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

var request  :URLRequest = new URLRequest(”SWF1.swf”);
var loader :Loader = new Loader( );

loader.load(request, context);

3.  New application domain

This is the solution for our example. Using this application domain in the end we will have:

- the HelloW class from MyApplication
- the HelloW class from SWF1 and SWF2
- the SWFHelloW class from SWF1 and SWF2

newappdomain
Fig 3.0

However, it is important to use these sorts of exclusive application domains only when necessary because they will increase memory usage. I hope this example has shown the importance of application domain and has given you a better understanding on what application domain you need depending on the result you want.

Proud to present at Flex Camp Timisoara

Thursday, February 19th, 2009

I just thought I would do a quick post to let everyone know I have been confirmed to speak at Flex Camp Timisoara. I will be presenting on how to connect your Flex Application to a MySQL database using my library AS3FlexDB.  

This is the first Flex Camp outside of Bucharest. It’s a very cool and informative event. It’s a must go event for all Flex developers! Come out and listen to my talk where I will cover how you can  speed you development using AS3FlexDB.

Flex Camp Timisoara will be held Mar 14, 10:00 - 17:00 at West University Timisoara 

Read the agenda and more info here.