STORY LOOP FURRY PORN GAMES C SERVICES [?] [R] RND POPULAR | Archived flashes: 229595 |
/disc/ · /res/ — /show/ · /fap/ · /gg/ · /swf/ | P0001 · P2595 · P5190 |
This is the info page for Flash #58556 |
Webcam in Flash tutorial 2 |
Basic Motion Detection |
Rohedin |
Loading... |
Start! |
Start! |
Start! |
Audio by RFInfection |
Oh, your back. What do you want now? What?! You want me to show you how to use webcam motion detection in Flash? All right then... If you insist... Use the arrows at the bottom to navigate through the tutorial. |
Webcam in flash tutorial 2 |
Basic motion detection |
Ok, to start, set up the webcam video symbol and AS exactly how I explained in the first WIFT (make sure the instance names are the same!) if you've not looked at the first WIFT then |
CLICK HERE |
Done that? Good. Now create a new text box. Using the drop-down menu on the left of the properties select 'Dynamic Text' This means the text can be controlled by actionscript. |
Now before we can use this text box we need to give it a name that the actionscript will identify it by. Us flash gurus call them 'Variable names' Find the part which I've shown in the picture and make sure it has the name |
motiontext |
Ok, now all we need to do is add some actionscript! Open the actions panel for the frame. There should some script there from when you set up the webcam by following the first WIFT. Over the next couple of pages I will provide some actionscript and an explanation for it. |
Add the following actionscript to the frame: Ok, there are two numbers in the brackets. Us flash gurus call them parameters . The first parameter is 30 - this is how much motion is required when flash declares motion as true. Continued on the next page... |
c.setMotionLevel(30, 500); |
The second parameter is 500. This is the number of milliseconds there should be between when Flash stops detecting motion and when Flash will declare that motion is false. To the next page! |
Ok underneath the previous script add this: |
function motion(mode) { motiontext=(mode); } |
This script creates a new function that when invoked makes the 'motiontext' display the current motion status of the webcam. |
And the last bit of script to put on the frame: |
c.onActivity = function(mode) { motion(mode); } |
This script tells Flash that when there is webcam activity to invoke the function that we made earlier. |
Now test your movie (Ctrl+Enter) and everything should be working. When you are moving the text box will say 'true' otherwise it will say 'false' On the next page is an example and a couple of handy links. If you have a webcam make sure it's on. |
More help |
Example .fla |
ActionScript [AS1/AS2]
Frame 1stage.showMenu = false; _root.bytesLoaded = _root.getBytesLoaded(); _root.bytesTotal = _root.getBytesTotal(); _root.percentLoaded = Math.round(100 * (_root.bytesLoaded / _root.bytesTotal)); _root.percentLoadedText = _root.percentLoaded + "%";Frame 2if (_root.percentLoaded == 100) { gotoAndStop (3); } else { gotoAndPlay (1); }Frame 3stop();Frame 4stop();Frame 14function motion(mode) { motiontext = mode; } c = Camera.get(); webCam.attachVideo(c); c.onActivity = function (mode) { motion(mode); }; c.setMotionLevel(30, 500);Symbol 19 Buttonon (press) { _root.nextFrame(); }Symbol 31 Buttonon (press) { _root.nextFrame(); }Symbol 35 Buttonon (press) { getURL ("http://www.newgrounds.com/portal/view/326194", "_blank"); }Symbol 37 Buttonon (press) { _root.prevFrame(); }Symbol 41 Buttonon (press) { nextFrame(); }Symbol 42 Buttonon (press) { _root.prevFrame(); }Symbol 47 Buttonon (press) { _root.nextFrame(); }Symbol 48 Buttonon (press) { _root.prevFrame(); }Symbol 66 Buttonon (press) { getURL ("http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00000981.html", "_blank"); }Symbol 69 Buttonon (press) { getURL ("http://denvish.net/ulf/170207/66642_Webcam_Motion_Detection.fla", "_blank"); }
Library Items
Symbol 1 Graphic | Used by:Timeline | |
Symbol 2 Font | Used by:3 4 7 11 14 17 20 24 26 27 32 34 38 43 49 51 52 53 54 56 57 59 60 65 68 | |
Symbol 3 Text | Uses:2 | Used by:Timeline |
Symbol 4 Text | Uses:2 | Used by:Timeline |
Symbol 5 Font | Used by:6 | |
Symbol 6 Text | Uses:5 | Used by:Timeline |
Symbol 7 Text | Uses:2 | Used by:8 |
Symbol 8 MovieClip | Uses:7 | Used by:Timeline |
Symbol 9 Graphic | Used by:10 | |
Symbol 10 MovieClip | Uses:9 | Used by:Timeline |
Symbol 11 EditableText | Uses:2 | Used by:Timeline |
Symbol 12 Graphic | Used by:Timeline | |
Symbol 13 Graphic | Used by:Timeline | |
Symbol 14 Text | Uses:2 | Used by:19 |
Symbol 15 Font | Used by:16 43 44 51 55 58 | |
Symbol 16 Text | Uses:15 | Used by:19 |
Symbol 17 Text | Uses:2 | Used by:19 |
Symbol 18 Graphic | Used by:19 | |
Symbol 19 Button | Uses:14 16 17 18 | Used by:Timeline |
Symbol 20 Text | Uses:2 | Used by:Timeline |
Symbol 21 Sound | Used by:Timeline | |
Symbol 22 Graphic | Used by:23 | |
Symbol 23 MovieClip | Uses:22 | Used by:Timeline |
Symbol 24 Text | Uses:2 | Used by:Timeline |
Symbol 25 Graphic | Used by:Timeline | |
Symbol 26 Text | Uses:2 | Used by:Timeline |
Symbol 27 Text | Uses:2 | Used by:Timeline |
Symbol 28 Graphic | Used by:31 37 41 42 47 48 | |
Symbol 29 Graphic | Used by:31 37 41 42 47 48 | |
Symbol 30 Graphic | Used by:31 37 41 42 47 48 | |
Symbol 31 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 32 Text | Uses:2 | Used by:Timeline |
Symbol 33 Graphic | Used by:35 | |
Symbol 34 Text | Uses:2 | Used by:35 |
Symbol 35 Button | Uses:33 34 | Used by:Timeline |
Symbol 36 Graphic | Used by:Timeline | |
Symbol 37 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 38 Text | Uses:2 | Used by:Timeline |
Symbol 39 Bitmap | Used by:40 | |
Symbol 40 Graphic | Uses:39 | Used by:Timeline |
Symbol 41 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 42 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 43 Text | Uses:2 15 | Used by:Timeline |
Symbol 44 EditableText | Uses:15 | Used by:Timeline |
Symbol 45 Bitmap | Used by:46 | |
Symbol 46 Graphic | Uses:45 | Used by:Timeline |
Symbol 47 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 48 Button | Uses:28 29 30 | Used by:Timeline |
Symbol 49 Text | Uses:2 | Used by:Timeline |
Symbol 50 Graphic | Used by:Timeline | |
Symbol 51 Text | Uses:2 15 | Used by:Timeline |
Symbol 52 EditableText | Uses:2 | Used by:Timeline |
Symbol 53 Text | Uses:2 | Used by:Timeline |
Symbol 54 Text | Uses:2 | Used by:Timeline |
Symbol 55 EditableText | Uses:15 | Used by:Timeline |
Symbol 56 Text | Uses:2 | Used by:Timeline |
Symbol 57 Text | Uses:2 | Used by:Timeline |
Symbol 58 EditableText | Uses:15 | Used by:Timeline |
Symbol 59 Text | Uses:2 | Used by:Timeline |
Symbol 60 Text | Uses:2 | Used by:Timeline |
Symbol 61 Video | Used by:Timeline | |
Symbol 62 Font | Used by:63 | |
Symbol 63 EditableText | Uses:62 | Used by:Timeline |
Symbol 64 Graphic | Used by:66 | |
Symbol 65 Text | Uses:2 | Used by:66 |
Symbol 66 Button | Uses:64 65 | Used by:Timeline |
Symbol 67 Graphic | Used by:69 | |
Symbol 68 Text | Uses:2 | Used by:69 |
Symbol 69 Button | Uses:67 68 | Used by:Timeline |
Symbol 70 Graphic | Used by:Timeline |
Instance Names
"webCam" | Frame 14 | Symbol 61 Video |
Dynamic Text Variables
percentLoadedText | Symbol 11 EditableText | "" |
motiontext | Symbol 63 EditableText | "" |
|