3D model of a branch

This 3D model is inspired by a plant outside of the house we rented on vacation. It’s modeled in LightWave with basic surface textures nodes.

And a video…


Posted: January 22nd, 2010 | Author: | Filed under: 3D | Tags: | No Comments »

B18H22 inspired object

B18H22 inspired object.

Lightwave animation of an object inspired by a nido-cluster.


Posted: January 9th, 2010 | Author: | Filed under: 3D | Tags: , | No Comments »

A History of Easter Island


Posted: January 3rd, 2010 | Author: | Filed under: 2D | 1 Comment »

Gold Constitution Class Federation Starship

gold_Enterprise copyIt’s Gold! It’s in the upper atmosphere! Anathema!


Posted: December 29th, 2009 | Author: | Filed under: 3D | Tags: | No Comments »

Test animation of gecko lizard

I’ve done several 3D animations for corporate video – flying logos with effects and solid models, product shots, car parts, etc. – but here’s my first shot at 3D character modeling and rigging.

I’m using LightWave 3D version 9.6. All modeling was done with quads in Lightwave Modeler. Skin color was applied in modeler using  vertex mapping. Surface texture comes from an image map of continuous lizard skin pattern. Rigging was with standard bones and not the new “joints” because I had some trouble with the joint-rigging around the bendable regions.


Posted: December 15th, 2009 | Author: | Filed under: 3D | Tags: | No Comments »

Online Conversion – Convert just about anything to anything else

Online Conversion – Convert just about anything to anything else.


Posted: August 2nd, 2009 | Author: | Filed under: General Reference | No Comments »

Flash ActionScript 2 PrintJob function example

This ActionScript 2 code demonstrates how to use the PrintJob() function to generate a print job from JPG images in a subfolder.

In summary, what occurs is that all the images are imported/created as child movie clips of the parent movie clip, printZone, and then all the child movie clips are passed to the PrintJob object, pj.

The biggest problem with this code is that for some reason the print dialog box does not give you the option to print selected pages.

var printPath:String = "pages/"; // The is relative path to the subfolder containing the images.
var printLabel:String = "page-"; // For some reason I decided to use "page-" as the prefix for all the image files.
var printType:String = ".jpg"; // This is the file type for the images. You can use SWF files as well as PNGs instead, if you like.
var numPages:Number = 32; // The number of pages is hard coded but, given a chance to do it again, I'd probably go with an XML file definition.
var printXMin:Number = 0; // This variable and the next define the position on the page for the image. In this case, the upper left-hand corner is set to zero.
var printYMin:Number = 0;
var printXMax:Number = 1275; // This variable and the next define the number of pixels to force into the page from the source image.
var printYMax:Number = 1650; // And I set these variable to match the actual sizes of the JPG images so it would print the entire JPG image.
var printXScale:Number = 50; // An actual 8 1/2 X 11 sheet of paper is about 637.5 X 825 screen pixels and since the images are so much larger
var printYScale:Number = 50; // I had to scale them down 50% to fit on the page.

