27th August 2008

No Flash? Sorry, that’s not the REAL Internet.

At least that’s what the UK’s Advertising Standards Agency says. They pulled an iPhone ad because it claimed to give you “all parts of the Internet”. But the omission of Flash and Java was enough for the agency to call BS on that claim.

Read here:

http://www.engadget.com/2008/08/27/uks-advertising-standards-authority-yanks-iphone-ad-for-being-m/

And I’m not Adobe, but yeah, I’m feeling pretty smug. :)

posted in Flash | 5 Comments

24th August 2008

Big Ass Bitmaps in Flash 10

I remember reading, I think possibly on Tinic’s blog, a while back that BitmapData maximum sizes would be increasing. Then I heard Jim Corbett mention it at FiTC this year, along with some details. I know I could probably find the specs in writing somewhere, but I decided to test it out myself. And then blog it so I’ll know where to find it in the future.

It’s a bit more complex than Flash 8/9 constraints, which is simply a maximum size of 2,880 x 2,880, for a total pixel count of 8,294,400. We get more than twice the number of pixels to play with, but we also get some more freedom in how to use them.

So, the maximum pixel count is now 16,777,215. You might recognize that as the decimal equivalent of 0xFFFFFF. So, if you are looking for a square bitmap, the largest one you can make is 4,095 x 4,095, which results in 16,769,025 pixels. If you try to go to 4,096 x 4,096, you wind up with 16,775,216 pixels and an invalid bitmap FAIL. So not bad, that’s an extra 1,200-something pixels in each dimension.

But it’s actually better than that. Like I said, there’s more flexibility. You can actually go up to 8,191 pixels in either width OR height, as long as the total number of pixels stays under the limit. This means that you can have a bitmap up to 8,191 x 2,048 (or 2,048 x 8,191), which amounts to 16,775,168 pixels.

Now, that’s a bit much to try to visualize, so here’s a graphic to help you along:

This shows the maximum Flash 8/9 bitmap size, along with the maximum square and rectangular sized bitmaps in Flash 10. Cheers! Now get out there and crash some browsers!

posted in Flash | 9 Comments

23rd August 2008

New Flash 10 Class: SavingBitmap

I've been creating a lot of AS3 generated graphics over at Art From Code and have faced the problem of how to get the generated bitmaps (or vectors) out to files. For a lot of the files, they are quick experiments and I do a quick screenshot with Jing. For others, I've created AIR apps that let you save out files to the file system. But it dawned on me the other day, that in Flash 10, the FileReference class has a save method.

By following the instructions here, I got Flex builder set up to compile Flash 10 movies. By including the framework swc in my project I get access to the JPEGEncoder and PNGEncoder classes. These take a BitmapData and return a ByteArray. You can then pass that ByteArray to FileReference.save() to save the encoded JPG / PNG to local disk, even from a plain old SWF.

I figure I'll be using this functionality a lot to save BitmapDatas, so I created a new class called SavingBitmap which allows you to save the with a single method call. Here's the class:

