1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
| import flash.display.BitmapData;
import flash.geom.Matrix
var image_xml = new XML();
image_xml.ignoreWhite = true;
image_xml.load("images.xml")
var images_path = new Array();
var frames = 0
//XML load
image_xml.onLoad = function()
{
//get paths
for(i = 0; i < image_xml.firstChild.firstChild.childNodes.length; i++)
{
_root.images_path[i] = image_xml.firstChild.firstChild.childNodes[i].attributes.title;
_root.createEmptyMovieClip("frames" + i, _root.getNextHighestDepth());
_root.MCloader.loadClip(_root.images_path[i], _root["frames" + i]);
}
}
//MCL
MCloader = new MovieClipLoader();
listener = new Object();
MCloader.addListener(listener);
listener.onLoadInit = function(target)
{
var bmd:BitmapData = new BitmapData(200,150);
var xscale = 200/target._width
var yscale = 150/target._height
var MT = new Matrix();
MT.scale(xscale, yscale)
bmd.draw(target, MT);
for(i = 0; i < 3; i++)
{
mc = _root.framesMC.attachMovie("frame", "frame" + _root.frames, _root.framesMC.getNextHighestDepth());
mc.createEmptyMovieClip("pic", 10);
mc.pic._x = -100
mc.pic._y = -75
mc.pic.attachBitmap(bmd, 1);
mc.x = Math.random() * 2000 - 1000
mc.y = Math.random() * 1600 - 800
mc.z = _root.frames * 1000
mc.onPress = _root.selectFrame
mc.Move = _root.moveFrames
_root.frames_array[_root.frames] = mc
_root.frames++
}
target.removeMovieClip();
}
//Star Code
//MC from where the MCs start to show up
this.createEmptyMovieClip("framesMC", 1);
framesMC._x = Stage.width/2;
framesMC._y = Stage.height/2;
var curX = 0;
var curY = 0;
var curZ = 0;
var selX = 0;
var selY = 0;
var selZ = 0;
var frames_array = new Array();
function selectFrame()
{
_root.selX = this.x
_root.selY = this.y
_root.selZ = this.z
}
framesMC.onEnterFrame = function()
{
_root.curX += (_root.selX - _root.curX)/5;
_root.curY += (_root.selY - _root.curY)/5;
_root.curZ += (_root.selZ - _root.curZ)/5;
for (i = 0; i < _root.frames_array.length; i++)
{
_root.frames_array[i].Move();
}
}
function moveFrames()
{
var nX = this.x - _root.curX
var nY = this.y - _root.curY
var nZ = this.z - _root.curZ
if (nZ < 0)
{
this.z += 10000;
this.x = Math.random() * 2000 - 1000;
this.y = Math.random() * 1600 - 800;
nX = this.x - _root.curX
nY = this.y - _root.curY
nZ = this.z - _root.curZ
}
var ratio = 400/(400 + nZ);
this._alpha = ratio * 1000
this._x = nX * ratio;
this._y = nY * ratio;
this._xscale = this._yscale = 100 * ratio;
this.swapDepths(Math.round(-nZ));
} |
Partager