hey,
I have been wrecking my brains to work out how I can load images from an xml database to the following bit of code.
var numItems = 50; // Number of items
var focalLength = 1000; // environmental constant
var centerX = Stage.width/2; // Stage Center X
var centerY = Stage.height/2; // Stage Center Y
this.initCamera = function(){
// create camera object
this.oCamera = new Object();
this.oCamera.x = 0;
this.oCamera.y = 0;
this.oCamera.z = focalLength/2; // focal point
this.oCamera.dx = 0;
this.oCamera.dy = 0;
this.oCamera.dz =-focalLength/2; // User screen
this.oCamera.s = 30;
this.oCamera.t = 0; //time
this.onEnterFrame = function(){
// move the camera to its destination
with(this.oCamera){
t = (t>=50) ? null : t+1;
x = (t>=50) ? x : easeIn(t,x,(dx-x),50);
y = (t>=50) ? y : easeIn(t,y,(dy-y),50);
z = (t>=50) ? z : easeIn(t,z,(dz-z),50);
}
}
// Zoom back button
this._btn.onRelease = function(){
this._parent.oCamera.dx = 0;
this._parent.oCamera.dy = 0 ;
this._parent.oCamera.dz = -focalLength/2;
this._parent.oCamera.t = 0;
}
// loop and create the numer of instances defined
for(var i = 0; i<=numItems;i++){
// attach movie
this.attachMovie("instance", "instance_mc_"+i,i);
// Assign variable to the MovieClip
clip = this["instance_mc_"+i];
// go to a new frame within the clip (randomly chosen)
clip.gotoAndStop(random(5));
// Assign variable to the MovieClip
clip = this["instance_mc_"+i];
// define initial properties
clip.x = random(Stage.width)- centerX ; // initial x position
clip.y = random(Stage.height)- centerY; // initial y position
clip.z = random(focalLength*2)-focalLength; // initial z position
//text on icon
clip.nbr_txt.text = i;
clip.onPress = function(){
// push the camera towards the word by setting destination just a bit in front
this._parent.oCamera.t = 0;
this._parent.oCamera.dx = this.x;
this._parent.oCamera.dy = this.y;
this._parent.oCamera.dz = this.z+this._parent.focalLength*.9;
}
// render
clip.onEnterFrame = function(){
// Calculating current s position according to camera
var zpos = (this.z-this._parent.oCamera.z);
// Calculating actual scale values according to scale = f/(f+z) formula
var scale = this._parent.focalLength/(this._parent.focalLength + zpos);
// Make item visible only if scale is smaller than 100%
this._visible = (scale <= 10);
// set position using camera as an offset
this._x = (this.x - this._parent.oCamera.x )*scale + centerX;
this._y = (this.y - this._parent.oCamera.y )*scale + centerY;
// set size
this._xscale = scale*100;
this._yscale = scale*100;
// set alpha
this._alpha = scale*100;
// set depth
this.swapDepths(scale*100);
}
}
}
//return randum integer between two specified parametrers
//@param nb1 first random number
//@param nb2 second random number
this.rand = function(nb1,nb2){
return Math.floor(Math.random() * ((nb2 - nb1)+ 1)) + nb1;
}
this.easeIn = function (t, b, c, d,a,p) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) <= 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
};
// Initiate instances in Camera
initCamera();
stop();
________________________________________________
*/
What i want it to do is load the jpegs into the main mc in the library. Any help would be greatly appreciated.
regards,
Damian