Hello,
I’ve got a movie clip that reads in images from an xml file. It scrolls according to mouse position.
I have an indicator clip which I need to reflect the position of the dynamically generated clip in the opposite direction. I’ve almost got it working but I’m having problems getting the indicator to reflect the other clip precisely.
Any clues?
var last_x:Number = 120;
var timer:Number = 0;
var moved:Boolean = false;
var slider_width_unit = 6;
var move_width = last_width - 960;
var move_width_unit = move_width/100;
oldx = this._x;
//Load the image into an empty movie clip
this.container.onEnterFrame = function() {
if (scrolling) {
timer = 0;
if(_root._xmouse < Stage.width/2){
accelerant = (Stage.width/2 - _root._xmouse) *.009 * 1.60803399;
}
else{
accelerant = (_root._xmouse - Stage.width/2) *.009 * 1.60803399;
}
accelerant = accelerant*.25
this._x += Math.cos((-(_root._xmouse)/Stage.width)*Math.PI) * (_root.img.length * accelerant);
//trace(this._x);
//THIS CODE REFLECTS THE CLIP POSITIONS
if (this._x > (oldx - move_width_unit)){
slider._x = slider._x - slider_width_unit;
trace(slider_width_unit);
oldx = this._x;
}
if (this._x < (oldx + move_width_unit)){
slider._x = slider._x + slider_width_unit;
trace(slider_width_unit);
oldx = this._x;
}
if (this._x> 30) { this._x = 30;}
if (-this._x>(this._width-Stage.width + 30)) {
this._x = -(this._width-Stage.width + 30);
}
last_x = this._x;
}/* If scrolling */ }; /* function */
I’ve attached the files.
Cheers!