STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228125
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5121

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/17228842?noj=FRM17228842-13DC" width="1" height="1"></div>

Webcam In Flash Tutorial2.swf

This is the info page for
Flash #58556

(Click the ID number above for more basic data on this flash file.)


Text
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 1
stage.showMenu = false; _root.bytesLoaded = _root.getBytesLoaded(); _root.bytesTotal = _root.getBytesTotal(); _root.percentLoaded = Math.round(100 * (_root.bytesLoaded / _root.bytesTotal)); _root.percentLoadedText = _root.percentLoaded + "%";
Frame 2
if (_root.percentLoaded == 100) { gotoAndStop (3); } else { gotoAndPlay (1); }
Frame 3
stop();
Frame 4
stop();
Frame 14
function motion(mode) { motiontext = mode; } c = Camera.get(); webCam.attachVideo(c); c.onActivity = function (mode) { motion(mode); }; c.setMotionLevel(30, 500);
Symbol 19 Button
on (press) { _root.nextFrame(); }
Symbol 31 Button
on (press) { _root.nextFrame(); }
Symbol 35 Button
on (press) { getURL ("http://www.newgrounds.com/portal/view/326194", "_blank"); }
Symbol 37 Button
on (press) { _root.prevFrame(); }
Symbol 41 Button
on (press) { nextFrame(); }
Symbol 42 Button
on (press) { _root.prevFrame(); }
Symbol 47 Button
on (press) { _root.nextFrame(); }
Symbol 48 Button
on (press) { _root.prevFrame(); }
Symbol 66 Button
on (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 Button
on (press) { getURL ("http://denvish.net/ulf/170207/66642_Webcam_Motion_Detection.fla", "_blank"); }

Library Items

Symbol 1 GraphicUsed by:Timeline
Symbol 2 FontUsed 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 TextUses:2Used by:Timeline
Symbol 4 TextUses:2Used by:Timeline
Symbol 5 FontUsed by:6
Symbol 6 TextUses:5Used by:Timeline
Symbol 7 TextUses:2Used by:8
Symbol 8 MovieClipUses:7Used by:Timeline
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClipUses:9Used by:Timeline
Symbol 11 EditableTextUses:2Used by:Timeline
Symbol 12 GraphicUsed by:Timeline
Symbol 13 GraphicUsed by:Timeline
Symbol 14 TextUses:2Used by:19
Symbol 15 FontUsed by:16 43 44 51 55 58
Symbol 16 TextUses:15Used by:19
Symbol 17 TextUses:2Used by:19
Symbol 18 GraphicUsed by:19
Symbol 19 ButtonUses:14 16 17 18Used by:Timeline
Symbol 20 TextUses:2Used by:Timeline
Symbol 21 SoundUsed by:Timeline
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClipUses:22Used by:Timeline
Symbol 24 TextUses:2Used by:Timeline
Symbol 25 GraphicUsed by:Timeline
Symbol 26 TextUses:2Used by:Timeline
Symbol 27 TextUses:2Used by:Timeline
Symbol 28 GraphicUsed by:31 37 41 42 47 48
Symbol 29 GraphicUsed by:31 37 41 42 47 48
Symbol 30 GraphicUsed by:31 37 41 42 47 48
Symbol 31 ButtonUses:28 29 30Used by:Timeline
Symbol 32 TextUses:2Used by:Timeline
Symbol 33 GraphicUsed by:35
Symbol 34 TextUses:2Used by:35
Symbol 35 ButtonUses:33 34Used by:Timeline
Symbol 36 GraphicUsed by:Timeline
Symbol 37 ButtonUses:28 29 30Used by:Timeline
Symbol 38 TextUses:2Used by:Timeline
Symbol 39 BitmapUsed by:40
Symbol 40 GraphicUses:39Used by:Timeline
Symbol 41 ButtonUses:28 29 30Used by:Timeline
Symbol 42 ButtonUses:28 29 30Used by:Timeline
Symbol 43 TextUses:2 15Used by:Timeline
Symbol 44 EditableTextUses:15Used by:Timeline
Symbol 45 BitmapUsed by:46
Symbol 46 GraphicUses:45Used by:Timeline
Symbol 47 ButtonUses:28 29 30Used by:Timeline
Symbol 48 ButtonUses:28 29 30Used by:Timeline
Symbol 49 TextUses:2Used by:Timeline
Symbol 50 GraphicUsed by:Timeline
Symbol 51 TextUses:2 15Used by:Timeline
Symbol 52 EditableTextUses:2Used by:Timeline
Symbol 53 TextUses:2Used by:Timeline
Symbol 54 TextUses:2Used by:Timeline
Symbol 55 EditableTextUses:15Used by:Timeline
Symbol 56 TextUses:2Used by:Timeline
Symbol 57 TextUses:2Used by:Timeline
Symbol 58 EditableTextUses:15Used by:Timeline
Symbol 59 TextUses:2Used by:Timeline
Symbol 60 TextUses:2Used by:Timeline
Symbol 61 VideoUsed by:Timeline
Symbol 62 FontUsed by:63
Symbol 63 EditableTextUses:62Used by:Timeline
Symbol 64 GraphicUsed by:66
Symbol 65 TextUses:2Used by:66
Symbol 66 ButtonUses:64 65Used by:Timeline
Symbol 67 GraphicUsed by:69
Symbol 68 TextUses:2Used by:69
Symbol 69 ButtonUses:67 68Used by:Timeline
Symbol 70 GraphicUsed by:Timeline

Instance Names

"webCam"Frame 14Symbol 61 Video

Dynamic Text Variables

percentLoadedTextSymbol 11 EditableText""
motiontextSymbol 63 EditableText""




http://swfchan.com/12/58556/info.shtml
Created: 17/4 -2019 03:26:54 Last modified: 17/4 -2019 03:26:54 Server time: 13/05 -2024 03:28:18