Fun with green screen and Flash

| | Comments (0)
Over the past couple of months, I've been working on a project called CHANCE (Connecting Humans and Nature through Conservation Experiences), which is a site that that addresses the need to train Pennsylvania 9th - 12th grade teachers in environmental science and ecology. ETS has agreed to help out on this project due to the loss of the project's Flash developer who graduated and moved on. The modules we are working on have to do with global warming, and in one of the activities the project lead, Jackie McLaughlin, wanted to have Dr. Richard Alley speak about what he does in taking ice core samples in Greenland. To make it more interesting, we thought we would put Dr. Alley on site with the help of a green screen (or a green painted wall in our case). So we had him come in with a coat and goggles with the intention of putting him on a snowmobile to take the students out to the research site in Greenland. I had Kim Winck act as my videographer and Justin Miller was also helpful with lighting and camera settings. I had Dr. Alley sitting on a chair to give his little spiel. After a quick dry run, I had to have him be somewhat less animated than he normally is, so that his hands wouldn't get cut off from the video boundaries. I also had a tripod in front of him with a black bar on it to simulate the steering handlebars of a snowmobile. He would grab them at the end of his talk and take off on the snowmobile. Here is a couple shots of the greenscreen:


I also took a couple still pix of him sitting on a box to simulate the snowmobile for his "ride" in Flash.


Dr. Alley is a great speaker and was able to nail his little speech on the first try, but we had to redo the end because he forgot to put on his hood and goggles to start his snowmobile ride. With the magic of Adobe After Effects, I was able to create an alpha channel from the green background after which I exported the movie as FLV. I then imported it into Flash as a video to the timeline where I could view it easily. I then placed a snowy image from Greenland behind him and cut out an image of a snowmobile to put in a layer in front of him. I had to cut the windshield out of the snowmobile and create a new symbol for the windshield in Flash, which I then made to look translucent and added a few highlights.

