![]() ![]() |
Home |
How it works |
Projects archive |
Contact Us Air Compressor Bot |
|
| The Career Path of Freelance Programming Jobs |
Flash Script Modification |
![]() |
Bidding Time: |
13/04/2008 23:47 - 27/04/2008 23:47 |
Budget: |
N/A |
Status: |
Closed |
|
|
|
Job Type: |
|
Description: |
I have a code below that can attach external image files and rotate them 360 degree. I need help to modify this code so I can rotate only 3 images instead of 4 images. However, one of image will always need to be at center of stage position at beginning. There are left turn and right turn buttons that control left or right rotation. I also need help on how to make the right side of image or left side of image stop when one of them rotate to the center of stage, Also, I need to be able to attach the movie clip when click on one of image..... Thanks!! :: CODE :: var numItems = 4;// Number of items var focalLength = 1200;// environmental constant var centerX = Stage.width / 2;// Stage Center X var centerY = Stage.height / 2;// Stage Center Y // circle radius and animation speed var radius = 180; var speed = 0; // Are items turning left //var turnLeft = false; this.initCamera = function () { // create camera object this.oCamera = new Object (); // Set camera Properties this.oCamera.z = focalLength / 2;// current position this.oCamera.dz = -focalLength / 2;// focal point /* this.oCamera.s = 30; this.onEnterFrame = function() { with (this.oCamera) { z += (dz - z) / s; } }; */ // turn left this._btn_l.onRelease = function () { this._parent.turnLeft = true; speed = 1.5; }; // turn right this._btn_r.onRelease = function () { this._parent.turnLeft = false; speed = 1.5; }; // loop and create the numer of instances defined for (var i = 0; i <= numItems; i++) { // attach movie this.attachMovie (i,"instance_mc_" + i,i); // Assign variable to the MovieClip clip = this["instance_mc_" + i]; // define initial properties clip.x = 0;// initial x position clip.y = 0;// initial y position clip.angle = i * (360 / numItems);// initial item angle // render clip.onEnterFrame = function () { //detect if clip at center then stop trace ("this.angle =" + this.angle); // Increase angle this.angle = (turnLeft) ? this.angle - speed : this.angle + speed; // reset at 360 this.angle %= 360; // Transform angle degrees to radian value var radian = (this.angle * Math.PI / 180); // Calculate x position value this.x = Math.cos (radian) * radius; // Calculate z position value this.z = centerY - Math.sin (radian) * radius; //trace (" Z position = " + this.z); // Calculating actual scale values according to scale = dz/(z+dz) formula var scale = this._parent.oCamera.dz / (this._parent.oCamera.dz + (this.z - radius)); // Position this._x = (this.x * scale) + centerX; this._y = (this.y * scale) + centerY; // set size this._xscale = this._yscale = scale * 20; // Swap depths this.swapDepths (scale * 100); // set alpha this._alpha = scale * 100; }; } }; // Initiateinstances in Camera initCamera (); stop (); Related Projects: This project is the proprietary information of .
Click here to remove this project from OUR database.
|
Operating System: |
N/A |
Database System: |
N/A |
| <<< back |
|
| Home | Projects archive | RSS | Resources | Links | Contact Us | © 2004-2008 ProjectsList.biz /0.457 |