Archive for the 'Uncategorized' Category

Google Analytics Flash Event Tracking

With starting up a new Interactive Agency it’s important to gather metrics about how people are using your site. I wrote this article to create some more awareness about the new Google Flash Analytics Event Tracking.

Check out the article here.

CS54, LLC – Now re-mixed with Papervision

CS54, LLC

After over 4 years with no love, the new CS54 website is here. Test it out, tell us what you think. New sections will be releasing in the weeks to come. We couldn’t release too much all at once.

http://www.cs54.com

Papervision Double Sided Plane (err sorta) :/

Papervision double sided plane

As far as I know there are 2 options when creating a double sided plane. Double sided meaning a different material for each side.

Option 1:
Create two planes. Plane 1 with a z sorting of 1 and the other with 0 and the rotationY of one of those planes set to 180. You could then contain this in one display container.

Version 2:
Create one cube with a depth of 0. Then you just apply a material to the front and back. OK OK OK so this is not really a Plane... but I like this approach because it allows me to more easily use things like Bend Modifier.

If anyone has a better or more improved approach I would love to hear about it.

Here is what the code for Option 1:

Actionscript:
  1. package com.cs54.ui
  2. {
  3. import org.papervision3d.objects.primitives.Plane;
  4. import org.papervision3d.materials.MovieMaterial;
  5. import org.papervision3d.materials.utils.MaterialsList;
  6. import org.papervision3d.objects.DisplayObject3D;
  7. import com.everydayflash.pv3d.modifiers.Bend;
  8. import flash.display.DisplayObject;public class Tree2Planes extends DisplayObject3D
  9. {
  10. [Embed(source="/assets/tree-side-1.png")]
  11. public var TreeFront        :Class;[Embed(source="/assets/tree-side-2.png")]
  12. public var TreeBack            :Class;
  13.  
  14. protected var treeFront        :DisplayObject;
  15. protected var treeBack        :DisplayObject;
  16.  
  17. protected var treeFrontMat    :MovieMaterial;
  18. protected var treeBackMat    :MovieMaterial;
  19.  
  20. protected var treeMatList    :MaterialsList;
  21.  
  22. protected var _height        :Number = 175;
  23. protected var _width        :Number = 191;
  24. protected var _container    :DisplayObject3D;
  25.  
  26. protected var plane1        :Plane;
  27. protected var plane2        :Plane;
  28.  
  29. public function Tree2Planes():void
  30. {
  31. treeMatList     = new MaterialsList();
  32. treeFront        = new TreeFront();
  33. treeBack         = new TreeBack();
  34.  
  35. //Tree Materials
  36. treeFrontMat     = new MovieMaterial(treeFront, true);
  37. treeBackMat     = new MovieMaterial(treeBack, true);
  38.  
  39. treeFrontMat.allowAutoResize = false;
  40.  
  41. plane1        = new Plane(treeFrontMat,_width,_height);
  42. plane2        = new Plane(treeBackMat,_width,_height);
  43.  
  44. plane1.z = 1;
  45. plane1.rotationY = 180;
  46.  
  47. _container = new DisplayObject3D();
  48.  
  49. addChild(_container);
  50. _container.addChild(plane1);
  51. _container.addChild(plane2);
  52.  
  53. }
  54.  
  55. public function get height():Number
  56. {
  57. return _height;
  58. }
  59. public function get width():Number
  60. {
  61. return _width;
  62. }
  63.  
  64. }
  65.  
  66. }

Here is what the code for Option 2:

Actionscript:
  1. package com.cs54.ui
  2. {
  3. import org.papervision3d.materials.MovieMaterial;
  4. import org.papervision3d.materials.utils.MaterialsList;
  5. import org.papervision3d.objects.DisplayObject3D;
  6. import org.papervision3d.objects.primitives.Cube;
  7. import com.everydayflash.pv3d.modifiers.Bend;
  8. import flash.display.DisplayObject;
  9.  
  10. public class Tree extends DisplayObject3D
  11. {
  12. [Embed(source="/assets/tree-side-1.png")]
  13. public var TreeFront        :Class;
  14.  
  15. [Embed(source="/assets/tree-side-2.png")]
  16. public var TreeBack            :Class;
  17.  
  18. protected var treeFront        :DisplayObject;
  19. protected var treeBack        :DisplayObject;
  20.  
  21. protected var treeFrontMat    :MovieMaterial;
  22. protected var treeBackMat    :MovieMaterial;
  23.  
  24. protected var treeMatList    :MaterialsList;
  25.  
  26. protected var treeCube        :Cube;
  27. protected var _height        :Number = 175;
  28. protected var _width        :Number = 191;
  29. protected var _container    :DisplayObject3D;
  30.  
  31. public function Tree():void
  32. {
  33.  
  34. treeMatList     = new MaterialsList();
  35. treeFront        = new TreeFront();
  36. treeBack         = new TreeBack();
  37.  
  38. //Tree Materials
  39. treeFrontMat     = new MovieMaterial(treeFront, true);
  40. treeBackMat     = new MovieMaterial(treeBack, true);
  41.  
  42. treeFrontMat.allowAutoResize = false;
  43.  
  44. treeFrontMat.animated = true;
  45.  
  46. treeMatList.addMaterial( treeFrontMat, "front" );
  47. treeMatList.addMaterial( treeBackMat, "back" );
  48.  
  49. treeCube     = new Cube(treeMatList, _width, 0, _height, 6, 6, 6);
  50.  
  51. var bend:Bend = new Bend(treeCube);
  52.  
  53. bend.quickBend(1, .1);
  54.  
  55. addChild(treeCube);
  56.  
  57. }
  58.  
  59. public function get height():Number
  60. {
  61. return _height;
  62. }
  63. public function get width():Number
  64. {
  65. return _width;
  66. }
  67.  
  68. }
  69.  
  70. }

Loading MD2 Models with Papervision

Code to load MD2 files below. Anyone out there want to help create simple MD2 models that work well with Papervision - or - does anyone know of a good resource to purchase already animated models? I just wanted to get a few for some blog entry's. Full credit would be given or course. I found several models this morning but after a few hours only 1 of them was of value. It happened to be the one tied to Clint Hannaford's example. :/

Once you have a good model here is the super simple code to load it:

Actionscript:
  1. var wireframeMat:WireframeMaterial = new WireframeMaterial(0x000000);
  2.  
  3. var md2:MD2 = new MD2(true); //if you get errors try using false - it may be a single frame file (no animation)
  4. md2.load("assets/test_4.md2",wireframeMat);
  5. //Add to your scene for rendering

Yeah I know.. That's it. The hard part is finding a model that doesn't suck.

update: How to fix / activate a @#$@! new or upgrading iPhone

Evidently this might work. I am still waiting so we'll see. I am still pissed off tho!

Text from the site:

Have you tried to activate your iPhone to no avail? Are you holding a $299 brick in your hand? Here's what you do. When activating your iPhone (or just upgrading to 2.0 software), if you get an error message on your phone, DO NOT UNPLUG IT. That will restart the entire process.

Instead, just wait. Leave your phone be and don't close iTunes.

We've successfully activated five different iPhone 3Gs with error screens just by letting them sit plugged in for anywhere from 10 to 15 minutes. Hopefully that might work for you, too.

http://gizmodo.com/5024334/how-to-fix-iphone-and-iphone-3g-activation-woes


Follow papervision2 on Twitter

RSS Feed