Labs

It works in my machine!

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

wowFlag [flarToolkit + pv3d + wowEngine]

with 7 comments


wowFlag from Wolf on Vimeo.

As promised on youtube: here it’s the source

( thx to saqoosha for the help on the flarToolkit issue of translating the flag fixed vertex… you can find his example of doing this on his site, but he maded it for away3d =) )

the code is very extended, so if you have any doubts post them here, we will try and answer all of them :)

Written by wolf

March 4th, 2009 at 3:27 pm

Command Pattern [Part 1]

with 5 comments

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 »

Written by Raúl

March 3rd, 2009 at 4:48 pm

Posted in General

HttpFox

with one comment

i was looking something like the “Activity” Window in Safari for Firefox and found this handy extension HttpFox

it comes very useful when you want to track your content-page information

cheers!.

Written by Raúl

January 26th, 2009 at 1:34 pm

Posted in General

busy busy busy!

without comments

hi guys! well we’ve been busy these days, in fact some of us didn’t have vacations these holidays
so you can imagine the load of work that we have
we promise to post some interesting things just in a couples of days (or weeks =D hehe)

meanwhile you can visit our new blog http://blog.grupow.com

cheers!

Written by Raúl

January 12th, 2009 at 3:03 pm

Posted in General

JSFL Extensions

with 3 comments

