Monday, April 14, 2008

Some actionscript 3.0 to get your evening started

I've been taking on a lot of responsibilities at work I normally wouldn't have anything to do with, as a result of that, I have been doing some Flash development lately. As a result I wrote some code I am proud of, not really because it's anything special, but just because I used to have such deep seeded fear of any Flash programming, and in two weeks I have completely re-written a file we use, which is now generated by dynamic xml for use with the latest version of actionscript for use on our entire intranet. I'm not going to explain it any more than it already is in the comments, just know that I liked what I did enough to document it. (and obviously, this is only the actionscript 3.0, the actual graphic part is not here, nor do I have the ability to post that)

(there's a scroll bar at the bottom of the frame, sorry, blogger apparently has shit for brains when it comes to formatting code)

//hard coded variables for testing directly in flash
//var myServer:String = "censore";
//var mySite:String = "/censored/";
//var mySubSiteID:String = "33";
//var myXML:String = "https://" + myServer + "/includes/headerXML.cfm?subsiteid=" + mySubSiteID;

var myServer:String = String(loaderInfo.parameters.server); //grabs server var from object embed
var mySite:String = ""; //creates var, set once xml is loaded
var mySubSiteID:String = String(loaderInfo.parameters.subSiteID); //grabs subsite var from object embed
var myXML:String = "/includes/headerXML.cfm?subsiteid=" + mySubSiteID; // creates full path to dynamic xml

var xmlLoader:URLLoader = new URLLoader(); //create new URLLoader Object
var xmlData:XML = new XML(); //create new xml data object

xmlLoader.addEventListener(Event.COMPLETE, LoadXML); //when the request is successful, call LoadXML function
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, LoadXMLioError); //when the request fails, call LoadXMLioError function
xmlLoader.load(new URLRequest(myXML)); //start it up by calling our xml url

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data); //set data from file to our data object
ParseHeader(xmlData); //send data to our parser
}

function LoadXMLioError(e:IOErrorEvent):void {
myLargeText.text = e.text; //print error code to browser
}

function ParseHeader(xmlInput:XML):void {
//prints our values to the trace window during flash debugging
trace("-----------Start XML Output-------------");
trace(xmlInput.header.smalltext.text()[0]);
trace(xmlInput.header.maintext.text()[0]);
trace("------------End XML Output--------------");

myLargeText.text = xmlInput.header.maintext.text()[0]; //set the large text as defined by xml
myLargeTextShadow.text = xmlInput.header.maintext.text()[0]; //set the large text shadow as defined by xml

if(xmlInput.header.smalltext.text()[0] != "0"){ //make sure theres a value to get rid of the 'loading'
mySmallText.text = xmlInput.header.smalltext.text()[0].toUpperCase(); //set the small text as defined by xml
mySmallTextShadow.text = xmlInput.header.smalltext.text()[0].toUpperCase(); //set the small text shadow as defined by xml
} else { // no value? 86 it.
mySmallText.text = "";
mySmallTextShadow.text = "";
}

mySite = xmlInput.header.url.text()[0].toLowerCase(); //set the URL on the clickable area
}

backtomin.addEventListener(MouseEvent.CLICK, backtominHandler); //create evenlistener for a click on the button
function backtominHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("/"), '_self'); // go back to root (THE MIN!)
trace("Action: Back to MIN"); //tell me what happens on debug
}

linkarea.addEventListener(MouseEvent.CLICK, linkareaHandler); //create evenlistener for a click on the link area
function linkareaHandler(event:MouseEvent):void {
navigateToURL(new URLRequest(mySite), '_self'); // go to the URL defined earlier
trace("Action: Go to Current Page"); //tell me what happens on debug
}

Wednesday, April 9, 2008

Visualize

This was too amazing, I absolutely had to share, check out the rest of this guys vimeo profile for even more.



Solar from flight404 on Vimeo.

Monday, February 18, 2008

Went to Las Vegas

I went to Vegas last weekend, it was a great time, of which I will have pics sooner or later. I was bored today (no work for Presidents day), so in between reading the Enron code of ethics for skool, I uploaded two pretty neat videos to YouTube. Enjoy.




Sunday, January 6, 2008

Writing off 2007

OK, I decided to change focus a little bit, I'm going to try and make updates more frequent, but they will be tons shorter. Sort of an expanded twitter. They can be about anything, updates in life to code snippets just so I can keep track of where I am at, maybe even just a quote I happen to find interesting. So, where to begin? How about now that 2007 is over and I have absorbed just about everything I think I want too, some stuff I enjoyed

Games
3 of them take the cake

  • Halo 3 - do I even need to explain this one?
  • BioShock - amazing, deep story, with great gameplay that pulled the whole thing together, and an amazing theme (Choice vs. Free Will). Could not possibly say enough good things about this one.
  • Portal - Short, but had a great story, humor, and game play. Looks like a shooter but is probably one of the best puzzle games I have ever played. An original throughout, here's hoping more developers get on the page of the team Valve put together for this one.
Runners-up: Super Mario Galaxy, Call of Duty 4

Movies
  • No Country For Old Men - amazing thru and thru. It really conveys 'the west' too, Chigurh is the stuff nightmares are made of
  • Juno - It's pretty much impossible not to love this movie, unless you're a soulless robot or something.
  • There Will be Blood - The definition of brutal. And not a stupid 'Saw' way, in a way that really digs down deep.
  • Transformers - yeah, it's my childhood re-packaged and re-sold to me, but I don't care, GIANT ROBOTS
Bitter disappointments: Spider-Man 3 beats out all. I tried to convince myself I liked it, but I just couldn't do it.

Monday, December 17, 2007

The great experiment

I finally put my money where my mouth was. For the last year I have talked about how amazing it is that every service a person could need online was available, and available for free. And yet, I was still paying for hosting. Today I decided to prove that I was right. I'm using mostly Google services for everything, my domains point here to the blog by default. I'm using Google pages for document hosting (I might switch to Google Docs when I figure out how to force my documents to download rather than show inline). Picasa for pictures. YouTube for video.

The only thing that I don't have the ability I used to is random footers for some forums (they were running on a PHP script I wrote, and I don't have PHP access. No biggie)

So, while a lot of you probably have no idea what I am talking about, those of you who do. Let me know if you join in the free revolution. There's no reason not too really.

I haven't decided if I am going to edit the look and feel of the site yet. Hasn't really bothered me yet, and I kind of like the simplicity. Plus I'm a programmer, not a designer, I don't need to show off.

RIP hosted falsefiction, viva la revolution.