Labs

It works in my machine!

Archive for April, 2009

Always on Top

with one comment

today i found my self trying to put an Sprite on the top of the display list
so here is the basic idea for solve that problem

1
2
3
4
5
6
7
8
9
10
11
 
function alwaysOnTop_handler(e:Event):void {
	//make this child always on top!
	parent.addChild(this);
}
 
function added_handler(e:Event):void {
	parent.addEventListener(Event.ADDED, alwaysOnTop_handler, false, 0, true);
}
 
addEventListener(Event.ADDED_TO_STAGE, added_handler, false, 0, true)

cheers!

Written by Raúl

April 21st, 2009 at 5:24 pm

Posted in AS3, General

Tagged with

Grupo W @ badFonts group [ Flash CS4 text properties issue ]

with 3 comments

Using the Flash CS4 i had a little problem… everytime i tried to use the text tool, either flash crashed after or before even putting the text box on stage.

Thinking it was a flash bug i google search it… i found this.

i read only a few top posts and found that the issue was the computer performance, but then David here at W has the same computer as me. After formatting my pc flash was running ok, so there, problem fixed!

BUT when i put all of my stuff back in, again flash was doing the same thing. After a few hairs pulled and desks banged, we discover that it was the fonts i installed in the pc the day before, and going back to the link i found , reading all of the posts, Raúl found that same solution posted there.

What did we learn from this?
1: you don’t need to install every font you find.
2: read a little more before taking actions with the first post you find XD so you don’t have to format your computer in vain. XD

Written by wolf

April 8th, 2009 at 6:49 pm

Posted in General

Tagged with , , ,

Validating a String

without comments

well this is a handy code snippet to validate a string
if you want to avoid some bad words, this is for you:

1
2
3
4
5
6
7
8
9
10
11
12
 
function isValid(str:String):Boolean {
        var regExp:RegExp = /\b(badword|nastyWord)\b/i;
	var _isValid:Boolean = !regExp.test(str);
        return _isValid;
}
 
var _inValidMessage = "this is a example for a bad badword it's really nasty";
var _validMessage = "Hello Word!";
 
trace(isValid(_inValidMessage)) //false
trace(isValid(_validMessage))//true

you can add more words just separating them by a pipeline ( | ) in the Regular Expression

Cheers.

Written by Raúl

April 6th, 2009 at 4:27 pm

Posted in AS3, General

Tagged with