PDA

View Full Version : I think the problem is Inheritance I am not sure


Wael
09-10-2002, 02:45 PM
Hi everyone, I'd really appreciate someone's help here all I am trying
to do is to have multiple movie clips of "barCodeClip" which is a movie
clip that is created on the fly, and each instance of "barCodeClip" would
have multiple instances of another movieclip named "alphaClip" I thought
I needed to create a class for this so I did...

pls help I've spent quite some time on this problem.

Thanks in advance,

Wael

you can download the fla here:-
http://www.nettrinity.biz/flash/barCode.fla or
http://www.nettrinity.biz/flash/barCode.zip

|only 2 Frames In the main time line|
The Library includes only one movie clip with 5 frames, one Text Letter
in earch Frame. The linkage name for this clip is "alphaClip"

//========================== FRAME 1 =====================================
barCode_depth = 100; // some random depth.
createEmptyMovieClip("barCodeClip", barCode_depth);

// create a class for movieclip that was created on the fly.
function barCode ( ) {}

// register the class
barCode.prototype = new MovieClip();
Object.registerClass("barCodeClip", barCode);

barCode.prototype.Duplicate = function()
{
// this is what I want to do inside this movieclip
// I want to keep attaching multiple instances of the physical
// clip "alphaClip" untill I reach the bottom of the movie stage.
// this part works perfect, except for the with(clipName) as I don't
// know what to pass or how to pass to that function. the problem
// is in FRAME 2.

with (clipName) {
attachMovie( "alphaClip", "LET" + depth, depth )
LET = eval("LET" + depth);
LET_P = eval("LET" + (depth - 1));
LET._y = LET_P._y + LET_P._height + 3;
LET.gotoAndStop(Math.floor(Math.random() * LET._totalframes));
depth++;

if ((LET._y + LET._height) >= Stage.height) {
depth = 1;
clearInterval( duplicateID );
return;
}
}
}
//========================== FRAME 2 =====================================
stop();


// I would like here to create multiple copies of the barCode
// movieclip at least 2 instances of barCode to work simultanously
// for testing. (ofcourse this part doesn't work)

for (i = 1; i <= 2; i++) {
//barCodeClip.attachMovie("barCode" + i, i)
//barCodeClip.duplicateMovieClip("barCode" + i, i);
clipName = eval("barCode" + i);
clipName = new barCode();
clipName.depth = 1; // initilize the depth of the first Alpha.
barCode2._x = 300

// here is the main problem I want both barCode1 and barCode2
// to have their own time interval duplicating their own Alphas.
duplicateID = setInterval(clipName.Duplicate, 100);
}