Thursday, April 8, 2010

Ok now that you have got Flash Develop and Flex SDK on your end assuming you listen to my advice, create a new AS3 project and hit F5. If everything is correct you will get the Flash Player running an empty screen. If you get an error stating...

"Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option."

it's time to say good bye as your PC cannot and will not compile the script due to lack of vision you are with the majority of us that got stuck with this. Mind you this error comes with SDK 4. After hunting around for a solution, fear not, I have found one!

Go to Projects->Properties->Compiler Options->Additional Compiler Options



Add -static-link-runtime-shared-libraries=true into the String Array... click on that '...' button to add. If you are like me, you will try to type into the 'String[] Array' thingy but it doesn't work. See the time I just saved you? Once it's done.... hitting the F5 will release you from the pain which you are suffering. anger leads to hate, hate leads to pain, pain leads to suffering... is this right? Where does evil fit in?
It should look like below...



Soon after there appears a blank Flash Player Screen. If it's not there, one of the reason might be that the 'No output' checkbox is checked. Just go to Projects->Properties to uncheck that OR you might have the 'Test Movie' option below messed up, which is not likely to happen.

Everything runs, fine. You just compiled your first Flash Develop empty project. Now what fun is that? Lets put in the traditional 'Hello World' Expand the Project Viewer Tree (The thing on the right) under 'src' you will see a Main.as file created for you. Right click on it, you will see the 'Always Compile' checked. What this simply means is that the main.as file will always compile Now that explanation is about as useful as a peice of s..... Ok what it means is that the entry point to the flash .swf you are gonna generate starts from main.as so basically everything starts from main.as. If you are not keen on using main.as as the main starting point, fell free to add a new file and check it as 'Always Compile'. You will see that the main.as automatically demotes and the new file gets the 'Always Compile' icon! duuuhh

Ok.. back to coding. Starting from main.as, double click on it and watch what was defaulty is there such word? written in it. That's basically the proposed item in it which is needed to compile an empty screen. Note 'proposed'... Add a

trace('Hello World');

in the init function. Hit F5 and you should see a 'Hello World' in the 'Output' window.



What's that? No Hello World? You need to spell it correctly in order to make it appear... One of the reason is that you are testing it on a NON DEBUG flash player :D Yes, that was an issue for me for about 5 minutes. To solve this just to go Adobe and get the 'Adobe Flash Player X — Debugger Versions' Get the standalone projector version if possible whichever that suits your style, just remember to point to it under

Tools->Program Settings->FlashViewer ... mine is 'flashplayer_10_sa_debug.exe'.

Ok you should be able to get the 'Hello World' working properly by now!

No comments: