...

View Full Version : Random MovieClip script trouble



junwin
10-03-2009, 08:53 AM
i have a collection of movie clips (mc0, mc1, mc2...etc etc), and when motion is detected
on a webcam, one of these clips is shown on the stage.

however, for some reason only mc0, mc1 and mc2 are being displayed,
and i cannot get mc3, mc4 or any others to be chosen.


import flash.filters.*

// Assumes a Video object named "myVideoObject" is on the Stage
active_cam = Camera.get();

filterList = [
/* 0 */ "multiply",
/* 1 */ "multiply",
/* 2 */ "multiply",
/* 3 */ "multiply",
/* 4 */ "multiply"
];

positionList = [
/* 0 */ {_x: 512, _y: 288},
/* 1 */ {_x: 512, _y: 288},
/* 2 */ {_x: 512, _y: 288},
/* 3 */ {_x: 512, _y: 288},
/* 4 */ {_x: 512, _y: 288}
];



myVideoObject.attachVideo(active_cam);
active_cam.setMotionLevel(95, 100);
active_cam.onActivity = function(mode)
{
trace(mode);
var randId = Math.floor(Math.random() * 5);

var init = positionList[randId];
/* old init... {_x: Math.random() * _root._width, _y:Math.random() * _root._height}; */
var depth = _root.getNextHighestDepth();
var movieId = "mc" + randId;
if(mode) {
var mc = _root.attachMovie(movieId, movieId + depth, depth, init);
mc.blendMode = _root.filterList[randId];
}
}

I had the first three working fine, so when i added 2 more to the Filter and position Lists, and changed
the Mathrandom mutliplier to 5 instead of 3, i thought that would work,

what else to i have to do / How can i get more than 3 clips to show up ?

dusulsli
10-06-2009, 06:59 AM
Great work .. really informative .. and thanks a lot for sharing ..


__________________
Electric adjustable beds prices reviews (http://adjustablebedsprices.org) - Electric adjustable beds prices UK - (http://adjustablebedsprices.org/electric-adjustable-beds/)Sleep Comfort adjustable bed mattress air (http://adjustablebedsprices.org)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum