Flash in the Can: Day 2!

April 21st, 2008

I realize that I haven't posted in forever, but I'm at FITC, and I just paid $13 for a day's worth of internet, so I'm going to use the internet to its full advantage, god dammit.

So! I should probably make a retropost for Day 1, so look for that later. Right now, though, I just got back from seeing ISO50/Tycho and a panel on getting into the industry and some famous designer's experiences. Horrendously interesting stuff.

I also bought a few ISO50 posters! They're awesome.

Time to get back to it.

PS Remind me to talk about our little sneak peek from Adobe of Flash CS4. F-curve editor for tweens? Yes, please.

ActionScript Cross-post: Flash Media Server is CRAZY!

February 13th, 2008

This is a cross-post from my Labs site that I set up for code tidbits from school projects.

And not in a Alicia Silverstone and Liv Tyler 90's music video hot kinda way, either. The kinda way that makes you think, "What the hell were they thinking when they implemented this crap?" After that you think, "And why didn't they make good tutorials?"

Let's talk FMS + AS3. Since the tutorials are in some kind of AS1/2 moon language, I thought I should post the AS3 code I finally managed to get working, so that you all won't have to waste your time (hopefully). Here goes.

Client-Side
The client-side is pretty straight forward if you know AS3, but if you've been trying to use the guides Adobe gives you, there's a slight twist.

 
package {
  import flash.events.NetStatusEvent;
  import flash.events.SyncEvent;
 
  //This bit is important!
  import CustomNC;
 
  public class MediaServer {
    //Note the use of a custom class (CustomNC) instead of NetConnection!
    private var client_nc:CustomNC;
    private var rtmpAddress:String = "rtmp://rtmp.address/my_rtmp_app_folder";
 
    public function MediaServer() {
      //trace("New MediaServer");
      init();
    }
 
    public function init() {
      client_nc = new CustomNC();
      client_nc.connect(rtmpAddress);
      client_nc.addEventListener(NetStatusEvent.NET_STATUS,onClientStatus);
    }
 
    private function onClientStatus(e:NetStatusEvent) {
      trace(e.info.code);
      if(e.info.code == "NetConnection.Connect.Success") {
        trace("Successfully connected to RTMP server.");
      }
    }
  }
}
 

This is the class I created to deal with Flash Media Server. One key piece here is to create a custom NetConnection class (which I'll provide in a sec) to allow the server to send down function calls.

 
package {
  import flash.net.NetConnection;
 
  public class CustomNC extends NetConnection {
    public function CustomNC() {
      //trace("New Custom NetConnection");
    }
 
    public function myCustomFunction() {
      trace("Sup");
    }
  }
}
 

That's it! I know it's not much, but it's the only way I've found to allow the server to pass down orders. This bit of code is intended to replace this (because it's no longer valid syntax in AS3):

 
myNetConnection_nc.myFunction = new function() {
  //Stuff!
}
 

Server-Side

Now for the server-side stuff. Honestly, this is looking way easier than it was to figure out. Oh well.

 
application.onConnect = function(newClient) {
  application.acceptConnection(newClient);
 
  trace("Accepted connection");
 
  newClient.call("myCustomFunction");
}
 

That's pretty much it! Save that as main.asc and pop it into your RTMP folder and it should run like a charm. Theoretically. If you need to troubleshoot, don't forget to reboot your application (just the app, not the server) after overwriting your main.asc file. Otherwise, it won't use the new code!

Leave a comment if anything is unclear or you're still having problems. Or email me at chris at iamnotgoodattheinter dot net.

Oh, I almost forgot, the ActionScript syntax made possible by this cool WordPress plugin. Go nuts!

http://ideathinking.com/wiki/index.php/WordPress:CodeHighlighterPlugin

I’m sorry!

February 13th, 2008

I'm changing my theme to yet another canned theme, because this one is too thin for code, and I'm about to post some.

Who knew I’d be such a dork?

February 1st, 2008

So a QGYH2 (what a username) posted this gem on Digg today. I read through it, and holy hell I'm excited. I feel like the biggest dork in the world, but the thought of shaving with some 100-year-old double edge razor (with a new blade, of course) sounds awesome. That plus the whole pomp and circumstance surrounding the process has me psyched to try it. To e-bay!

Oh, plus it's good for the environment. Or something. Whatever. Kaci appreciates that part of it, at least.

Pictures, etc. when I get my hands on a set!

A Promise…

January 30th, 2008

...from me to you. The plural you.

I solemnly swear that I will design a sweet-ass theme for this blog. When I have the time. Perhaps between this quarter and next. I have a good idea or two, I believe. I picked the minimalistest theme I could find that didn't look terrible in the interim, I hope you'll forgive me.

Why?

January 30th, 2008

Why is this blog here?

Cause I've put off having a blog forever, and it's about time I start having a "web presence", as you crazy kids call it.What can you expect to find here? I find that I have a lot of thoughts that I want to hang on to, but I never write them down. I'm hoping this will encourage me to encapsulate those very thoughts on the most permanent of media, The Internet. More than that, though, I suspect this will end up being a repository for all the experiences I have in my journey through the bowels of New Media. It'll help me remember all of the tricks I learn along the way, and hopefully it will help others in their New Media-related quests.

So! I hope you bookmark this, or del.icio.us it, or Twitter it, or Pownce it, or whatever you do that will keep you coming back to read my brain leavings. And I'm gonna do my best to keep up with this.Feel free to e-mail and yell at me if I'm falling behind.