Archive for the ‘General’ Category
Conways Game Of Life
is an old AS2 experiment that i made some time ago
the rules are:
1. Any live cell with fewer than two neighbours dies, as if by loneliness.
2. Any live cell with more than three neighbours dies, as if by overcrowding.
3. Any live cell with two or three neighbours lives, unchanged, to the next generation.
4. Any dead cell with exactly three neighbours comes to life.
download the source files and and try different grid inputs
Playing with Pixels
i was just playing with pixels and BitmapData
the code is a little messy and is not optimized
at the end we didn’t use it on production but is a really nice mouse trial
hope you like it!
source files
Mouse Trap
ppiiiiuuuuuf! it’s been a whilee uh!!
now that we release the Energy Lab we have some time to post something!
if you go there you’ll find a really cool mouse effect
and here is a quick prototype in AS2 of how we build it
(just try to get inside of the box)
Grupow is hiring!
Location: Saltillo, Coah. Mexico
Position: Flash ActionScript/Flex developer
Information:
Mandatory technical skills:
• 3+ years experience in ActionScript 2.0 or 3.0 for Flash applications integrated with server-side web applications and CMS
• Papervision knowledge
• Experience implementing OOP concepts with ActionScript
• Experience integrating streaming media
• Building integrated data-driven applications
• Source control
Communication skills:
• Outstanding problem-solving and communication skills
• Available to work in-house during work hours – Monday - Friday
• Team player and leadership skills
Ideal additional skills:
• SWF address
• AIR
• Experience in building social networking and community systems, which include context and video tagging, streaming media and other advanced online communication features
Desired additional skills:
• Experience in PHP/MySQL
• CMS experience
To Apply:
Please send a copy of your CV with portfolio and examples of sites directly to rcalderon@grupow.com
Flash CS4 update (10.0.2)
yei!!! finally the desired update arrived ! =D
no more crashes for bad fonts =D
you can read the full list of changes at: swfgeek
by the way is a huge list!!
and more info at: Richard Galvan post
AS3 Dumper
i just found at libspark this handy class
it’s just like the ObjectDumper Class from AS2 =D
and has the ability to throw the message to the firebug console =D
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | package org.libspark.utils { import flash.external.ExternalInterface; import flash.utils.getQualifiedClassName; /** * <p>Data????????????perl?Data::Dumper??????? * ???????????Object, Array, Number, String, Boolean??? * XML????????????????? * ??????FireBug?console??????????????????????? * debug, info, warn, error ???????????????</p> * <listing> * package { * import org.libspark.utils.Dumper; * public Class Hoge { * var test:Object = { a:'hoge', b:'fuga'}; * Dumper.debug(test); * trace(Dumper.toString(test)); * } * // output * $var0 = { * 'a' => 'hoge', * 'b' => 'fuga', * } * * }</listing> * @author dealforest * @version 0.102 */ public class Dumper { private static const INDENT:String = " "; /* * @default 4tab */ private static var _dumpString:String = ""; /** * ???????????????????? * * @param args ???????(????) * @return _txt ?????????????????? */ public static function toString(... args):String { var _txt:String = _dumpString = ''; for (var a:String in args) _txt += parse(args[a]); return _txt; } /** * FireBug???????'debug'????? * * @param args ???????(????) */ public static function debug(... args):void { if (!ExternalInterface.available) return; var _txt:String = _dumpString = ''; for (var a:String in args) _txt += parse(args[a]); //interim action for IE ExternalInterface.call('function (txt) { try { console.log(txt); } catch (e) {}; }', _txt); } /** * FireBug???????'info'????? * * @param args ???????(????) */ public static function info(... args):void { if (!ExternalInterface.available) return; var _txt:String = _dumpString = ''; for (var a:String in args) _txt += parse(args[a]); //interim action for IE ExternalInterface.call('function (txt) { try { console.info(txt); } catch (e) {}; }', _txt); } /** * FireBug???????'warn'????? * * @param args ???????(????) */ public static function warn(... args):void { if (!ExternalInterface.available) return; var _txt:String = _dumpString = ''; for (var a:String in args) _txt += parse(args[a]); //interim action for IE ExternalInterface.call('function (txt) { try { console.warn(txt); } catch (e) {}; }', _txt); } /** * FireBug???????'error'????? * * @param arg ???????(????) */ public static function error(... args):void { if (!ExternalInterface.available) return; var _txt:String = _dumpString = ''; for (var a:String in args) _txt += parse(args[a]); //interim action for IE ExternalInterface.call('function (txt) { try { console.error(txt); } catch (e) {}; }', _txt); } /** * ???????????????????? * * @param arg ???????(??????1?) * @return ????????????? * @private */ public static function parse(arg:*):String { var argIndent:String = ('$var'+ ' = '); _dumpString += argIndent; inspect(arg, argIndent.replace(/./g, ' ')); _dumpString += '\n'; return _dumpString; } /** * ????????????????????? * * @param arg ???????(??????1?) * @param indent ???????? * @private */ private static function inspect(arg:*, indent:String):void { var bracket:Object; switch (getQualifiedClassName(arg)) { case 'Object': bracket = {start: '{', end: '}'}; case 'Array': bracket ||= {start: '[', end: ']'}; _dumpString += bracket.start + '\n'; recursion(arg, indent + INDENT); _dumpString += (indent +bracket.end); break; default: _dumpString += format(arg, indent, true); } } /** * ????????????????? * * @param arg ???????(??????1?) * @param indent ???????? * @private */ private static function recursion(arg:*, indent:String):void { for (var index:String in arg) { var tmp:* = arg[index]; var className:String = getQualifiedClassName(tmp); var bracket:Object; switch(className) { case 'Object': bracket = {start: '{', end: '}'}; case 'Array': bracket ||= {start: '[', end: ']'}; var str:String = (getQualifiedClassName(arg) == 'Object') ? '\'' + index + '\' => ' : ''; var indent_str:String = str.replace(/./g, ' '); _dumpString += (indent + str + bracket.start + "\n"); recursion(tmp, indent + indent_str + INDENT); _dumpString += (indent + indent_str + bracket.end + ","); break; default: _dumpString += format(tmp, indent, false, arg, index); } _dumpString += "\n"; } } /** * ?????????????????? * * @param target ?????Object * @param indent ???????? * @param braket ,?????????? * @param parent ?????Object * @param index Object?key * @return ??????????????? * @private */ private static function format(target:Object, indent:String, bracket:Boolean, parent:* = null, index:String = null):String { var className:String = getQualifiedClassName(target); var str:String = ""; if (getQualifiedClassName(parent) == 'Object') return indent + "\'" + index + "\'" + " => " + target + (bracket ? '' : ','); switch (className) { case 'String': return (bracket) ? "\'" + target + "\'" : indent + "\'" + target + "\',"; case 'Array': case 'int': case 'uint': case 'Number': case 'Boolean': return (bracket) ? target.toString() : indent + target.toString() + ","; default: return 'don\'t analyze'; } } } } |
from Dumper Class
check it out libspark.org they have very interesting things in their repository
by the way, the japanese characters doesn’t display in my browser =(
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.
Command Pattern [Part 1]
Well this is i think the most common pattern that i use in my apps
it’s not the exact implementation but it works for me =D
here’s and example on how i use it
Read the rest of this entry »