Actionscript:
  1. package com.bit101
  2. {
  3.     import flash.display.Bitmap;
  4.     import flash.display.BitmapData;
  5.     import flash.net.FileReference;
  6.     import flash.utils.ByteArray;
  7.    
  8.     import mx.graphics.codec.IImageEncoder;
  9.     import mx.graphics.codec.JPEGEncoder;
  10.     import mx.graphics.codec.PNGEncoder;
  11.  
  12.     public class SavingBitmap extends Bitmap
  13.     {
  14.         private var _fileRef:FileReference;
  15.         private var _encoder:IImageEncoder;
  16.         private var _jpegQuality:Number = 80;
  17.         private var _encoderType:String = JPEG;
  18.        
  19.         public static const JPEG:String = "jpeg";
  20.         public static const PNG:String = "png";
  21.        
  22.        
  23.         public function SavingBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false)
  24.         {
  25.             super(bitmapData, pixelSnapping, smoothing);
  26.             _fileRef = new FileReference();
  27.             _encoder = new JPEGEncoder(_jpegQuality);
  28.         }
  29.        
  30.         public function set jpegQuality(value:Number):void
  31.         {
  32.             _jpegQuality = value;
  33.             if(_encoder is JPEGEncoder)
  34.             {
  35.                 _encoder = new JPEGEncoder(_jpegQuality);
  36.             }
  37.         }
  38.         public function get jpegQuality():Number
  39.         {
  40.             return _jpegQuality;
  41.         }
  42.        
  43.         public function set encoderType(value:String):void
  44.         {
  45.             _encoderType = value;
  46.             if(_encoderType == JPEG)
  47.             {
  48.                 _encoder = new JPEGEncoder(_jpegQuality);
  49.             }
  50.             else
  51.             {
  52.                 _encoder = new PNGEncoder();
  53.             }
  54.         }
  55.         public function get encoderType():String
  56.         {
  57.             return _encoderType;
  58.         }
  59.        
  60.         public function save(defaultFileName:String = null):void
  61.         {
  62.             var ba:ByteArray = _encoder.encode(bitmapData);
  63.             _fileRef.save(ba, defaultFileName);
  64.             ba.clear();
  65.         }
  66.     }
  67. }

As you can see, the class extends Bitmap, so you can use it just like any other Bitmap. You create a usual BitmapData and instead of wrapping it in a Bitmap, you wrap it in a SavingBitmap. When you are ready to save it, you just call the SavingBitmap's save() method. This encodes the BitmapData to either a PNG or JPG and sends it to the FileReference.save method. A dialog will open up for the user to select a place to save the file and it will be saved. There are other methods to choose what encoder to use and the JPG quality.

Here's an example of it in use. A really rough example, but it shows that it works. In case you weren't following along, Flash 10 player is required:

Draw on the white canvas then click save to save it. Open the saved file to see that it is what you drew. Here's the code that went into making that:

Actionscript:
  1. package
  2. {
  3.     import com.bit101.SavingBitmap;
  4.    
  5.     import flash.display.BitmapData;
  6.     import flash.display.Sprite;
  7.     import flash.display.StageAlign;
  8.     import flash.display.StageScaleMode;
  9.     import flash.events.Event;
  10.     import flash.events.MouseEvent;
  11.     import flash.text.TextField;
  12.     import flash.text.TextFieldAutoSize;
  13.  
  14.     public class Saving2 extends Sprite
  15.     {
  16.         private var _bmp:SavingBitmap;
  17.         private var _color:uint;
  18.         private var _bmpd:BitmapData;
  19.        
  20.         public function Saving2()
  21.         {
  22.             stage.align = StageAlign.TOP_LEFT;
  23.             stage.scaleMode = StageScaleMode.NO_SCALE;
  24.            
  25.             _bmpd = new BitmapData(600, 600, false, 0xffffff);
  26.             _bmp = new SavingBitmap(_bmpd);
  27.             _bmp.x = 10;
  28.             _bmp.y = 10;
  29.             addChild(_bmp);
  30.            
  31.             stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
  32.            
  33.             var saveBtn:TextField = new TextField();
  34.             saveBtn.text = "Save";
  35.             saveBtn.selectable = false;
  36.             saveBtn.background = true;
  37.             saveBtn.border = true;
  38.             saveBtn.autoSize = TextFieldAutoSize.LEFT;
  39.             saveBtn.height = saveBtn.textHeight;
  40.             addChild(saveBtn);
  41.             saveBtn.x = 280;
  42.             saveBtn.y = 620;
  43.             saveBtn.addEventListener(MouseEvent.CLICK, onClick);
  44.         }
  45.        
  46.         private function onClick(event:MouseEvent):void
  47.         {
  48.             _bmp.save("drawing.jpg");
  49.         }
  50.        
  51.         private function onMouseDown(event:MouseEvent):void
  52.         {
  53.             _color = Math.random() * 0xffffff;
  54.             addEventListener(Event.ENTER_FRAME, onEnterFrame);
  55.             stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
  56.         }
  57.        
  58.         private function onEnterFrame(event:Event):void
  59.         {
  60.             for(var i:int = 0; i <100; i++)
  61.             {
  62.                 _bmpd.setPixel(_bmp.mouseX + Math.random() * 50 - 25, _bmp.mouseY + Math.random() * 50 - 25, _color);
  63.             }
  64.         }
  65.        
  66.         private function onMouseUp(event:MouseEvent):void
  67.         {
  68.             removeEventListener(Event.ENTER_FRAME, onEnterFrame);
  69.             stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
  70.         }
  71.     }
  72. }