Hi everyone!, well we want to share you all the JSFL Commands that we found on the web,
these extensions have been very useful here at GrupoW our productivity increased like a 98%
and the graphic designer team have blessed us =D so here they are!!

  • Add Stop Frames.jsfl
  • All Bitmaps Lossless Compression.jsfl
  • convertoToSymbol.jsfl
  • Create Invisible Button.jsfl
  • Distribute To Frames.jsfl
  • DontUseImportedCompression.jsfl
  • Find In Library.jsfl
  • Funciton Order Library.jsfl
  • Linkage equals to Name.jsfl
  • Multiple Library Linkage.jsfl
  • Multiple Library Renamer.jsfl
  • Multiple Library UnLinkage.jsfl
  • ResetTransPoints.jsfl
  • SetCompressionLevel.jsfl
  • Smooth All Bitmaps.jsfl
  • Unsmooth All Bitmaps.jsfl
  • UseImportedCompression.jsfl
  • UseLosslessCompression.jsfl
  • i think you don´t need an explanation in how to install it and how to use it, they are very self descriptive

    DownThemAll!

    use them wisely

    if you know about other useful extensions don’t hesitate on posting them

    GrupoW Developer Team

    Written by Raúl

    December 5th, 2008 at 12:32 am

    Posted in General

    Tagged with ,

    [ papervision3d ] Texture switch at runtime

    with 2 comments

    Here we have a quick example on how to change the texture of a primitive object in papervision3d…

    At the end this is what you get:

    The Flash plugin is required to view this object.

    This is the Document Class, its pretty simple and the methods are self descriptive so i don’t think you’ll have any trouble using it :

    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
    
    package  
    {
    	import flash.display.Bitmap;
    	import flash.display.BitmapData;
    	import flash.display.Sprite;
    	import flash.display.MovieClip;
    	import flash.events.Event;
    	import flash.events.MouseEvent;
    	import flash.display.SimpleButton;
    	import org.papervision3d.view.BasicView;
    	import org.papervision3d.objects.primitives.Plane;
    	import org.papervision3d.materials.BitmapAssetMaterial;
    	import org.papervision3d.cameras.Camera3D;
    	import org.papervision3d.scenes.Scene3D;
    	import org.papervision3d.view.Viewport3D;
    	import org.papervision3d.render.BasicRenderEngine;
     
    	/**
    	* ...
    	* @author Wolfito
    	*/
    	public class Main extends Sprite
    	{
     
    		private var scene:Scene3D;
    		private var camera:Camera3D;
    		private var viewport:Viewport3D;
    		private var render_engine:BasicRenderEngine;
    		private var my_plane:Plane;
    		private var active_index:int = 0;
     
    		public function Main() 
    		{
    			create3dEnviroment();
    			buildPlane();
    			setEvents();
    			render3d();
    		}
     
    		private function create3dEnviroment():void
    		{
    			camera = new Camera3D();
    			scene = new Scene3D();
    			viewport = new Viewport3D(0, 0, true, true);
    			addChild(viewport);
    			render_engine = new BasicRenderEngine();
    		}
     
    		private function setEvents():void
    		{
    			//
    			stage.addEventListener(MouseEvent.MOUSE_OVER, startRendering, false, 0, true);
    			stage.addEventListener(Event.MOUSE_LEAVE, stopRendering, false, 0, true);
    			//
                           // button placed on the stage:
    			this.switchButton.addEventListener(MouseEvent.CLICK, switchTexture, false, 0, true);
    		}
     
    		private function startRendering(e:MouseEvent):void 
    		{
    			if (!this.hasEventListener(Event.ENTER_FRAME))
    			{
    				this.addEventListener(Event.ENTER_FRAME, render, false, 0, true);
    			}
    		}
     
    		private function stopRendering(e:Event):void 
    		{
    			this.removeEventListener(Event.ENTER_FRAME, render);
    		}
     
    		private function buildPlane():void
    		{
    			var texture:BitmapAssetMaterial = new BitmapAssetMaterial("Pocoyo_0");
    			texture.smooth = true;
    			my_plane = new Plane(texture, 500, 500, 4, 4);
    			scene.addChild(my_plane);
    			camera.target = my_plane;
    		}
     
    		private function render(e:Event):void
    		{
    			render3d();
    			moveCamera();
    		}
     
    		private function render3d():void
    		{
    			render_engine.renderScene(scene, camera, viewport);
    		}
     
    		private function moveCamera():void
    		{
    			camera.x = (this.stage.mouseX - (this.stage.stageWidth / 2)) * 2;
    			camera.y = (this.stage.mouseY - (this.stage.stageHeight / 2)) * 2;
    		}
     
    		private function switchTexture(e:MouseEvent):void
    		{
    			var bitmapData:BitmapData;
    			if (active_index == 0)
    			{
                                   //get bitmap linked from the library:
    				bitmapData = new Pocoyo_1(283, 283);
    				active_index = 1;
    			}
    			else
    			{
                                   //get bitmap linked from the library:
    				bitmapData = new Pocoyo_0(283, 283);
    				active_index = 0;
    			}
    			my_plane.material.bitmap.dispose();
    			my_plane.material.bitmap = bitmapData;
    			my_plane.material.updateBitmap();
    		}
    	}
     
    }

    you can download the source code too! =)

    Written by wolf

    November 20th, 2008 at 6:32 pm

    Sending Variables in AS3 A.K.A. sendAndLoad in AS2

    with 16 comments

    in AS2 sending and receiving variables was easy, you could do it even with your eyes closed =D
    but in AS3 is another story

    remember AS2??

    1
    2
    3
    4
    
    var lv:LoadVars = new LoadVars();
    lv.username = "ruliman";
    lv.password = "123456";
    lv.sendAndLoad("somefile.php",lv,"POST");

    nice isn’t??

    in AS3

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    var variables:URLVariables = new URLVariables();
    variables.username = "ruliman";
    variables.password= "123456";
    //
    trace(variables.toString());
    var request:URLRequest = new URLRequest("somefile.php");
    request.method = URLRequestMethod.POST;
    request.data = variables;
     
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
     
    try{
    	loader.load(request);
    }
    catch (error:Error) {
    	trace("Unable to load URL");
    }

    until here you can say “well it isn’t too bad just a bunch of classes, but is better organized =) i love AS3 ”

    but……..when you compile Flash tell you this!

    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
    at Error$/throwError()
    at flash.net::URLVariables/decode()
    at flash.net::URLVariables$iinit()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

    MUAHAHAAA!!!

    the PHP code is simple

    1
    2
    3
    4
    
    <?
    $user= $_POST["username "];
    $pass= $_POST["password"];
    ?>

    so…………where the error is coming from??
    i google it and found this answer, is very simple:
    my php wasn’t returning something so, put an echo throwing some variable something like:

    1
    2
    3
    4
    5
    6
    
    <?
    $user= $_POST["username "];
    $pass= $_POST["password"];
     
    echo "result=success";
    ?>

    and that’s it everything compiles normal, now i can go back to dinner =D

    Written by Raúl

    November 6th, 2008 at 8:43 pm

    Posted in AS3

    VerifyError: Error #1025 or Error from hell

    with one comment

    i was trying to read an XML with namespaces and then Flash throw me this weird error

    VerifyError: Error #1025: An invalid register 3 was accessed

    then we found that was beacuse of these lines (locally declared in a function)

    1
    2
    
    var ns = ttXML.namespace();
    default xml namespace = ns;

    the error comes when you try to call some function after those lines in your code

    the solution that we found was declare ns variable outside of the function
    and then everything works fine =D

    Written by Raúl

    October 29th, 2008 at 7:44 pm

    Posted in AS3