Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function make2D(){
- createEmptyMovieClip("objectHolder",100);
- object = xml.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.childNodes;
- totalObjects = object.length;
- trace("Total objects: "+totalObjects);
- for(i=0;i<totalObjects;i++){
- myObj = objectHolder.attachMovie(objectMc,objectName+i,i);
- myObj.image = object[i].attributes.image;
- myObj.id = i;
- myObj.isClicked = false;
- if(i==totalObjects-1){
- myObj.isFront = true;
- } else {
- myObj.isFront = false;
- }
- myImg = myObj.createEmptyMovieClip("imageHolder",10);
- myImg._x = (myObj._width + 20)/-2; //centers image
- myImg._y = (myObj._height + 20)/-2; //centers image
- var myImgLoader:MovieClipLoader = new MovieClipLoader();
- var myImgListener:Object = new Object();
- myImgLoader.addListener(myImgListener);
- myImgLoader.loadClip(imageURL+myObj.image,myImg);
- myObj._x = Math.floor(Math.random() * (Stage.width - 100));
- myObj._y = Math.floor(Math.random() * (Stage.height - 100));
- myObj.xpos = myObj._x;
- myObj.ypos = myObj._y;
- myObj.onPress = function(){
- this.isClicked = true;
- startDrag(this,false,10,50,Stage.width-10,Stage.height-40);
- if(!this.isFront){
- prevObj = getMcAtDepth(totalObjects-1);
- prevObj.isFront = false;
- this.swapDepths(totalObjects-1);
- prevObjNewDepth = prevObj.getDepth();
- myObj = getShiftValue(prevObjNewDepth);
- //prevObj.xpos = prevObj._x;
- //prevObj.ypos = prevObj._y;
- prevObj.xpos = Math.floor(prevObj._x + myObj.X);
- prevObj.ypos = Math.floor(prevObj._y + myObj.Y);
- depthBlurShift();
- }
- }
- myObj.onRelease =
- function(){
- if(!this.isFront){
- this.isFront = true;
- } else {
- object[i].attributes.func();//this._parent["object[i].attributes.func"]();// _root[object[i].attributes.func]();
- }
- stopDrag();
- this._x = Math.floor(this._x);
- this._y = Math.floor(this._y);
- myObj = getShiftValue(totalObjects-1);
- this.xpos = Math.floor(this._x + myObj.X);
- this.ypos = Math.floor(this._y + myObj.Y);
- this.isClicked = false;
- currentObject = this;
- }
- applyBlur(myObj,i);
- applyScale(myObj,i);
- }
- }
Add Comment
Please, Sign In to add comment