The whole saving functionality is encapsulated in this one method that gets called when you click the save button:

Actionscript:
  1. private function onClick(event:MouseEvent):void
  2. {
  3.     _bmp.save("drawing.jpg");
  4. }

Pretty damn easy. One caveat is that the saving MUST happen on a button click / mouse event. Otherwise you'll get a security error.

Another caveat is that the Flash 10 compiling in Flex Builder is pretty rough still. It isn't the easiest thing to get set up, and as of this writing, a LOT of the code hinting is missing. Specifically, you won't get code hinting for BitmapData and you'll have to add the import statement manually. This happens for some other stuff as well. This had me convinced that it wasn't working at all, but once you add the imports and write the code, FB recognizes it as correct and it compiles just fine.

One final caveat is that once you call save, there is a lag while the encoding happens. You might want to try to sneak in some kind of user message there, that the encoding is happening. This might be a bit rough though because anything you try to display won't show up until the method completes. And if you try to delay the encoding, then the FileReference.save method won't be being called directly from the mouse click and will fail... So, you might want to amend the class to separate the encoding and the saving. But the above is all I need for my own purposes of personal use. Thought I'd share it.

posted in ActionScript, Flash | 18 Comments

23rd August 2008

FlashForward Photos Posted

I really didn't pull out my camera til the last day, but put up most of what I took that day:

Check em out.

Here's Stacey doing her groupie dance:

And here's a panorama of what it's like to be up there on stage.

FF08panorama
Click to view full size.

posted in Conferences, Flash | 2 Comments

23rd August 2008

FlashForward 2008 Retrospective

In addition to the play-by-play, I wanted to give an overall response to the conference.

Personally, I enjoyed the hell out of it. I applaud Beau and crew for taking a big risk on changing up the format. It really worked for me. There was no decisions about which presentation to see or problems with having two things I wanted to see at the same time. Even though there were a few presentations that didn't do much for me, it was painless enough to sit through them for 20 minutes. But most of the talks were really, really entertaining, enlightening, and inspiring to me. I really feel like I came away with some new viewpoints and ideas.

But I completely accept that this is just my personal viewpoint. I know that many others did not like the single track format. This from comments I heard and blog posts I've seen.

I can totally understand the viewpoint. People pay damn good money to go to a conference (don't let me get started on conference pricing again), and many of the talks could be considered fluff without any hard content. People (or companies that send people) want to see code, new techniques, tutorials, etc. There were a few breakout sessions each day, which were longer and more in depth, but overall, for the main sessions, there is just no way to "teach" anything in 20 minutes.

Personally, I don't miss the longer sessions. There were a few sessions, such as Robert Hodgin, or David Carson, which I would have loved to see go a lot longer - but not so that they could teach more, but so they could inspire more. I think it's still pretty tough to teach a whole lot even in a full hour. The most you can do is introduce a subject and get someone interested in a subject enough that they are compelled to go out and find out more on their own. It doesn't always take a full hour to do that. Then again, it can be hard to do that in just 20 minutes.

It does seem like Beau and crew are aware that what they did is an experiment and are very interested in getting feedback and evolving into something that is valuable to the community. So if you were there and didn't like the format, communicate it.

posted in Conferences, Flash | 3 Comments

23rd August 2008

FlashForward Day 2 and 3

Carrying over from the last post, Thursday wrapped up with Lynda Weinman and Erik Natzke. Lynda talked about her views on education. A bit of a dry presentation - page after page of bullet points, few if any images and Lynda mostly just reading the points and elaborating a bit. But maybe I'm just bitter bacause after winning a rubber arrow, being a judge for a few FlashForward Film Festivals, and speaking at 4-5 of her conferences, when I met her just before she spoke, she was like, "Hi, have we met?" and showed no sign of recognition at all after I introduced myself - just like every other time I've met her. But whatever.

Erik Natzke wowed the crowd as usual. :)

