Thursday, October 19, 2006

vCam HUD

How to make a HUD (head-up display) with the vCam.

The vCam is a fantastic time saver, but many people have asked how they can add visible elements within the camera, such as playback controls, a watermark or subtitles. As the vCam moves from one part of the screen to another, your subtitles might be left behind as if they're part of the background. The immediately obvious solution is to tween the subtitles at the exact same speed and distance as the camera. But there's an easier way.

If you haven't already got the vCam, download it now from Sham's original article on the O'Reilly website:
Actionscript for non-coders - A Virtual Camera

OK, suppose you have a scene in which two aliens are discussing which is the best way to destroy the planet below. The vCam moves from one to the other as they engage in a heated discussion. Pretty simple scene if the dialogue is in English, but if it's an alien language we might wanna add subtitles. Here's how (instructions given for Flash 8):

  • Open waterfall02.FLA, the file you downloaded (above) and you'll see the following image:


  • Open the waterfall02 Library (press F11) and you'll see the vCam. It's a movieclip called camFrame.
  • Double click this movieclip and you'll go into Symbol Edit mode, where you can view the guts of the vCam.
  • First of all, you'll notice the camera has some simple graphics: a border, centre point, a faded white area and a little colour icon. These graphics don't show up when you compile your .swf. Why?
  • You'll also notice in the timeline that there's some actionscript on the top layer. Select that frame now and press F9 to open the actions panel.
  • Go down to line 19 of the actions and you'll see the following code:
    this._visible = false;
    This line of code makes the graphics within the vCam invisible.
  • Change the code so it reads:
    this._visible = true;
Now if you test the movie (Ctrl + Enter) you'll see all the graphics of the vCam showing up and moving with the camera.

So this means that in order to add subtitles, watermark, or playback controls that move with the camera automatically, you just need to do replace the default camera graphics.

As you can see in the image below, I've removed all the graphics except the border, and I've added a line of dialogue. I've also adjusted the actionscript inside the camera so that visible=true.




Now when I test the movie, this subtitle moves along with the camera because it's part of the camera.

You will need a separate camera symbol in the library for each subtitle you want.. so right-click the camera movieclip in the Library and choose Duplicate. You can create as many cameras as you like, and rather than manually aligning one to the the other, you can make use of the 'Swap Symbol' function in the Property Inspector.

Here's the FLA for the above example (Flash 8 only, sorry).

btw, please drop your thanks for the vCam to Sham on his blog.

10 Comments:

DimonM said...

This vCam rocks! This is the 1 time I saw it, but i tested it, and when i was exporting to AVI it didnt effect the scene, i just saw the scene and the vCam moving around...(((... I found a program that exports SWF to AVI but it doesnt export any sound... do you know where i can downlod the gewd program plz :)

4:33 AM  
alex said...

phillip,

you are amazing.
thx for sharing. :)

your fan,
alex

6:28 AM  
huan said...

Adam, i follow your work since the firt yuyu`s movie. and have no words to demonstrate my admiration.
and i`ve also tryed that 1 day 1 flash, but end up beeing 2 days 1 flash, and y did it for just 3 weeks more or less.

www.joulimousis.com.ar

u are an inspiration mate.

juan

8:32 AM  
chluaid said...

cool site you got there huan :)

thanks for the comments guys.. glad you find this stuff useful!

4:34 PM  
Anonymous said...

Hi!

The Vcams properties dont seem to work when you export as an AVI.

Neither does it seem to work when you import a *fla into a new Flash document.

Am I missing anything?

Thanks

4:22 PM  
chluaid said...

yes you are. Check the next article here.

Currently the best solution for rendering actionscript such as the vCam, particle effects, scripted tweens, etc. to *AVI is a program called SWF2Video.

4:35 PM  
Anonymous said...

Thanks!

I found it!

Thanks much!

I am new to Flash but not to art/creativity......Where should I go to share my movies with the Flash community?

Thanks again.

5:59 PM  
Anonymous said...

Thanks a lot for sharing this!!

You are awesome!!

your fan, GTAlord

1:43 PM  
Patrick said...

You are amazing, a true inspiration to flash users everywhere, and your advice on this blog has been SO useful, especially since I just started using flash about 4 weeks ago. Thanks for your advice with the v-cam subtitles, useful.

1:46 PM  
Anonymous said...

"I am new to Flash but not to art/creativity......Where should I go to share my movies with the Flash community?"
You can go to www.Newgrounds.com

Also, Can we show subtitles in a v-cam without having a new symbol for each subtitle? Is there any way to have a subtitle separate from the v-cam, but have it follow the v-cam? (I mean is there code that can make one symbol/non-symbol follow my v-cam without actually being part of my v-cam?)

3:02 AM  

Post a Comment

Links to this post:

Create a Link

<< Home