10/27/2008

Pulling in mp3 library folder

So I have a client who wanted to have mp3's that the user could listen to and also download. Since I'm very against having to constantly manage a clients content I wanted him to be able to have no problem adding and removing mp3 files. Normally, one might have an xml file that the user can update but that's to prone to fail on the side of the client. So what to do...



Enter getId3. This is a super handy tool for anyone who would want to retrieve data about mp3 files via php. Granted, php isn't that fastest and I have yet to test the speed of retrieval on a large scale, but as of now it seems to be a superb way to automatically generate my listing of mp3 files along with the data attributed to them.

Here is my php file I created to give you an idea of what it can do:


require_once('../../../getid3/getid3/getid3.php');

echo "\n\n";




// include getID3() library (can be in a different directory if full path is specified)

// Initialize getID3 engine
$getID3 = new getID3;

$DirectoryToScan = '../mp3'; // change to whatever directory you want to scan
$dir = opendir($DirectoryToScan);

while (($file = readdir($dir)) !== false ) {
 $FullFileName = realpath($DirectoryToScan.'/'.$file);
 if (is_file($FullFileName)) {
  set_time_limit(30);

  $ThisFileInfo = $getID3->analyze($FullFileName);

  getid3_lib::CopyTagsToComments($ThisFileInfo);

  // output desired information in whatever format you want
  echo "\t\n";
   echo "\t\t\n";
   echo "\t\t\n";
   echo "\t\t\n";
   
  echo "\t\n";
 }
}
echo "\n";

And here is my result

10/23/2008

Embedding htmlText in your TextArea control

So I'm currently working on my first mxml project at work (I've done other stuff but not at work so they were much less involved).

I realized a little in to the project that using the TextArea control can be a bit of a pain the ass at times. Namely, I couldn't find a way to embed fonts that were loaded into the flash and set in a stylesheet that I set the TextArea to use.
The problem here was that the textArea component only looks for a single font attributed to it in the styleName attribute that cna be set. If it doesn't see that there's a font there it sets embedFonts = false.

So liking to have as much control over things as possible, and realizing that not being able to embed my html goodness was not acceptable, I extended the TextArea class and after some finagling managed to discover the best means for fixing this. It appeared that the UITextField within the TextArea was dispatching a textFieldStyleChange event after it did it's validation. This alowed me to add a listener to the textField and set the embedFonts attribute to whatever I chose. Here is my class:

 import flash.events.Event;
 import mx.controls.TextArea;
 import mx.core.mx_internal;
 use namespace mx_internal;

 public class TextArea extends mx.controls.TextArea
 {
  public var embedFonts:Boolean = false;
  
  public function TextArea()
  {
   super();
   
  }
  private function handleTextFieldStyleChange(event:Event):void
  {
   textField.embedFonts = this.embedFonts;   
  }
  mx_internal override function createTextField(childIndex:int):void
  {
   
   super.createTextField(childIndex);
   textField.addEventListener("textFieldStyleChange", handleTextFieldStyleChange)
  }
 }

9/24/2008

Flash CS4

It's been a while since my last post. Right now I'm at my weekly nerd meeting (flashcodersny) and Colin Smith is going over Adobe Flash CS4. Holy crap it's awesome! Soooo many various things I can't even begin to describe. From 3d to things similar to soemthing akin to Poser.


But it's kind of limited. 3d can't really delegate each symbols z coordinate during runtime.


Either way it's super sweet. The z positioning alone is worth it. Assuming you work for a company that is more than happy to buy it for you. But, you should be able to get the library for it for building within as3 in eclipse or whatever flavor IDE you like.

9/10/2008

Reading...

So it's been a little while since my last post. I've been quite busy dealing with work and random visitors into my home. Lately I've been working with flex and contrary to my previous belief, I don't think it's so bad. Though I still feel a bit limited it does seem to cut down on trivial layout work which is a good thing.

Lately I've been reading a lot. Primarily, it seems to be books that all happen in the 'stans regions (Pakistan, Afghanistan, etc.). I'm currently in the middle of reading "Three Cups of Tea". It's quite the enthralling book about a man who happens upon a small village while attempting to climb K2 and ends up on a wuest to build schools for the poor villages throughout the country that the government never gave a second look at.

I also just completed "Kite Runner" and "A Thousand Splendid Suns" which are both also very amazing books. Though both based on fictional stories, they are strewn with factual references and accounts throughout the last 50 or so years in Afghanistan.

