Archive for April, 2009
Always on Top
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!
Grupo W @ badFonts group [ Flash CS4 text properties issue ]
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
Validating a String
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.