Later in the evening was the Film Festival. That was fine. People seemed to be happy that it moved along quickly, as those things can be rough if dragged out. After grabbing some dinner I headed over to Ruby Skye for the official party of the night. Maybe it's just because I'm becoming an old fogey, but those parties just don't do anything for me these days. Music so loud you can't hear a damn thing anyone says, and about three brave souls out on the dance floor. I left after a short while and tried to look for any other groups of people who might be heading to another bar or restaurant or whatever to just hang out and have some good conversation. But I failed in that and wound up going back to my room, trying to do some work and just falling asleep.

The speaker schedule got a bit mixed up for some reason on Friday, so I forget exactly who spoke when, but there were just a whole bunch of really great presentations. Hoss Gifford, Branden Hall, Luke Bayes, Paul Ortchanian, Stacey (my groupie) Mulcahey, and Scott McCloud were all very entertaining as well as very inspiring. I honestly enjoyed the hell out of all of their talks.

Ivan Todorov went quite a bit over his alotted 20 minutes, and there was an awkward moment where Beau stood up and told him he was done. Ivan said he had two more minutes to wrap up and Beau somewhat heavy-handedly gave him 30 seconds more. That was probably the low point of the conference.

Karen Kimsey-House is a personal life coach of some kind and gave a talk about reeeeeaaaaallly listening to each other, with our hearts, not our ears. Probably way too touchy-feely for this crowd. And she kept talking about her "anacronym" (I wanted to scream out "It's ACRONYM!!!") AIR : Authenticity - Intimacy - Respondability. I don't think she had any idea that AIR stood for something else with us, so there was a bit of Disconnectability. There seemed to be some women in the audience who really responded to it, but most of the guys were rolling their eyes and trying not to laugh. Sorry, I'm kind of harsh, but that's the way it was.

David Carson also spoke on Friday. I was like, yeah, sure, famous typographer/designer dude, whatever, yawn, probably all stuck up and arrogant. But this was one of my favorite sessions of the conference. I was laughing hysterically at some of his stories, and even he had to control himself, laughing at his own stories a few times. After the conference I saw him hanging out outside and had a nice conversation with him. Seems like he really enjoyed the conference himself, attending quite a few presentations, and although not understanding much of what was going on in terms of Flash, really enjoying the vibe of the whole thing. I've noticed that for the most part, famous speakers like that, particularly those not directly in the Flash field, tend to show up, give their talk, and disappear. The fact that he hung out for the entire conference was pretty cool. When I got home today, I looked for his book, The End of Print, in a couple book stores, but it's out of print, so I ordered it from Amazon.

At the end of the day was the speaker slam, where anyone who wanted could get up and talk for two minutes about whatever they wanted to the whole audience. The undisputed mega-hit of this section was Matt Maxwell, the ActionScript song dude I blogged about the other week. He talked for a minute then sang one of his songs acappella for a minute. The audience ate it up and demanded an encore, which he did with the accompaniement of his iPhone held up to the mic.

And that was it for the conference. I wound up going out to eat with a bunch of old and new friends and then back to the Fairmont for a few drinks. It was the best evening of the whole time, but I had to cut it short to get to the airport for my flight home.

I'll probably do another post on my overall reactions to the conference, and how others seem to have taken it as well.

posted in Conferences, Flash | 2 Comments

21st August 2008

FlashForward Day 1 and 2

So, FlashForward opened yesterday morning with the Cultural Ambassador from Slovenia, Miha Pogacnik, as the keynote speaker. Unfortunately, I was back stage with Grant Skinner, waiting to go on stage, so I didn't get to see him.