All three of these books have largely changed my view on those regions. Not that I had a bad view of them previously, but the books have really opened my eyes to the peoples' culture and method of thinking. All three of these books I highly recommend.

8/13/2008

mmmm tasty ANT

So I'm currently in a flashCodersNY meeting and today's topic is ANT. Wow! I've messed with ANT slightly in java but oh you can do some sweet stuff with ANT and Flex deploying to a server. Will try and update later...

8/11/2008

Adobe site of the day!

So the recent site I worked on is on Adobe's site of the day. W00t. http://www.adobe.com/cfusion/showcase/index.cfm
And finally someone said stuff about my map! Sheesh. lol.

The only thing I'm not liking is the shameless plugs they try to do. They say the site was created in flash(!?!) and dreamWeaver? Who even touches dreamweaver these days for a large site? Either way, it's awesome to be on the site, even if my name specifically isn't mentioned.

7/25/2008

Image loading with security sandbox fun.

Just a note in case anyone runs into this.

Loading an image from an external domain without a crossdomain.xml file can be tricky. typically I want to just grab the content of the loader and use it to be referenced for whatever. But in this case, when loading from an external domain that doesn't have a crossdomain.xml file you don't have the ability to do this. I ran into this today, as I have a loader that loads content like swfs and images from a domain that isn't flash friendly. I found the easiest way to run a check on what you loaded is to just check the url in the loader.

if(myLoader.contentLoaderInfo.url.lastIndexOf("swf")==-1)
{
    trace("This is an image")
}else{
    trace("This is a swf and I can access the movie clips within.")
}

ok bye
O.o

7/10/2008

What the Heck are Runtime Shared Libraries?

So keeping in the topic from my previous post of low overhead flash apps, I decided to talk a little bit about runtime shared libraries.

So what are Runtime Shared Libraries?
These are libraries that are used just like you normally use your libraries in Flex 3 but instead of storing them within the swf, during runtime it grabs the libraries from a specific place and loads them then. The difference is that if the user has already loaded that library then he/she needs not load it again, resulting in a faster load time.

But, not all libraries are treated equally. There are two different types of libraries, and they are cached in different places.
If the library you use is a typical Adobe one, like the framework.swc library, since it's signed by Adobe, it get's cached in the flashplayer itself. This results in a continuous cache throughout other browsers as well, assuming the user doesn't change his/her security setting for their flash player. Whereas, if you create your own library, which would not be signed by adobe, it's stored in the browsers cache. This is not bad either since as long as the user doesn't clear their browser cache they're good, though it isn't cross browser.

So there ya have it in a nutshell. For a little more in depth article on this topic visit this article written by Darrell Loverin at the Adobe Developer Center

XMLSyndication

So Last week I did a presentation on the adobe xmlsyndication package and the use of css within an as3 environment sans mxml at the flashcodersny meeting. I think all in all it turned out pretty good but there were a few issues I noticed.

The first being the dependancy on the adobe corelib package and the second being the dependancy on the flex library for a single thing. So I refactored their xmlsyndication and now it relies on nothing. In fact I was able to just about halve the size of my swf file because of this. In fact, I am able to rely solely on the playerglobal.swc which is the only actual library you need to publish swfs.

Why did I do this? Well, I think it's just that there seem to be too much reliance on other packages for things that don't really do that much. Relying on all of this will inevitably bloat your swf and cause load times to increase thereby driving people away from your flash reliant site. Granted in today's world many people have high speed internet access, sure, BUT when you start creating massive applications this can have a very dramatic affect on the size. Which will leave you with a massive application unless properly externalized and organized.

I'll be posting a link to the O'Reilly article once I'm done writing it. Yup, that's right, JC was mighty impressed and wants to add this to the O'Reilly's insideRIA site.
Sweet...

6/27/2008

A quick note.

I was trying to determine a way to sort an array without all the for loops and that sort of business when I ran across this post

Granted it's a little specific to what you want to sort but I'm sure with a little change you could sort based on the function call maybe. I implemented it for my map stuff and it worked out great for plucking out regions that items are on.

private function makeRegionList(myMapItemsArr:Array = null):Array {
   var tempArr:Array = myMapItemsArr;
   var keys:Object = {};
   var tempArr2:Array = tempArr.filter(function(item:Object, idx:uint, arr:Array):Boolean {
                        if (keys.hasOwnProperty(item.regionCode)) {
                                        /* If the keys Object already has this property, return false and discard this item. */
                                        return false;
                                    } else {
                                        /* Else the keys Object does *NOT* already have this key, so add this item to the new data provider. */
                                        keys[item.regionCode] = item;
                                        return true;
                    
                                    }
                        })
    return tempArr2
}

