AS:Main - For the needy and stupid!Welcome to AS: Video I will show you how to implant a live web cam feed into your flashes and how to apply some awesome effects to it!So lets begin!
1-Webcam feed
This is a great way to add some interactivity to anything, it could be used as pre-loader entertainment or expanded and turned into a full video editing suite.
Firstly open flash (duh!). Then open the library (CTRL + L). Next in the top left of the library there is a button which looks like 3 bullet point sand some lines. Click it.
A menu will pop up. At the top of it there is a button which says ‘New Video’. Click this.
Now in your library a new object will be there, it will be called ‘Embedded Video 1’. Drag this onto your stage and resize it to whatever you size you want. There should be a transparent rectangle with 2 lines in it, now on the stage. And give it the instance name ‘webcam’ (no quotes). This will be where our web cam appears.
Now for some actions. Goto the actions panel of whatever frame your ‘webcam’ is in and paste this code:-
myCam = Camera.get();
webcam.attachVideo(myCam);
webcam.smoothing = true;
Time for some explanation.
myCam = Camera.get();
This code creates a variable called myCam. The it finds the systems default webcam/video device and applies it to that variable. Hence the ‘camera get’.
webcam.attachVideo(myCam);
This line gets the variable myCam’ and applies it to the ‘webcam’ object on the stage which we created earlier.
webcam.smoothing = true;
The last line makes the webcam appear less pixellated and more smooth. This line is not necessary, but makes the video higher quality.
Now preview your movie(CTRL+ENTER) and your webcam input should be on the stage where your ‘webcam’ object is.
If it doesn’t want to show up try adjusting your flash player settings by right clicking and selecting ‘settings’.
Some other useful things are:-
webcam.clear(); - This refreshed the video feed.
webcam.height = 4 - This defines the height of the pixels in the video.
webcam.width = 4 - This defines the width of the pixels in the video. 2 – Effects
Now you are all excited about the idea of making a video flash why not make it even better by adding some awesome effects to your flash.
EFFECT 1 - Negative
This is one of my favs. This effect will negative your webcam, so you can view yourself in real-time, in negativity.
This is an all actions effect. Simply open the action panel with your webcam script in and paste this code:-
negative = new Color(_root.webcam);
myColorTransform = {ra:-100, rb:255, ga:-100, gb:255, ba:-100, bb:255};
negative.setTransform(myColorTransform);
Explanations
First line creates a variable ‘negative’ and makes it colour which will be applied to your video object. Change the ‘_root.’ To the path of your video object e.g. _root.ismell.webcam.
Second line creates a new colour transformation and sets its colours. These settings will give a negative effect but they can be changed to give different effects. e.g. ra=+50
The final line finds the negative variable and applies the colour transform to it.
This code can also be applied to a button so that when it is pressed the video changes colour. To Change it back use these actions on a button.
on (release) {
normal = new Color(_root.webcam);
myColorTransform = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0};
normal.setTransform(myColorTransform);
}
EFFECT 2 - Tint
This is a good effect to make things dark or light, and it needs practically no actions.
To start make a new layer above the one you have your video object on and draw a borderless square in the new layer. Resize it to the size of your video object and place it directly over it.
Click your square and open the colour mixer (Shift+F9). Choose back from the mixer and then put its alpha down to 50%. This should make it translucent.
Click your square again and press F8 to convert it to a movie clip. Give it the instance name ‘tint’.
Go into your movie clip and make 3 key frames. Name the first frame ‘black, the second ‘red’ and the last ‘blue’. Goto your second frame and change the squares colour to red, with its alpha still down at 50%. Then do the same for the 3rd but this time in blue.
In every key frame in the movie clip remember to put a stop(); action.
Now make 3 buttons one called black, 1 called blue and another called red. Apply these actions to the ‘Black Button’.
on(release){
_root.tint.gotoAndStop(“black”);
}
These to the red button:-
on(release){
_root.tint.gotoAndStop(“red”);
}
And these to the blue:-
on(release){
_root.tint.gotoAndStop(“blue”);
}
Now when you click on your buttons the video object should appear to change colour. You may need to resize the size of the tint movie clip to get it to look right.
I hope all these tips and advice have helped and I will make more of these if they are popular.
If I missed anything, just say!
,Ali
