SHOW:
|
|
- or go back to the newest paste.
1 | var index = 20; | |
2 | setup(index); | |
3 | var intervalId = setInterval(removeObjectMc,1000); | |
4 | ||
5 | function setup(total) | |
6 | { | |
7 | var objectHolder:MovieClip = this.createEmptyMovieClip("objectHolder",100); | |
8 | object = xml.firstChild.nextSibling.childNodes; | |
9 | totalObjects = total; | |
10 | trace("Total objects: "+totalObjects); | |
11 | ||
12 | for(i=0;i<totalObjects;i++) | |
13 | { | |
14 | var objectMc:MovieClip = objectHolder.attachMovie(objectMc,objectName+i,i); | |
15 | ||
16 | objectMc.image = object[i].attributes.image; | |
17 | objectMc.id = i; | |
18 | objectMc.isClicked = false; | |
19 | objectMc.isFront = (i == totalObjects - 1); | |
20 | objectMc._x = Math.floor(object[i].attributes.x); | |
21 | objectMc._y = Math.floor(object[i].attributes.y); | |
22 | objectMc.xpos = objectMc._x; | |
23 | objectMc.ypos = objectMc._y; | |
24 | ||
25 | applyBlur(objectMc,i); | |
26 | applyScale(objectMc,i); | |
27 | ||
28 | var imageHolder:MovieClip = objectMc.createEmptyMovieClip("imageHolder",10); | |
29 | var myImgLoader:MovieClipLoader = new MovieClipLoader(); | |
30 | var myImgListener:Object = new Object(); | |
31 | myImgListener.onLoadInit=function(target_mc) | |
32 | { | |
33 | - | target_mc._x = (target_mc._parent._width - target_mc._parent._width)/2 |
33 | + | target_mc._x = (target_mc._parent._width - target_mc._width)/2 |
34 | - | target_mc._y = (target_mc._parent._height - target_mc._parent._height)/2 |
34 | + | target_mc._y = (target_mc._parent._height - target_mc._height)/2 |
35 | } | |
36 | myImgLoader.addListener(myImgListener); | |
37 | myImgLoader.loadClip(imageURL+objectMc.image,imageHolder); | |
38 | } | |
39 | } | |
40 | function removeObjectMc() | |
41 | { | |
42 | objectHolder[objectName+index].removeMovieClip(); | |
43 | if(index==0) | |
44 | clearInterval(intervalId) | |
45 | else | |
46 | index--; | |
47 | } |