Archive for the ‘Flash’ Category

17
Nov

Flash CS4 released, or is it?

Posted By wassim in Flash

As a flash expert and enthusiast, I was thrilled when the release of the new Flash CS4 was announced. Like thousands of other flash coders, I went through the pain of downloading the trial version of Flash CS4 (almost one gigabyte large) just to find that the help files and API documentation were simply not there! The help menu takes you to adobe site to check the online version (if you are connected to the internet) or simply displays some very basic info with no code samples whatsoever.

I can now say with confidence, Adobe is following a pattern with every new release of Flash since CS3, the documentations are getting crappier with every release, not a good strategy if they want people to actually learn flash and if they want to expand the use of flash as a platform.

CS4 brought yet another disappointment to me and millions of RTF users, the “ligature” support is buried deep inside some user unfriendly classes and there is no simple way to access this essential feature for the average user by simply setting a property for a static or dynamic text field, way to go Adobe, really smart!\r\n

So was Flash CS4 really released or is this just another pre-release alpha quality software? The latter seems more probable.

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:

[as]
function lTrim(txt:String):String {
while
(txt.charAt(0)==” ”
||txt.charAt(0)==”\t”
|| txt.charAt(0)==”\n”
|| txt.charAt(0)==”\r”
) {
txt=txt.substring(1,txt.length-1);
}
return txt;
}
//usage example:
trace(lTrim(” here’s a text to trim”));// outputs : here’s a text to trim
[/as]

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,

[as]

function rTrim (txt:String):String {

while (txt.charAt(txt.length-1)==” ” ||txt.charAt(txt.length-1)==”\t” || txt.charAt(txt.length-1)==”\n” || txt.charAt(txt.length-1)==”\r”){
txt=txt.substring(0,txt.length-1);
}
return txt;

}
trace(rTrim (“rtrim this please \n\r “)+”delimiter”);//outputs : rtrim this pleasedelimiter

[/as]
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.