6/21/2008

Helping out around Visions Camp for the blind

So today we went to our NYCares thing at Visions camp somewhere an hour outside of the city. It was awesome. Just helping out and getting everything ready for the camp to come for the summer. All in all, it's been a very fulfilling day.

6/15/2008

NY Cares









Wow, so next Saturday is my first ever New York Cares volunteer work. I kept putting it off for forever but now I'm sticking with it. 
I'll be helping to prep a camp for blind kids called Visions camp. It's great because it involves things like painting and cleaning up the grounds and since I used to paint houses back in the day I got the mad paintin' skills.

Flash to PDF

I was reading back to some of my blogs and noticed I forgot to look into embedding swf files into pdf documents. Here is a link to a tutorial for it.

http://www.adobe.com/designcenter/tutorials/flashpdf/

Check it out.

6/07/2008

Charles Rangel

When the bill was trying to be passed to increase the amount of money children get for insurance (or something to that effect) I wanted to watch the process in which it was pushed through. 

So I tuned into C-Span and tried to keep tabs on what was going on. Unfortunately, bush vetoed this since I suppose he doesn't like children having insurance or something.  None-the-less, I discovered that my city has the most awesome representative.
His name is Charles Rangel
Now I could go on about him but intead I'll give you the link to his wikipedia page . 
He's been arrested three times, that I can see, for various human rights protesting causes. That alone tells me he should be where he is. But watching him on C-Span is the real kicker. The way he responds to certain situations is hilarious. He IS New York. I feel that during Senate meetings he should be sitting in front of a checkered table eating spaghetti and meatballs whilst dealing blows to the republican party.

6/06/2008

an update on my FirebugLogger class

I decided to tweak the class a bit more so I figured I'd throw it up here.

 
import flash.external.ExternalInterface;


public class FireBugLogger
{
private static var _enabled:Boolean = false;

public function FireBugLogger(singleton:SingletonEnforcer){}

public static function set enabled(t:Boolean):void{ _enabled = t; }
public static function get enabled():Boolean{ return _enabled }
public static function log(s:String):void { if(enabled)call('log', s); }
public static function debug(s:String):void { if(enabled)call('debug', s); }
public static function info(s:String):void { if(enabled)call('info', s); }
public static function warn(s:String):void { if(enabled)call('warn', s); }
public static function error(s:String):void { if(enabled)call('error', s); }

private static function call(func:String, param:String):void
{
trace(func+' :: '+param)
ExternalInterface.call("console."+func , param)
}

}
class SingletonEnforcer{}

5/27/2008

Belated blog from last week

Ok, so all in all today wasn't a bust. I think I walked away from each session with at least a couple new things to ponder about. Not so bad. ReflexUtil was one of those things. Looks to be a great debug utility.  Check it out yourself.

5/21/2008

Flexmaniacs

Ok so I'm in the first seminar for flex maniacs conference. While the keynote was pretty sweet, this skinning seminar is kind of lame. Let's hope I get at least something out of it.

5/16/2008

Utilizing FireFox Firebug

FireBug, for those that don't know about it, is a great little tool for debugging your apps online.  One of the many things you can do is use it as a logger. This is excellent for flash development debugging on the server as you can easliy utilize the console.log, console.debug, console.error, console.warn, and console.info. The following is a quick class I wrote up to use this:

package com.mylibrary.log

{
 import flash.external.ExternalInterface;
 public class FireBugLogger
 {
  public static function log(s:String):void{
   ExternalInterface.call("console.log", s)
  }
  public static function debug(s:String):void{
   ExternalInterface.call("console.debug", s)
  }
  public static function info(s:String):void{
   ExternalInterface.call("console.info", s)
  }
  public static function warn(s:String):void{
   ExternalInterface.call("console.warn", s)
  }
  public static function error(s:String):void{
   ExternalInterface.call("console.error", s)
  }
 }
}
So now you just import your FireBugLogger package and call FireBugLogger.log('HI THERE'), et voila!

5/14/2008

oh the randomness

private function randomSort(a:*, b:*):Number
{
            return Math.random()>.5 ? -1 : 1;
}
private function myFunc():void
{
             var myArrayToSort = [1,2,3,4,5];
            myArrayToSort.sort(randomSort);
             trace(MY ARRAY SORTED IS '+myArrayToSort)
}
Awesome way to randomly sort an array. I'm using this with the sliver movie to randomly place the clips in various positions so every time you watch the movie it's different. Pretty damned cool.

5/13/2008

oh man sweet

So a little update with the video project. I've got things importing into the Sliver clips and tweening open yada yada.  Mostly all of the tweaks are externalized, i.e. the reavling time, duration, text x and y on the clip, but the most fascinating thing was what I just discovered.  I was aware of being able to use the Tweener class to move, set alpha, etc. but I was not aware that there are some default props that you can set that are Numerical. Colors for instance. An example (assume your text is curently set at black text):

Tweener.addTween(myTextField, {_color:0xFFFFFF, time:1})

thats it! Also, blurs are there as well.
Tweener.addTween(myClip, {_blur_blurX:15, _blur_blurY:15, time:2})

and you have a blur. I love running into new stuff that I never needed before but is quite handy.

5/10/2008

Where I am now...

So for this project since I need all the text that will show up in the video to be externalized for language conversion, I have to load everything streaming. This will also cut down on loads times tremendously.  My first idea is to make this nice and quick and simple. I've got 2 classes that I determined I need. I have a "SliverMain" class and a "Sliver" class. I don't want to get too complex with this since I've only got a week and I'm working on other things on top of this. (ugh) my main class will basically Load my sound clip and the sliver elements that I have. I've stored the info for these in an array in a css file that I'm accessing. (Mayeb I'll talk about that later). So since I can pass the url links for those clips in my css, I loop through that creating those clips and storing a reference point to them in an array I aptly named "clipArr". And that's about where I am for my SliverMain class. My sliver class will basically perform the loading of the clips via NetConnection, NetStream, and the Video class. Once the object has been added to the stage it loads it's url that was set in my SliverMain class and sits on the video loading it. So now that I haev this working I'm going to work on masking these clips which has a minWidth (to determine my mask width when closed), and I may need a bgImage to view while the video is stopped and masked (bascially setting my vids alpha to 0 to view my bg for the sliver. Then I also need to grab the length of my audio in my SliverMain class and set a timer based on how many videos are being pulled in and divide that by the length of the audio to determine when my clips should show. I think there may also need to be a buffer time for while the videos are playing, so I'll grab the duration of each video, divide that by two and subrtact that number from each point I got from that. So: (audioDur/numOfClips) - (durationOfClip/2) Doing this is really handy for me as then I kind of pseudo code out what I'm doing while I write. good times.

latest work

So lately I've been working a lot on the flash for the Luxury Collection brand site. This latest piece I'm finding interesting though. I have a week to complete a video in flash. Normally, I would jsut say "screw it" and be lazy with the tweening. Not this time though. Mainly, because the video needs to have all of it's text externalized, and since we already have a good set up that I've been working with, I decided to programatically create this video. It will contain a collage of about 8 videos within the video along with a music track. Along the line throughout the flash, the videos will be masked out and once it's their time to show the  mask is expanded and the video plays.  I'll keep this up to date as I go. I wanna chronicle my voyage through this minor project jsut for the hell of it. 

5/02/2008

Adding Component Usability from Flex to Your Actionscript Project

Today I was in need of a quick alert box but realized the mx.controls.Alert is not included in the accessible packages when creating an Actionscript project. Well, after a bit of searching I found it was really quite easy. Though I imagine it bloats your app due to the component libraries added. Here it goes: 1. Right click on your project>properties 2. Select Actionscript> Build Path> Library Path 3. Add an swc, within this box you can either browse to your respective framework folder or type the following

${PROJECT_FRAMEWORKS}/libs/framework.swc
4. Repeat step 3 but with
${PROJECT_FRAMEWORKS}/locale/{locale}
Now you should be able to access things like mx.controls.Alert if ${PROJECT_FRAMEWORKS) doesn't work you can try ${FRAMEWORKS} and that should work. Otherwise just browse to your framework folder in the sdk folder
::Edit:: So it looks like in theory this would have worked, except that Adobe made their swc files very dependent upon a bunch of other things so unfortunately this just gives errors. I'll be looking into it more and seeing what I can find to fix this.

5/01/2008

More info

I was intrigued by yesterdays talk on this AS3 physics engine so I went looking for stuff. Apparently, on top of the APE engine for 2d there's a 3d engine called the Wow Engine. http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/ I'm still in the process of checking out the APE engine but we'll see how that pans out and this WOW engine as well.

4/30/2008

Flash Coders

So today I attended my first flashcodersny meeting. It was pretty informative, though it wasn't too indepth about the package we were discussing tonight.  It's called APE or Actionscript Physics Engine. From the brief look I've had of it, it seems to be pretty cleanly coded and documented. I'll be looking more into it in the next week to see what I could do with it. Maybe I'll mess with it and throw something up here.  Looking at the demo I see an awesome excercise to test this engine. They created a demo with an item based on the wind driven moving sculptures of Theo Jansen.  I think I'll look and see what other things he's made and maybe reproduce that in flash. That would be sweet.

4/19/2008

Jury Duty?!!?!?

So today I received my summons to serve in Jury Duty. The other month I was talking about how I think it's important to serve as a juror and now here it is. Ugh, me and my big mouth. Well, maybe I'll be able to bring my laptop while I wait to be on a jury so I can work on stuff and post on my experiences. We shall see.

At last

So after attending the recent Flex Camp Wall Street, I noticed I seem to be a little out of the loop in terms of Flex Development. I've been developing RIA's for Starwood, but it's only been through straight Actionscript 3 in the Eclipse Flex 3 plug-in.  So in order to see what I'm missing, I've decided to re-vamp my website developed completely in the Flex Builder environment. I'll be using my site as a testing grounds for everything I'll be working on. Whether it be map applications or fun Flickr API integration. So we'll see how well I stick with it tho.

4/18/2008

Interesting Note...

I just saw the current speaker embed a swf into a pdf. Interesting concept. I'll need to look that up later.

Flex Camp Wall Heat....

Omg it is incredibly hot in here. The conference started about an hour ago and I'm sweating balls. Oy. hopefully the things I learn todya will be worth it.

4/02/2008

Breaking News!!!!

Apparently NBC news has just informed the public... If you are thirsty, drink. If you aren't thirsty, you needn't drink. This may or may not include water, but it definitely does not include 8 glasses of water daily. /breaking news...

4/01/2008

R.I.P. Surface

Well Microsoft surface had it's run. It wowed a couple people but now there's even better and greater potential with the technology Apple gained by purchasing the company that created the screen tech for the iPhone.  Microsoft, you guys had your short lived run but it's just too difficult to fit your big table box in my pocket, or on my wall, or anywhere I need a table that I can put my legs under...

3/30/2008

Adobe Developer week update:

The seminars went well. some were great, some not so good, but I think I went away with a lot of information either way. If by some chance someone is reading this and wants to check out how they were and what they were all about you can visit the following link: http://www.adobe.com/cfusion/event/index.cfm?event=list&type=ondemand_seminar&loc=en_us You have to have an adobe account (it's free) but I think it's worth the time signing up. Check it out.

3/26/2008

Adobe Seminars

So Adobe is currently holding a week of seminars in which they go over various developer programs including Flex, Blaze DS, and what not. Pretty cool, and free. w00t. http://www.adobe.com/cfusion/event/index.cfm?event=detail&id=1200007&loc=en_us

3/06/2008

Keeping the machine oiled

It's interesting when I come upon FOX news clips. Here's a link to a site showing FOX's interviews with Hilary and Obama.  CLICK ME The interesting thing here is the tone in which FOX has with Hilary as opposed to Obama. They know, like everybody else, that if Hilary wins this Democratic nomination McCain will triumph. So what do they do? "Hey let's put on Hil and Obama and throw Karl Rove in there to give a nod to Hilary and negative false information toward Obama after they leave so neither one can parry his crap. I'm so amazed that FOX News can even call themselves news... It should be FOX opinion channel. In fact, why is there no law against created a biased news channel to push an agenda?

3/01/2008

HDRI

I ran into these shots of High Dynamic Range Imaging photos on Digg and it inspired me to give this a shot. I'll throw them on my flickr soon once I figure out which photos to convert. Good thing I use RAW image format for my camera.

2/17/2008

Sí, se puede!

So I recently ran across will.i.am's Obama video.  Wow, it sent shivers up my spine in a good way. Check it out to see what I'm talking about (not sure who I'm talking to since I dun think anyone even reads this.) But in the slim chance somebody does mistakenly stumble upon my blog and reads this. Please check it out. http://www.youtube.com/watch?v=1yq0tMYPDJQ And just maybe you to will be inspired to support Obama. Rally together and support a man who can lead this country to change for the better.

2/15/2008

The minor things

I recently started learning French and put my mac into french. Somehow, google ended up in french and today it just got too much, so I changed it back to english. In the midst of changing it back I noticed something in the language selection. Bork, bork, bork. Apparently google decided to have all sorts of language choices. From Bork, bork, bork to Klingon to Pig Latin, I just love how they put a fun spin on even the smallest things on the site.