Hi,
I have added the following AS code to a movieclip called mc_square:
[AS]onClipEvent (load) {
speed = 3;
yPos = 50;
}
onClipEvent (enterFrame) {
endPos = yPos - _y;
_y += endPos/speed;
}[/AS]
I like to accomplish that, when rolling over mc-square, it’s _y position becomes 150.
Right now I have an extra button on the stage with de following actionscript code:
[AS]on (RollOver) {
mc_square.yPos=150;
}[/AS]
This is working. When rolling over the clip mc_square is indeed moving to _y position 150.
As said instaed of working with a sepparate button I would like to attach the code to the movieclip mc_square. I tried the following AS code but nothing happened:
[AS]mc_square.onLoad= function(){
speed = 3;
yPos = 50;
}
mc_square.onEnterFrame=function(){
yEnd = yPos - _y;
_y += yEnd/speed;
}
mc_square.onRollOver=function(){
this.yPos= 150;
}[/AS]
Where am I going wrong :h: