quick flash Q
- Started
- Last post
- 25 Responses
- stewart
i have this code for an easing slide motion:
onClipEvent (enterFrame) {
Xsquare = this._x;
Xdiff = Xpos-Xsquare;
Xmove = Xdiff/2;
this._x = Xsquare+Xmove;
updateAfterEvent(enterFrame);
}but now i need it to be linear, not easing...
anyone with a quick solution?
thanks!
- stewart0
... and on a button press i give the Xpos value ...
- silencer0
U got mail.
- stewart0
thanks man, looks good - and advanced.
but for now i just need a quick little change on the code above to make it linear...
(i don't know exactly HOW this code works now, so it's not easy for me to change it to a linear one...)
- stewart0
i'm so desperate i think i'm going to use flash motion tween instead in a few minutes.
- silencer0
Use the scripts I sent, trust me it's really easy.
You can ignore the first frame of scripts.
The second frame can be used for any movie clip.give your button an instance name my_btn
Paste this script on frame two.
my_btn.onRelease = function() {
var xTween = new Tween(my_mc, "_x", Math.LinearTween);
xTween.startTween(100, 20);
};Call your movie clip instance my_mc
the bit which says "_x" can be changed to anything("_alpha, "_y" , "_rotation" etc)
the bit where it says "LinearTween"
can be changed to any of the functions initialised on the 1st frame. ("easeOutback", "easeOutQuart" etc)the first value "100" is your final _x position (or whatever)
and the last value "20" is your speed.
Hope this helps.
- stewart0
i trust you silencer. haha.
but i don't have any time now to apply new code, although i will do that in the next project.i only need a quick fix on the first code above, because i can't figure out how it works myself.
- stewart0
owwww...
- unfittoprint0
a setInterval is [in most cases] more reliable than the usaghe of an onEnterFrame.
- stewart0
because you know flash
and i don't
- unfittoprint0
actionscript? two weeks of light summer reading. that's all.
- stewart0
but you need to make time for reading it. two weeks!
but do you have a quick answer on my question?
- unfittoprint0
ah ah, light as in bedtime reading.
anyways_____ I thought silencer answered you.
- stewart0
no,
i need it changed in the first script i gave, because the site is built already, only the easing slide has to be a linear slide. :(
- ozhanlion0
._x+=1
?
- ozhanlion0
can someone tell me the difference between constant and linear
- stewart0
._x+=1
not at all.
constant and lineair = the same in my opinion.
- ozhanlion0
onClipEvent (enterFrame) {
this._x = this._x + 1
}
this is no go, ya?
- ********0
take off the /2.....or just change it to /1
- ok_not_ok0
try this:
name ur symbol to move "box"
now place this code on an empty movieClip
onClipEvent(load){
xPos = 200;
}
onClipEvent(enterFrame){
if (_parent.box._x > xPos){
_parent.box._x--;
}else if(_parent.box._x < xPos){
_parent.box._x++;
}else{
removeMovieClip(this);
}
}not sure if this will work..have not use onClipevents since v.5
I hope this helps