-
picture gallary
I did do a search on the question i am about to ask, and looks through several pages of posts, but could not find a simplified version of what i am looking for.
I want to be able to click and hold a button so that a movie clip in the same frame moves to the left until released, and right when the right button is clicked.
-
Senior Member
To release you have to press, which is the same as being clicked. But heres some code to play with, using two buttons, to move right or left.
//On movieclip
onClipEvent(enterFrame){
if(_parent.move==1){
this._x+=3;
}
if(_parent.move==2){
this._x-=3;
}
..................................
// On Right button
on(press){
move=1;
}
on(release){
move=0;
}
// On Left button
on(press){
move=2;
}
on(release){
move=0;
}
-
Hmmm, I inserted the code, but its not doing anything so far, when clicked nothing happens.
-
Senior Member
One of those things, there was a } missing. Should be...
//On movieclip
onClipEvent (enterFrame) {
if (_parent.move == 1) {
this._x += 3;
}
if (_parent.move == 2) {
this._x -= 3;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|