After Miha, I was first up. The stage is really huge and probably the biggest screen I've ever seen, other than MAX at Chicago last year. Attendance was about 800. I have gotten pretty good about speaking, but I have to admit, I was a bit intimidated at the crowd size, the 20 minute format, and the fact that I was first up. But all went pretty well. After I got into the speech, the audience was responding very well, so I got into a good groove and finished just about in 20 minutes.


In the back corner of the stage was a large leather sofa set up, where all the speakers for a particular slot sat with Beau. After each speaker finished, they would go back there and have a talk show like conversation for a few minutes.

After lunch Chuck Freedman and Phillip Kerman were up. We got to see Phillip sing hardcore punk rock live on stage, which may be the high point of the conference. And then after a break, Robert Hodgin (always incredible), Craig Swann and Jared Ficklin presented.

After the conference I was invited with a bunch of others to an "Industry Leaders" dinner which sounded good but turned out to be a bit weird. First of all, it was held at the Supper Club, which seems to be a sort of fetish club. The place is filled with beds and pillows and small tables on the beds. Food was served by scantily clad young men with lots of mascara and possible gender confusion issues. Then we were separated into groups and fed a series of questions designed to encourage conversation, such as "What do you have to do personally to drive this industry forward?", "What does it mean to be a leader?", "How would you define this industry both now and in the future?" We were given15 minutes to discuss and then had to present an answer. Getting together a bunch of creative people, giving them free drinks and food, and then forcing them into specific conversations only invites rebellion, and it devolved into chaos pretty quickly. Oh well, nice try.

Oh, here's me at the club drinking a flaming shot of something:

Rob Bateman of Away3D picked up his shot too quickly and his hand became engulfed in flames. Thinking quickly, he switched the drink to his other hand, setting it on fire as well. He's fine, but he'll have blisters on his fingers.

We're now about 2/3 through day 2. A bit more corporate this morning, with the Adobe keynote, Disney and IDEO presenting. But after lunch Tinic Uro spoke, showing his Visual Studio setup, and some of the actual source code of the Flash Player, fixing a live bug and compiling the player right on stage! Then Todd Rozenberg gave a hilarious session on his cartooning history. Next up, Erik Natzke and Lynda Weinman.

posted in Conferences | 9 Comments

19th August 2008

I’m at FlashForward

Arrived in San Francisco around 1pm. Just before we landed I was looking over some conference logistics stuff I'd printed out, and the guy sitting beside me asked if I was going to FlashForward. Turns out he was too. So we shared a cab back to the Fairmont. Got checked in and took another cab over to the Adobe where I did a video interview about Flash 10. I guess it will be on a page on Adobe.com at some point in the future. While I was there, I bumped into Mark Anders and spoke to him for a bit. He helped me track down Ted Patrick. Had a nice visit with Ted, bumped into Branden Hall on the way out, then went back to the Fairmont.

Went over to the Masonic Center to check out the venue. Bumped into my old friend Jared Ficklin on the way over there. Too early for much to be happening there yet, but saw the venue and said hi to Beau. Now just getting set to go to the speaker dinner.

posted in Conferences, Flash | 0 Comments

18th August 2008

Profiled in Create Digital Motion

I've been subscribing to CDM for several weeks now. Lots of awesome visual stuff to be inspired by there. Got a nice surprise today when they ran an article at least partially on me.

Stuff like this just makes my head get all swollen. :)

posted in ActionScript, Flash | 3 Comments

18th August 2008

More on Flash 10 Security

Lee Brimelow has just posted some more information in regards to the issues WordPress, Flickr, SWFUpload have with the Flash 10 Beta. Unfortunately, it doesn't look like the behavior is going to change, but I do understand a bit more on why this was put in place.

Read Lee's response here.

Another encouraging thing is that Lee mentions Adobe will be reaching out to Flickr, WordPress, et al, to help them come up with solutions. If you know any other sites / companies, applications that are running into this problem, let Lee know so that Adobe can work with them as well.

One thing I love about Adobe is that they DO listen. You just have to make some noise. :)

posted in ActionScript, Flash | 1 Comment

Who is reading BIT-101?
web stats