printCatalog = function() { // This function is called when some print button movie clip is released.
  loadingIndicator._visible = true; // The loadingIndicator movie clip nests a progressBar movie clip that is used to feedback progress for processes in general.
  var printLoader:MovieClipLoader = new MovieClipLoader(); // This is the MovieClipLoader object that manages to import the JPGs to the printZone movie clip.
  var printLoaderListener:Object = new Object(); // This object hosts the functions that are called for the MovieClipLoader object.
  var pageCount:Number = 1; // This variable keeps track of what page is being processed. 

  printLoader.addListener(printLoaderListener);

  printLoaderListener.onLoadProgress = function (target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {// This function updates the loadingIndicator to show progress of loading the individual pages.
    loadingIndicator.progressBar._width = Math.round(bytesLoaded/bytesTotal*100);
  }

  printLoaderListener.onLoadInit = function (mc:MovieClip) {//This function is called when the image is done loading.
    pageCount++; //When the image is loaded then the pageCounter is incremented. This could probably be put after the if-statement and the (numPages+1) term in the if-statement could be simply numPages.
    if (pageCount==(numPages+1)) {
      printDocument(); // If this is the last page then go ahead and print the document.
    } else {
      printNextPage(); // Only when the image is loaded do we proceed to load the next page image.    }
  }

  printDocument = function () {//This function simply takes the entire array of movie clip children from printZone and adds them as pages to the PrintJob() object, pj.
    var pj = new PrintJob();
    if(pj.start()) {
      var i = new Number();
      for (i=1;i<=numPages;i++) {
        printZone["page"+i]._xscale = printXScale;
        printZone["page"+i]._yscale = printYScale;
        pj.addPage(eval("printZone.page"+i), {xMin:printXMin,xMax:printXMax,yMin:printYMin,yMax:printYMax},{printAsBitmap:true}, 1);
        loadingIndicator.progressBar._width = Math.round(i/numPages*100);//Here the progress of the pages adds is reflected in the loadingIndicator movie clip.
      }
      pj.send();
      loadingIndicator._visible = false;
      delete pj;
    }
  }

  printNextPage = function () { //This function parses the file name of the page and then
    var pageString = new String();
    if (pageCount<10) {// For whatever reason, I formatted the files to be "page-001.jpg, page-002.jpg, ... , page-010.jpg, etc,..." This if-then statement formats the page element to match.
      pageString = "00"+pageCount.toString();
    } else {
      pageString = "0"+pageCount.toString();
    }
    var fileName:String = printPath+printLabel+pageString+printType;
    printZone.createEmptyMovieClip("page"+pageCount, pageCount);
    printLoader.loadClip(fileName, eval("printZone.page"+pageCount));// Here the image is called to load.
  }

  printNextPage(); // So here's where we start by loading the first page.
}

This swath of code is fairly down-and-dirty. It could probably stand to have some error handlers. Also, a lot of this information could be offloaded to an XML file and make it more flexible.

-RC


Posted: July 14th, 2009 | Author: | Filed under: Code Reference | Tags: , | 1 Comment »

Action Script 2.0 for playing a loop of a series of SWF files defined in an array.

So, yeah. Say you want to create a SWF that imports a series of SWFs and loops them. Well, here’s one way to do this.

// Action Script 2.0 for playing a loop of a series of SWF files defined in an array.
// Completion of the individual SWFs is defined as the event when the current frame
// is equal to the total number of frames.

fscommand("FULLSCREEN","true");
fscommand("showmenu", "false");

// You'll need a movie clip on the stage named movies_mc to hang the SWFs from. If you decide not to have one you can uncomment the following line to generate one.
//this.createEmptyMovieClip("movies_mc", 1);
var main_mc:MovieClipLoader = new MovieClipLoader();

var mcListener:Object = new Object();
main_mc.addListener(mcListener);

var movieTitle:Array = ["movie1.swf", "movie2.swf", "movie3.swf", "movie4.swf", "movie5.swf"];
var i:Number = 0;
var ii:Number = 0;

mcListener.onLoadInit = function(target_mc:MovieClip) {
    target_mc.onEnterFrame = function() {
        if (this._currentframe >= this._totalframes) {
            trace("total frames = " + this._totalframes);

            i++;
            loadNextMovie(movieTitle[modFunction(i, movieTitle.length)]);
            delete this.onEnterFrame;
        } else {
            trace(target_mc._currentframe+" OF "+target_mc._totalframes);
        }
    }
}

function loadNextMovie(moviePath) {
    if (i>0){main_mc.unloadClip(movies_mc);}
    trace("loading movie:" + moviePath + ", i="+i);
    main_mc.loadClip(moviePath, movies_mc);
}

function modFunction(n:Number,b:Number):Number {
  //****** MOD FUNCTION
  // n = number to apply the mod function to. b = base of for the mod function
  var result:Number = new Number();
  result = n - b*(Math.floor(n/b));
  return result;
}

loadNextMovie(movieTitle[i]);

This script should be loaded into the first frame of a single frame FLA.


Posted: May 25th, 2009 | Author: | Filed under: Code Reference | Tags: , | No Comments »

In ActionScript 3 the TextArea object CSS attribute can be fussy

You can get different results from the same SWF if it’s executed locally versus a web server.

Suppose you have a TextArea object called “mytext” and you want this object to use css.

code 1

mytext.styleSheet = css;
addChild(mytext);

code 2

addChild(mytext);
mytext.styleSheet = css;

code 1 will render the TextArea object just fine on the local system but will not correctly render the css (specifically the line-height) from a web server.

code 2, however, will render the css correctly in both cases.


Posted: April 30th, 2009 | Author: | Filed under: Code Reference | Tags: | No Comments »

A stand alone flash player

Here I need to make a flash stand-alone player that will play on PC and Mac. It will import a .swf that itself nests a .flv.

package {
  import flash.display.*;
  import flash.net.*;
  import flash.system.fscommand;
  public class basic_standalone extends MovieClip {
    public function basic_standalone () {
      var request:URLRequest = new URLRequest("themovie.swf");
      var loader:Loader = new Loader();
      //This next line prevents the viewer from rescaling the content but in Mac
      //you can still scale the .app window.
      stage.scaleMode = StageScaleMode.NO_SCALE
      fscommand("showmenu","false");
      loader.load(request);
      addChild(loader);
    }
  }
}

I had to add a mask the size of the stage and an empty sublayer to prevent assets being viewed outside the stage area if the user decided to scale the viewing window. I’d like to prevent the viewer from resizing the window but outside of using Director I haven’t found a good way to do it yet.

References:

http://blog.0tutor.com/post.aspx?id=96&titel=Dynamic-import-flash-content-with-AS3


Posted: June 6th, 2008 | Author: | Filed under: Code Reference | No Comments »