[Flashcoders] Object move

2006-04-01 Thread Olasz RĂ³bert
Hi all!

Since this time i was only a reader of your mailing list, but now I
have a problem which needs help.

I have 2 rectangles on the sceen. I can scale them with a slider, but
i would like to move one of them left to right and back also a slider.
Ive attached the code the last row should move the lap2_mc, but it
doesn't move. What's the problem?

Please help.

Thaks

Robert

This is the code:

/* wake up Sliders */
slidebar_mc.slider_mc.onPress = function() {
this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
}
slidefesz_mc.slider_mc.onPress = function() {
this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
}
slidertav_mc.slider_mc.onPress = function() {
this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
}
slidebar_mc.slider_mc.onRelease = onReleaseOutside = function() {
this.stopDrag();
}
slidefesz_mc.slider_mc.onRelease = onReleaseOutside = function() {
this.stopDrag();
}
slidefesz_mc.slider_mc.onRelease = onReleaseOutside = function() {
this.stopDrag();
}
slidertav_mc.slider_mc.onRelease = onReleaseOutside = function() {
this.stopDrag();
}

this.onEnterFrame = function() {
lap_mc._yscale = int ((slidebar_mc.slider_mc._x + 
slidebar_mc._width/2)/258.5*100+100);
lap_mc._xscale = int (((slidebar_mc.slider_mc._x + 
slidebar_mc._width/2)/258.5*100+100)/2);
lap2_mc._yscale = int ((slidebar_mc.slider_mc._x + 
slidebar_mc._width/2)/258.5*100+100);
lap2_mc._xscale = int (((slidebar_mc.slider_mc._x + 
slidebar_mc._width/2)/258.5*100+100)/2);

lap2_mc._x += int ((slidertav_mc.slider_mc._x + 
slidertav_mc.width/2)+100);
}



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Object move

2006-04-01 Thread stacey
Have you traced back the value you are trying to use to change the x pos?

   lap2_mc._x += int ((slidertav_mc.slider_mc._x +
slidertav_mc.width/2)+100);

Shouldn't it be _width?

try going : var amount:Number=(slidertav_mc.slider_mc._x +
(slidertav_mc._width/2)+100);

Also, one thing you could do to optimize this script rather than having
the onEnterFrame running all the time, is to define the onMouseMove event
or the onEnterFrame when the startDrag occurrs and kill it when its done.
That way you don't have something running all the time, when you don't
need it to be.

 Hi all!

 Since this time i was only a reader of your mailing list, but now I have
 a problem which needs help.

 I have 2 rectangles on the sceen. I can scale them with a slider, but i
 would like to move one of them left to right and back also a slider. Ive
 attached the code the last row should move the lap2_mc, but it doesn't
 move. What's the problem?

 Please help.

 Thaks

 Robert

 This is the code:

 /* wake up Sliders */
 slidebar_mc.slider_mc.onPress = function() {
 
 this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
 }
 slidefesz_mc.slider_mc.onPress = function() {
 
 this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
 }
 slidertav_mc.slider_mc.onPress = function() {
 
 this.startDrag(false,-this._parent._width/2,0,this._parent._width/2,0);
 }
 slidebar_mc.slider_mc.onRelease = onReleaseOutside = function() {
 this.stopDrag();
 }
 slidefesz_mc.slider_mc.onRelease = onReleaseOutside = function() {
 this.stopDrag();
 }
 slidefesz_mc.slider_mc.onRelease = onReleaseOutside = function() {
 this.stopDrag();
 }
 slidertav_mc.slider_mc.onRelease = onReleaseOutside = function() {
 this.stopDrag();
 }

 this.onEnterFrame = function() {
 lap_mc._yscale = int ((slidebar_mc.slider_mc._x +
 slidebar_mc._width/2)/258.5*100+100); lap_mc._xscale = int
 (((slidebar_mc.slider_mc._x +
 slidebar_mc._width/2)/258.5*100+100)/2); lap2_mc._yscale = int
 ((slidebar_mc.slider_mc._x +
 slidebar_mc._width/2)/258.5*100+100); lap2_mc._xscale = int
 (((slidebar_mc.slider_mc._x +
 slidebar_mc._width/2)/258.5*100+100)/2);

 lap2_mc._x += int ((slidertav_mc.slider_mc._x +
 slidertav_mc.width/2)+100);
 }



 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com