Feel free to visit my fresh new personal site !!!
Credits:
GFX : Kassad / www.frak.fr
Code: well, hum me...
Feel free to visit my fresh new personal site !!!
Credits:
GFX : Kassad / www.frak.fr
Code: well, hum me...
Recently i made a quick visual effect including the latest Flash Player 10 classes : Vector & Vector3D classes.
As the Vector and Vector3D classes are well optimized, I wanted to optimized my own loops.
So came again the question : "What is the most optimized loop system for these classes ?"
So i wrote a quick "while loops" performance test where i use a huge Vector array of Vector3D instances where i tried several systems.
I firstly thought that there was no way using the "for loops", but i read this quite interesting article :
and i finally put the for loop test as the last test.
Each test performs a vector crossproduct on each Vector3D, and this for 2 millions vectors !!!
clear here to start the while-loop test
I was used to coding my loops with the first loop test :
i = vect.length;
while(i--){}
but apparently the most optimized loop on my mac (imac 27") should be the 3rd test :
i=vect.length;
while (--i>=0) {}
For my computer (Mac/Firefox) each test of the benchmark is almost the same, even the "for loop" which is quite efficient.
But I look closely, the fact is was using the less optimized while loop (according to this test)...
It's up to you to test your own computer and may choose one of these loop.
As i was installing Alchemy toolkit for some experiment, i was first stuck in installing the Flex 3.5 SDK : to get the flex sdk linked to your system you are supposed to add the "flex/bin" directory in your system path.
Looking on the web, the ".profile" file has to be changed, but i couldn't find it... the reason : I had no ".profile" file on my system....
So if you don't have any ".profile" file in your home directory (your nickname directory), here are the steps to follow :
1) First of all, you may want to show hidden files on your mac to see exactly what you do, to do so type the following lines in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
2) Then create a new file in TextEdit for example and add this :
export PATH=$PATH:/usr/local/bin:/Applications/flex_sdk_3.5/bin
(in my example I unzipped the flex sdk in my Applications generic folder)
This will add the flex bin folder path in your system path.
3) Now save the file as ".profile" in your your home directory
4) Now you have to load/reload your ".profile" to make it active, type this in the terminal :
open a new Terminal so that it opens in your home directory and type:
. ./.profile
this will reload the file
5) test if your path has been integrated in the $Path variable, type
echo $PATH
6) Final step, check if Flex SDK is now available :
just type "adt" in your terminal and you should not have any error
That's it, if you want to check if your path
The facts :
As you may know, some tools like firebug helps you tracing incoming and outcoming data between flash and scripts, even if you use POST data.
See below how firebug can trace all variables sent through the POST data :

firebug tracing
So i tried to figure out how to implement a crypted system to secure (a little bit more) these data, with an encryption key if possible.
I found the useful project on the web : as3crypto project
Thanks to this class, you can crypt/decrypt in flash but as far as i looked the sources, there was no information about crypt/decrypt on php side.
But i found another message in a forum where a php code was given, so i mixed both to provide you a simple way to set both sides.
In my example, flash send some data to php using crypted message and PHP answer another crypted message (+ the original decrypted flash message for verification):

include_once "lib/cryptlib.php";
// init a new instance of Crypto Class
$crypto = new Crypt;
// init with the encryption key
$result = $crypto->init("PASSWORD");
// get the POST data
$messagefromflash = $_POST ["message"];
// decrypt data
$decrypted_messagefromflash = $crypto->decrypt(utf8_decode($messagefromflash));
but you can also send back crypted data to flash using the "encrypt" method
// return a crypted result to flash $resultmsg = "Ok, i received your data, everything is fine !"; echo "result=".$crypto->encrypt(utf8_encode($resultmsg));
// instance of crypto class
private var _crypto : CryptoCode;
public var myLoader : URLLoader;
// create instance with encryption key
_crypto = new CryptoCode("PASSWORD");
// send crypted string to php script
var variables : URLVariables = new URLVariables();
variables.message = _crypto.encrypt(tosend_in.text);
// create request with POST method
var request : URLRequest = new URLRequest("http://www.lecrabe.net/wordpress/demo/crypt/scripts/testcrypto.php");
request.method = URLRequestMethod.POST;
request.data = variables;
// send request
myLoader.load(request);
If you want to get the whole example, please download the sources.
Enjoy.
It's been a long time since i post a new article, and it's a brand new start !!!
The blog turned into wordpress blog, and here is a handy tool I wrote for my personal use in the first place :
Mac File Cleaner is a tool for people who work on both Mac and Windows platforms.
Every time a mac user send files to a windows user, many hidden files appears in the windows system : "._*" files and ".DS_Store" files.
These annoying files may be a problem as in my personal project, so MFC will solve this problem in 2 steps :
1) place the MFC executable file in the root folder where you want to remove those mac files
2) run MFC, and it will recursively remove every mac files
STEP 1 :

The mac files cleaner is placed at the root of the project.
STEP 2:

MFC indicates where the recursive operation will start from, then click CLEAN button
STEP3 :

MFC deletes all mac files recursively and shows you the scanned folders and deleted files.
If wrong files are deleted, they may be found in the system trashcan.
Enjoy.
Thanks god eclipse has its own undelete option !!!
Here is a little trick that may help you to target items on scene right after a gotoAndStop/gotoAndPlay
Flex to Flash IDE conversion of the amazing 8Bitboy project, with an extra example, yipee !
My latest AS3 investigation using the graphics & mathematics capabilities of Flash player.
Here a fast experiment of as3 and video handling, enjoy !