For my actual project (a Camel Race for Philips) i had to search for a function which translates a flash.utils.date object into a calendar-week int. After a while of searching i found a coole one and i translated it into AS3. Maybe someone can use this one
function getCW(target:Date):int { var a = target.getFullYear(); var m = target.getMonth()+1; var j = target.getDate(); var S = Math.floor(a/100); var A = a%100; var aB = (a%4 == 0 && a%100 != 0) || (a%1000 == 0) ? 1 : 0; var jNA = (5*S+Math.floor(S/4)+A+Math.floor(A/4)+aB*6)%7; var w = Math.floor((jNA+(m == 1 ? j : m == 2 ? 31+j : Math.floor((30.6*m)-32.3)+j+aB*1)+5)/7)-Math.floor(jNA/5); return w == 0 || w == 53?1:w; }
For my last Project i had to send some variables from my Flash-app via AS3 to a PHP script, this script handles the next Steps of processing. (Unfortunately) I had to search for a solution which not produces a PopUp Window (critical because of the PopUp-blockers) for a long time. The AS3 function flash.net.sendToUrl() produces mystical error messages at compile-time.
However, i stared to use the load() method from the URLLoader Class as seen in the below-mentioned snippet. With this method you can send data to PHP scripts and the user doesnt recognize it. But be aware: the data will be send via HTTP-GET, that means that you shouldnt use it to send critical data (such as passworts, credit-card details). Within the PHP script you can get the Data with the $_GET[] array (in the snippet the vars myname and email).
Another advantage is that you can get result-variables from your PHP script (e.g. status-messages). For this you have to add an EventListener to the URLLoader-Object, you can access the data through the Event-Object in the EventHandler.
Code-Snippet:
function sendData():void{ var myrequest:URLRequest = new URLRequest("send.php"); //create a URLRequest Object and var variables:URLVariables = new URLVariables; //the name of the PHP-script var myPhpLoader:URLLoader = new URLLoader(); variables.myname = outro.name.text; //content of a textfield variables.email = outro.email_adresse.text; //content of a textfield myrequest.data = variables; myrequest.method = URLRequestMethod.GET; //via HTTP-GET myPhpLoader.load(myrequest); //send }
TweenFilterLite (AS3 Version) - Easily Tween Filters & Image Effects
I found a new Tweenig Class called “TweenFilterLite” as i searched for a way to animate TextField.
Till now i used the Tweener Class which can be found at the GoogleCode page. But this class can only animate Sprites, if you want to animate a TextField, the app crashes at runtime.
The concept of TweenFilterLite is different. With this class you can animate any kind of displayable objects. And so the main advantage (in my opinion) is that you can animate every child of DisplayObject without nesting it in a Sprite or a MovieClip etc.
A another advantage is that you can place several animation types (blur, fade, glow etc) in a queue and the class runs it one after the other. That means that you dont have to write onComplete functions for every animation (reduces code size and improves readability).
The Class has a very good documentation and, of course, is easy to understand. For further information (code examples, source, doc, small howTo) take look at the website: http://blog.greensock.com/tweenfilterliteas3/
Have a try!
1 comment
Check out this Flash / 3D rendering engine by alternativa platform in Russia - awesome! Almost feels like playing Doom back in the days…
More examples here.
First seen on mr. doob’s blog.


