Archive for the ‘Flash’ Category

28
Sep

Flash CS4 new features

Posted By wassim in Flash

Adobe recently announced Flash CS4, with great new features the flash community has been asking for, I had the chance the see the full package and I was impressed of the implementation of inverse kinematics, reminded me of moho’s (now anime studio) bones layers although moho’s offered much more options and flexibility, flash’s implementation is however dynamic i.e. we can script the bones and there’s a whole set of AS3 APIs for this purpose.

3D is also a much awaited feature yet papervision3D and alternative3D as well as other packages have much more than what adobe has to offer and are open source which make me wonder why adobe has not simply acquired and integrated one of these packages…

Again I feel that adobe is slowly but steadily removing the carpet from under the feet of AS2 developers, as I speculated, there’s no access to these goodies from within AVM1 i.e. AS2 is retiring in the eyes of the flash team and unless someone comes with some ingenious way to keep AS2 “hip and cool”, all of us AS2 guys will have to make the switch into the bitter AS3 beast with its unfriendly compiler that keeps yelling at you even you write one line of straight forward code…

One depressing find out is that RTL is not supported in static text fields, only in dynamic and input text fields with exotic ligature turned on.

25
Jul

A quick way to detect Idleing in flash actionscript 2

Posted By wassim in Flash, Flash Tutorials

So I had this customer who asked me to do an flv player for his site, he wanted the controls of the player to fade out when the user is idle, now flash does not have an onIdle event of any kind and the only way around this was to trigger a signal when the mouse kept its position (did not move) for more than 3 second (or x seconds, customizable) or keys has not been pressed for x seconds.

Again, flash does not have an onMouseStill event so I had to do it this way:


this.onMouseMove=function(){
clearTimeout(toInt);
fadeControlsIn();
toInt=setTimeout(fadeOut,3000);

}
function fadeOut(){
//fading out code goes here…
}
function fadeControlsIn(){
/fading in code goes here….

}

A similar approach can be applied to keypresses.

Hope this helps.

16
May

Flash player 10 and RTL support

Posted By wassim in Flash

Big news, flash player 10 beta supports complex text layouts and namely support for RTL languages like Arabic! At last, more info here : http://labs.adobe.com/technologies/flashplayer10/demos/videos/text.html

There are many other features added like CPU surfacing and GPU compositing as well as enhanced drawing API and native 3D support yet the RTL support is something we’ve been waiting for long time, finally it has arrived! Thx Adobe, let’s hope it works as advertisied.

25
Apr

Left trim and right trim actionScript functions

Posted By wassim in Flash, Flash Tutorials

Left trim and right trim actionScript functions
These useful functions (lTrim and rTrim) are available in almost all programming languages yet not in actionScript, so here’s how to write ones yourself:
lTrim is easier, so we’ll start with that:

Actionscript:
  1. function lTrim(txt:String):String {
  2.     while
  3.             (txt.charAt(0)==" "
  4.             ||txt.charAt(0)=="\t"
  5.             || txt.charAt(0)=="\n"
  6.             || txt.charAt(0)=="\r"
  7.             ) {
  8.         txt=txt.substring(1,txt.length-1);
  9.     }
  10.     return txt;
  11. }
  12. //usage example:
  13. trace(lTrim("   here's a text to trim"));// outputs : here's a text to trim

Pretty much straight forward, the function accepts a string as argument and returns a string, it checks whether the first character is a space, tab, or newline character and simply cuts it out and runs the same check on the resulting substring until there are no white spaces left at the leftmost end of the string.

Now for the slightly harder rTrim function,

Actionscript:
  1. function rTrim (txt:String):String {
  2.    
  3.     while (txt.charAt(txt.length-1)==" " ||txt.charAt(txt.length-1)=="\t" || txt.charAt(txt.length-1)=="\n" || txt.charAt(txt.length-1)=="\r"){
  4.         txt=txt.substring(0,txt.length-1);
  5.     }
  6.     return txt;
  7.    
  8. }
  9. trace(rTrim ("rtrim this please  \n\r       ")+"delimiter");//outputs : rtrim this pleasedelimiter

The logic is very similar, feel free to use these wherever you like.
I would recommend using these as part of a class for string manipulation.
Btw, these functions are AS2 and AS3 compatible.

20
Apr

paypal enabled mini mp3 player

Posted By wassim in Flash

An XML driven slick mp3 player with playlist support and paypal as payment gateway, the look and feel is clean crisp and WEB2.0.

The player displays album art and a nice spectrum analyzer animation and comes with two skins, the black and white ones.

Here's a preview of the players, click to see them in action: