Archive for March, 2006

java guy needed immediately

We have an immediate need for a java programmer here at my studio in Los Angeles. Need to work with us here in L.A…if remote we may just fly you in. Java struts programmer with experience in WebSphere, web services, J2EE patterns. if interested leave a comment with contact info.

Five Years Of Mac Os X

Ars Techinica has a good writeup on the recent history of OS X abd the Mac, an interesting read to see how far they’ve come.  If only Apple would stop referring to the OS as “10″-dot-something…

popurls.com

i like to keep up with sites like digg, reddit and the like.  Now popurls.com gathers up the top stories form all those sites and brings them into one place.  Pretty cool, they should add ebaumsworld though.  It’s really cut down on my websurfing though, i need some new sites to visit.

Auto-create getters/setters in TextMate

Since I'm digging into components more I have been writing a lot more getters/setters than I used to, which I don't like, because they are just boring. Luckily, I found a TextMate command by Jason Froderman that will automatically create getter/setter pairs from a class property you have selected. Yeah!

note: it wont work if you already have a value assigned to the property:

Actionscript:
  1. private var a:Number

works

Actionscript:
  1. private var a:Number =10

no workie.

random notes about components

getting into component dev in flash, so I just wanted to jot some notes down:

1. mx.core.View is better to extend from if your component has children it needs to lay out.
2. When you are extending from mx.core.View, calls to myComponent.size() are handled by the doLayout() method resize the border_mc (which is the RectBorder for the component that is set up in View) and then call the doLayout() method, which you overrisde in your class. Also, you don't need the init() method, though (i think) you can still use it.
3. The Flash Help documentation, though it seems to be pretty well improved over mx04, still needs some work.

more to come, im sure.

Designing Flash Pages for Google

infomit.com has an article up about designing pages for google, which talks about the Flash Search Engine SDK. One of the cool things about that I didn't know was that not only will it index the text on stage in a flash movie, but it will also index the text inside movieclips that are placed on stage with attachMovie().

If all your text is going to be included in the flash move at author time, then that is fine. However if youa re pulling dynamic data into the flash movie, then this is pretty ineffective. For those cases, I usually detect for a search engine bot, and if one is found then I dump the text contents of the database (relevent to the page that google is trying to find, if I have deep links set up on my site), with basic text formatting, rather than serve up the swf file. If it's a regular browser, it gets the swf file.

Cool, I just got a free copy of PHP for Dreamweaver 8!

I got a package today from Apress, and I was pretty confused because I hadn't ordered anything.  I opened it up and inside was a copy of the book PHP For Dreamweaver 8...which made me even more confused.  After a while I recalled a mini-contest at dmxzone.com from a while ago where they were giving away a few copies of the book if you answered a question right.  I guess I got it right.

By the way, Friends of ED seems like they are back with a vengance.    I am currently reading AdvancED Actionscript Components : Mastering the Flash Component Architecture , which I think is very good so far, and a co-worker of mine is raving about Foundation ActionScript Animation: Making Things Move!.  It's great to see some quality Flash books out again.

edit: how uncouth of me...thank you, Apress and dmxzone

argh..sorry about jamming the aggs again

my wordpress rss feed url that i was using took a poop on me...so I had to switch the url. another post to apologize for too many posts...smart,eh?

Refactoring can actually be sorta fun

About a month ago I finished reading the book Refactoring : Improving the Design of Exisiting Code, which is great. Coincedetally, right after finishing that, I am getting the chance to go back and refactor a project I worked on a few years ago. The fun part comes in when I can see a clear improvement in my programming, and see how much knowledge I've gained since the time I originally built the project.

For one example, looking back at this code, I can remember that I considered myself an "object-oriented programmer" simply because I knew had to make a custom class and instansiate it. I was still a ways away from really understanding key OOP concepts like encapsulation and composition.

In my original code, I wanted to create a slide show of images for a particular project, so I had this code inside a calss named "Display", which was a tangled mess of spaghetti code that tries contain the entire logic of the site in one file (picture a class with tons of switch and if/else statements and methods that would span over 100 lines):



Actionscript:
  1. //load the initial jpg for the project
  2. imgClip.loadMovie("images/"+clickedThumb.info.galleryName+"/"+clickedThumb.info.folder_name+"/1.jpg");
  3.  
  4. //build the sq buttons under the pic
  5. var squareIconBar = buildSquareIconBar(clickedThumb.info);
  6.  
  7. //attach a progress bar for the pic that is loading
  8. var progBar = ProgressBar.createProgressBar(squareIconBar, 1000, 225, 0, imgClip, broadcaster);
  9.  
  10. if (isSlideShow != true){
  11.  
  12. //stop the pre-exisiting slide show
  13. stopSlideShow();
  14.  
  15. //start the timer for the images' slideshow
  16. _global.startSlideshowInt = setInterval(this, "slideShowWait", 2500);
  17.  
  18. }

you can see a few things wrong with that little bit right there, namely that too much logic and too many properties necessary for controlling a slide show is contained in the Display class. After refactoring, I wound up with a new SlideShow class that contains the properties and methods (utilizing the "Move Method" refactoring), and teh code above was reduced to two lines:



Actionscript:
  1. picLoader = ProjectImageSlideShow.createSlideShow(this[activeSection+"Clip"], 1001, clickedThumb.info, this);
  2.  
  3. picLoader.addEventListener("projectSlideShowComplete", Delegate.create(this, onSlideShowComplete));

Even looking at that I can see I can probably refactor taht a little more, but still I think that's pretty decent. The slide show is encapsulated, and the Disaply class just composes itself with the SLideShow object...and just listens for an event telling it that the slide show is over. There's a few more examples I would like to post...actually what I would like to do is just post the files so people can check it out if they want.
Anyway, my points are these: If you are like me and you're programming experience began with flash, take some time to learn some skills that relate to programming in general...solidify your knowledge of OOP and design patterns, and don't strictly focus on actionscript.

Also, I think it's a good thing to go back and revisit old work...it's a good way to gauge how far you've come, and to test yourself as far as what you would do differently knowing what you know now.

Components within custom component

So, I'm taking my frist foray into building a legit flash component, and it uses some standard v2 components. I read in the documentation that you should use the component mc's instead of the compiled clips for the v2 components, but I didn't see any reasoning as to why. I made the switch, and I lost out on the live preview for components withing my component. Can anyone shed some light for me?