Although this is unfinished, here is how it turned out...
(Click on the image below to view the video - note that it may take some time to load as I don't have a preloader on it yet.)

Actionscript 3.0 Survival Guide

| | Comments (0)
I know it's been a long time since I last posted. I've been busy and haven't felt much like writing. I decided to bite the bullet and only code in Actionscript 3.0 from now on. I've been using Actionscript 3.0 for a few months now and have a few projects under my belt. I'm slowly coming around to seeing the benefits, but it's not been easy. I'm proposing a sort of "survival guide" of code that will help people get through the initial shock of trying to get something done in a new coding environment. Here are a few tips on coding Buttons, Controlling MovieClips, and doing Navigation. So, here goes. Buttons You probably have heard this before, but buttons are no longer coded to do their stuff within the button itself. All code must be in the timeline. Here is the typical way to make a button function now. After giving the button a name (myButton in this case), use this sample code: myButton.addEventListener(MouseEvent.MOUSE_DOWN, doIt); function doIt(evt) { trace("I love Actionscript 3.0"); } What is kind of stupid is that even though I'm not passing anything to the function and should have no need to put anything in the parens after "doIt", it will throw an argument mismatch error if I don't put something in there ("expecting 0 got 1"). So if that happens, just type any old word in there and it'll run. Code purists will flame me, but it works. I think it's actually passing a mouse event, so a lot of people will put (evt:Event) there, but it's really not necessary for it to work. I also see people importing classes unnecessarily like this: import flash.events MouseEvent before they write the button code. The button will work just fine without importing that! Too many people seem to be writing and importing packages to do code that will run without it. There is a time when you want to do that, when you are working on large projects or in groups where you want to control code more, but for most projects it is entirely unnecessary. Also, it is important to note that if a button is not going to be in the timeline until frame 10, don't put the event listener in for it until frame 10. Otherwise it will throw and error if you have the listener in frame 1 and no button for it to refer to. Personally, I don't know why you would need to even write an event listener for a button. This would be an improvement to actionscript if it were understood that a button by its very nature should already have a built-in event listener. Hey, whatever. Suck it up I guess. Let's move on. Controlling Movieclips If I wanted to use myButton to trigger another movieclip (called movie2) also on the main timeline to play, I would write the function like this: function doIt(evt) { movie2.play(); } But, if I have a movieclip (movie2) on stage and it contains a button that triggers the main timeline to play. I would have to write the event listener and function in the actions within that movieclip. Here is how I write the function (using the same button as before): function doIt(evt) { MovieClip(this.parent).play(); } So, from within that movieclip where the button is, I have to come up a level before I can tell the main timeline to play. You have to tell it that the main timeline (this.parent) is a movieclip or the play function will not run, hence the MovieClip() reference. So, to get a little more tricky, let's say I want that button within a movieclip (movie2) to control yet another movieclip (movie3) on the stage. Here is how I'd write the function: function doIt(evt) { MovieClip(this.parent).movie3.stop(); } I think you get the idea. Navigation Let's say I have a series of photos that I want to create navigation for. To make Previous and Next buttons work, after creating and naming the buttons, I wrote the following code in the first frame, which I named "photo1": var nextLabel:String = "photo2"; next.addEventListener(MouseEvent.MOUSE_DOWN,goNext); function goNext(evt) { gotoAndPlay(nextLabel); } stop(); Note there is no Previous button code since I'm only on the first photo. On the first frame of the next photo, I will name the frame "photo2" and in the actions I will have: nextLabel = "photo3"; var prevLabel:String = "photo1"; prev.addEventListener(MouseEvent.MOUSE_DOWN,goPrev); function goPrev(evt:String) { gotoAndPlay(prevLabel); } So, in the first line, I'm updating the nextLabel variable to be "photo3" and introducing a new variable called "prevLabel" that points to "photo1". I then add an event listener for my Previous button which is now on the stage along with a new function called "goPrev" that takes me back to the previous frame label. Now for photo 3, all I need to do is to update the frame labels in the actions, which would look like this: prevLabel = "photo2"; nextLabel = "photo4"; There may be a sexier way to do it, but this works without a lot of hassle dealing with label arrays and such. Okay, that's it for now. Hopefully this will help you through a few sticking points so you can get on with your projects in Actionscript 3.0.

Lawrence Lessig Keynote at the 2008 TLT Symposium

| | Comments (0)
I attended the keynote at the 2008 TLT Symposium and found Professor Lessig's talk very thought-provoking. He showed many examples of remixed video/audio that would probably not pass muster under today's copyright laws. People have been doing this type of thing long before Al Gore invented the Internet, but the Internet just made them more easily accessible by many more people. Although I agree for the most part that these types of remixes should be protected as artistic expression, it made me think about what we really should be teaching our students at Penn State, particularly those who create videos with music at the Digital Commons. We have always played it safe and not allowed students to use copyrighted music in videos they display on the Digital Commons Web site, but I think the big concern is whether or not someone is profiting from the distribution of such works. If they are not profiting from their work, it should be considered creative expression and allowed to be featured. Prof. Lessig cited an example of a housewife who put a video of her 2 year old dancing with a song by Prince playing in the background. She was slapped with a takedown notice by representatives of Prince. While I question her choice in music, she in no way was profiting from Prince's music. If anything, YouTube was profiting from her use of Prince's music. They sell ads and whatever drives people to YouTube to watch videos is okay with them. So, I'm sure they're all for the use of remixes in videos they host. We are not in the ad-selling business, however, so this is not a comparable argument for preventing students from having their work featured on the Penn State sites. I think Professor Lessig's message warrants more discussion here at Penn State about what our policies should be regarding copyright and creative expression.

Making accessible movies a bit more painless

| | Comments (0)
I attended a presentation by Bill Welch, Director of the Office of Disability Services here at Penn State, and he gave us some insight as to what his department does for students. It was very informative for me, as I really had no clue what all they did there. It also gave me a chance to show him something I've been working on on my own since last summer when we got a request from his office to make the LARCH 060 course accessible. We had transcripts, but they had to be listened to and massaged a bit so they matched what was actually recorded. Dave Stong captured the Flash animations as QT movies and we had Auto Synch Technologies create the text tracks that Dave then imported into the movies. I thought that it would be great if there were an easier way for us to do this in the future, so I started working on a little app to help with creating captioned movies. It came in handy with our Blended Learning course PHIL 12, where Dean Blackstock had to create text tracks for movies that were being delivered via Flash video. I was able to get the app to not only make QT text tracks, but also Flash XML text tracks for use with Flash CS3 video, which includes a new caption display component. So, the process for PHIL 12 worked something like this. Dean would use Dragon Naturally Speaking to get the bulk of the pre-recorded video content to text. He'd then listen to it and straighten out any errant words. These transcripts were just saved as text files. He could then import that text into the app and it would separate the text into separate captions. Then it was a matter of loading the movie and clicking a button as each caption is spoken. At the end of the movie you just click a button to create the Flash XML caption file. It can also create embedded QT caption tracks as well as several other formats. When I get the app a bit more complete I'll try to set up some kind of demo and perhaps get it on the lab machines for general PSU use. The app is Mac only, however, it will allow you to create SAMI text captions for Windows Media if you have the Flip4Mac plug-in on your Mac. Perhaps we can streamline the process for ODS to get accessible media to students.

Creating Accessible Movies for iPods

| | Comments (0)
A shortfall of the video iPod is that while it does support TV-type closed captions, it does not support text tracks for captioning, so the average Joe can't do it. And, if you do know how to embed a text track of captions into your QT movie, it will get stripped out when it goes to the iPod as well. I did find a workaround, however, if you need to display open captions on your iPod videos. The trick is to combine the video track with the caption track. After importing your caption text into the QT movie, all you need to do is to export your movie as MPEG-4. This will create a .mp4 file that will have a combined video and text track which works fine on video iPods.

International Meeting on Simulations in Healthcare - San Diego, CA

| | Comments (0)
I'm just now finding time to blog about this trip. In case you didn't know, I was asked by Dr. Leonard Pott of the Hershey Medical Center to co-present at this conference on a Flash-based simulation I created for him this fall. San Diego was just a beautiful place to be, especially in the winter. When we took off from UP airport on Monday, they had to de-ice the wings. It was about an hour and a half to Atlanta where I caught my flight to San Diego. San Diego was quite a climate difference from State College. It was a balmy 74° there that afternoon. The hotel was right on the ocean and only a couple miles or so from the airport. My plane was a bit late when I got to San Diego and my room was not ready, so I didn't get to see a whole lot of the conference that day. I did take a quick look around through the vendor exhibits, however, and I was quite amazed at what I saw there. More on this in a bit. I met with Dr. Pott and our other co-presenter, Dr. Arne Budde and we discussed our strategy for our presentation the next day. 

The presentation went really well. Dr. Budde and Dr. Pott showed some examples of different types of simulations, which were more complex than the one we developed, however, what we developed is much more attainable by more people. After they showed examples of different computer-based simulations, and Dr. Pott led them in an exercise in creating a decision tree on index cards, it was my turn to show the proof of concept I'd developed for Dr. Pott and speak about the multimedia developer's perspective. The idea was that people would have a better understanding of what it takes to develop such a Flash-based simulation and what they will need to know and do to approach a developer to create a simulation. I showed them how I took Dr. Pott's decision tree and translated it into a FileMaker Pro database, exported an XML file from FileMaker, and imported it into Flash where it ran the simulation. There were very close to 50 attendees at our workshop, and the feedback we received during and after the workshop was quite positive. I had many questions from attendees, and had to cut them a bit short to end our workshop on time.

After the workshop (and lunch), I spent the rest of the afternoon exploring the vendor exhibits, since the presentations that were left that day were not of value to me. The exhibits were pretty amazing. One of the most memorable was from Forterra (http://www.forterrainc.com/), who creates a virtual world very much like Second Life as a virtual training ground for many different types of disciplines. The salesman was demonstrating a simulation that had a scale replica of Baghdad, where military personnel can go in and train together. He said that he was involved with simulations in the first gulf war. They practiced the whole plan for the first day many times before the first shots were ever fired. This involved taking out Iraqi radar and early warning systems and placing forward observers behind enemy lines to coordinate the attack. Attack helicopters paved the way for armored vehicles that cut through the enemy installations. I can just imagine the distinct advantage we had by practicing such a large scale attack before it took place. Other types of training they would do was for first responders to a terrorist dirty bomb attack in a major U.S. city (can't remember which one) where they again had a scale model of the city to walk around in and even the university hospital where the injured were taken was recreated in incredible detail. You could actually read all the signs on the walls. There were police, firemen, haz-mat teams, and FBI-types all training together on the simulated emergency from the scene of the incident to the surgery rooms where the injured were transported. This was quite an amazing piece of work!

Most of the other simulations either dealt with teaching haptic motor skills (where you control instruments while looking at a computer monitor much like surgeons do - videoendoscopic surgery). Some taught you skills such as using the controls to sew stitches (pretty difficult), controlling a camera and laser to zap tumors, or just generally getting the feel of moving things with the controls. I found these activities very difficult to do in my initial attempts and I figure it must take many hours on the simulators to get the feel of it. 

Most of the other displays dealt with simulated body parts and mock patients, many of which were hooked to computers to provide patient feedback or to control the patient's reactions. There were infant models, genitals to practice urology/gynecology procedures, a life-sized birthing model, and even models that had severe trauma, such as severed legs. Something for everyone, I guess. It was both morbid, in a way, and fascinating to see all of that in one big room.

After the vendor room closed, I took a couple hours to walk along the oceanfront. No beach, but a paved walkway. I took lots of pix with my phone's camera. http://flickr.com/photos/besong On Wednesday I had to catch a 9:00 AM flight to Atlanta, so I couldn't attend the closing sessions. They really didn't seem applicable to what I do anyway. Too bad I didn't stay another day in San Diego, however. We flew into Atlanta where they were having an unusual snow/ice storm. When I boarded my plane for State College at 5:00 PM, they announced that they were backed up with de-icing planes and it would take us an hour to leave. There we sat for the next hour or so in the plane. Finally we were given clearance to taxi to the runway to get in line for de-icing. Again, there we sat for the next 3 hours on the tarmac until the pilot said that they were giving international flights priority for de-icing and that they only had one set of equipment (for the "busiest airport in the world") to de-ice. He said they were doing 4 planes per hour and that there were 12 planes ahead of us. That would put our departure time at about midnight, but due to FAA regulations, the pilot would have had to have the plane in State College parked by 11:20 or it was a no-go. Besides that, we had used up most of our gas idling on the tarmac. The flight was canceled and we didn't get to deplane until about 9:50, almost 5 hours after we boarded. After some confusion I was able to get confirmed on the next flight out (5:20 the next day). Luckily I have a brother that lives about 30 miles or so from the Atlanta airport and I stayed with him that night. So, it worked out for the best I guess. I got to visit with my brother and his family before heading back the next day. I sure was glad to land in State College. Amazingly my luggage was there, too. I thought of the palm trees and 74° weather as I scraped about 3" of snow off my car in the airport parking lot. 

SlingBox - this is pretty neat

| | Comments (0)

I happened across this product today that I thought might have some value to higher ed. It's called a SlingBox. What it allows you to do is to watch what comes over your TV connection from any internet connection in the world. The box is plugged into your internet router at home, then into your TV signal receiver. It can then broadcast TV over the internet. I'm not sure exactly how it works, but it basically creates a video stream of pretty good quality that you can watch from any computer that has the SlingBox player s/w installed. It works on both Mac and PC and will even work on cell phones and palm devices. Here is the link:
http://www.slingmedia.com/
(Watch the videos on the site. I like the one with the mime.)
It's fairly cheap, too, starting at $129, $179, and $229 for the Pro model, which has the capability to be able to control the channel like a virtual remote), and send out HD video even over a DSL connection. Customer reviews are for the most part very favorable.

I was wondering whether something like this could be set up in a classroom to send video content to a computer set up elsewhere to receive and record the signal and prepare it for further distribution. Might be an interesting addition to Apple's Podcast Producer, or what TNS has been looking for to record Polycom conferences.

Actionscript 3.0 - First Impression

| | Comments (0)

Honestly, my first impression was - WTF? Actionscript 3.0 is quite a departure from 2.0. There are quite a few differences that will change the way you develop in Flash. I thought a good way to learn 3.0 was to take the simulation I did and recode it to meet 3.0 specs. I figured if I was going to give this away in San Diego, I might as well try to be current and give it a little longer shelf life. This was no easy task as I was to find out.

One big change in 3.0 is that there is no code permitted in buttons. All the code for controlling buttons is written into the actions layer of the timeline. Although it's quite a different way of working and requires more code, the one good thing I can say about this rule is that you don't have to keep opening buttons to see what the code is and where to change it. It's all there in the timeline. The bad part also is that ... it's all there in the timeline. At least opening the button you know what code goes with the button.

Another thing is that buttons don't automatically understand that they need to do something when they're clicked on. You have to tell Flash to listen specifically for when a button is clicked. In AS 2.0, I could click open the Actions panel for a Submit button and type in:

on (release) { play(); }

In AS 3.0 I have to open the Actions panel for a frame in the timeline and first create an event listener object like this:

submitBtn_mc.addEventListener(MouseEvent.CLICK, submitAnswer);

Then I need to write a function that will be carried out when it's clicked on:

function submitAnswer(event:MouseEvent):void
{
play();
}

In my simulation, however, it wasn't as simple as making the timeline play. I needed it to check which radio button was selected, update the counter, and then play so it would have to reload the data in the Flash movie. So here's what my Submit button does when you click on it:

submitBtn_mc.addEventListener(MouseEvent.CLICK, submitAnswer);

function submitAnswer(event:MouseEvent):void
{
photo.removeChildAt(0);

if (button1.selected == true) {
counter = destination1;
play();
} else if (button2.selected == true) {
counter = destination2;
play();
} else if (button1.selected == false && button2.visible == false) {
counter = destination1;
play();
}
}

Note the phrase in the above code that says:

photo.removeChildAt(0);

I had to add this because if I didn't, when I loaded a JPEG image into Flash, it would always stay there and not get replaced when a new one is put there to replace it. The new one would just go on top of it on another level. The code says to remove the child of "photo" (the name of my movieclip that I add the jpeg to) that resides at level 0. This would not have been necessary in AS 2.0, however, it looks like there may be more options if you can load more than one image into a movieclip on different levels.

Another whacky thing that really gave me a WTF Moment was that I could not easily change the font size and color of the text next to my radio buttons. The components in AS 3.0 are different than AS 2.0. I can no longer just change a few parameters for my component in the Component Inspector. To change the size, font, and color, I have to write some special code like this:

var tf:TextFormat = new TextFormat();
tf.color = 0xFFFFFF;
tf.font = "Arial";
tf.size = 14;
button1.setStyle("textFormat",tf);
button2.setStyle("textFormat",button1.getStyle("textFormat"));

That's real intuitive, is it not?

And here is the code I had to use to load the jpeg into a movieclip:

var request:URLRequest = new URLRequest(imageArray[counter]);
var loader:Loader = new Loader();
loader.load(request);
photo.addChild(loader);

No more simple loadMovie() commands.

One thing I do like in AS 3.0, however, is that to make a button invisible, you no longer need the underscore in front of "visible". It's just:

submitBtn.visible = false;

I did manage to get the whole simulation working in AS 3.0, but it took me a lot longer than I had ever anticipated. It also took a few bulletin board posts and some nice people to help me figure out WTF I was doing.

"Centre County Marching Band Festival" - Flash site created by my son

| | Comments (0)

My son, Max, a senior at Bald Eagle Area High School, has been learning Flash on his own. For his FBLA (Future Business Leaders of America) project, he wanted to do a website on the Centre County Marching Band Festival of which he participated as a member of the BEA Marching Band (he's the trumpet section leader this year). As promised in my previous blog post, here is the link to his site. I put it up in my personal space temporarily until the high school puts it up on their server.

http://www.personal.psu.edu/pzb4/max/ccmbfsite.swf

He designed and animated the site entirely on his own. I only showed him how to code his link buttons properly and how to import the video clips into Flash. Not bad for a rookie, no?

The kick is down(?) and it's....good!

| | Comments (0)

My two sons (age 15 and 11) were playing Madden football. One was kicking a field goal, the other was playing defense. They were pretty amazed at this play, so they captured the replay. The center hikes the ball and it hits the defender's leg as he attempts to block the kick. The defender falls on the ball, but if you look closely at the referee, he signals that the kick is good. The ball actually goes up through the uprights even though the kicker is nowhere near it when he kicks. So, this is either a glitch in the game, or one of the game developers is just a major Jason Elam (the kicker) fan. Watch the video...
http://www.youtube.com/watch?v=sZl38fDmUes&feature=RecentlyWatched&page=1&t=t&f=b

The other neat thing about this is that my kids were able to figure out how to shoot a video using our digital still camera and upload it to YouTube on their own. I was pretty shocked.

My 17 year old is working on a Flash website for FBLA at his high school. It's a website that shows the Centre County Band Festival (he's in the Bald Eagle Area marching band). I'll post a link when he gets it done. I was really amazed at what he can already do with Flash. I showed him a few things, but he figured out the rest. Here is his Chickenzilla video he made in Flash (I've shared it with some of you already):
http://www.youtube.com/watch?v=mNzXX6MpYL8
He worked on it all summer. He had a bunch of his friends over to help him record sound effects. It sounded really weird not knowing what the video was about while they were recording (he used Audacity). I was pretty impressed with what he was able to learn on his own. I'll post the link to the FBLA site soon. He has to have it done by next week, but it already looks pretty good for a rookie.

The children of the digital age I guess. Better add a few more computer workstations to the Digital Commons