Using slider to control movement
hi all, appreciate figuring problem out. i'm trying build scrubber control movement of movieclips. code uses , down keys in onenterframe increase or decrease "vz". working fine, , movieclips move using: dream.z += vz; line of code need make scrubber work. make sense? posted once, i've tried strip code down make easier read in forum. scrubber should zoom dream clips in when slide way right, , zoom dream clips out original position when slide left.
................//mover function
function mover():void {
if (zdepth < 55 && key.isdown(key.up)){
vz -= .5;
zdepth += .5;
}
if(zdepth > 0 && key.isdown(key.down))
{
vz += .5;
zdepth -= .5;
}
vz *= friction;
(var i:number=0;i<dreamarray.length;i++) {
var dream:movieclip = home["dreamarray" +i];
//this next line need
dream.z += vz;
var scale:number = fl / (fl + dream.z);
dream.swapdepths(-dream.z);
}
}
}
.......................//scrubber code...................
var scrubber:movieclip;
var track:movieclip;
scrubber.onpress = function(){
this.startdrag(false,0,this._y,track._x + track._width,this._y);
this.onenterframe = function(){
trace(this._x);
_parent.vz = -(16*this._x) / 300;
}
}
scrubber.onrelease = function(){
this.stopdrag();
delete scrubber.onenterframe;
}
scrubber.onreleaseoutside = function(){
this.stopdrag();
delete scrubber.onenterframe;
}
................//mover function
function mover():void {
if (zdepth < 55 && key.isdown(key.up)){
vz -= .5;
zdepth += .5;
}
if(zdepth > 0 && key.isdown(key.down))
{
vz += .5;
zdepth -= .5;
}
vz *= friction;
(var i:number=0;i<dreamarray.length;i++) {
var dream:movieclip = home["dreamarray" +i];
//this next line need
dream.z += vz;
var scale:number = fl / (fl + dream.z);
dream.swapdepths(-dream.z);
}
}
}
.......................//scrubber code...................
var scrubber:movieclip;
var track:movieclip;
scrubber.onpress = function(){
this.startdrag(false,0,this._y,track._x + track._width,this._y);
this.onenterframe = function(){
trace(this._x);
_parent.vz = -(16*this._x) / 300;
}
}
scrubber.onrelease = function(){
this.stopdrag();
delete scrubber.onenterframe;
}
scrubber.onreleaseoutside = function(){
this.stopdrag();
delete scrubber.onenterframe;
}
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment