import flash.display.MovieClip;
var clip1:clip01 = new clip01;
var clip2:clip02 = new clip02;
var clip3:clip03 = new clip03;
var clip4:clip04 = new clip04;
var clip5:clip05 = new clip05;
var files:Array = [clip1,clip2,clip3,clip4,clip5];
function randomizeArray(array:Array):Array
{
var newArray:Array = new Array();
while (array.length > 0)
newArray.push(array.splice(Math.floor
(Math.random()*array.length), 1));
return newArray;
}
var RandomArray:Array = randomizeArray(files);
trace(RandomArray[0]);
trace(clip1);
//var c:MovieClip = MovieClip(RandomArray[0]);
//addChild(c); not working :(
addChild(RandomArray[0]); // I want something like this!! Here i got err..
addChild(clip1);
Compiler message:
[object clip03]
[object clip01]
TypeError: Error #1034: Type Coercion failed: cannot convert []@3ea4aee1 to flash.display.DisplayObject.
at RandomVideo_fla::MainTimeline/frame1()
I know from trace() that I have the object, what could be the problem then?
I pass an MC object to addChild(), so i don't know :(