-
using if with dynamic text
Hello everyone i'm trying to make a movie clip move horizontally across the screen and then back again when it reaches the edge of the stage.
I'm extremely rusty with actionscript and i was trying to use two movie clips either side of the screen to change the text in a dynamic text box which the code would change the direction depending on which word was displayed in the box. as the code is currently it wont move left or right. if i just want it to move in one direction and take out one of the directions it moves across fine but then doesnt stop or go back.
here is the code i am using on the movieclip that i want to move on the screen
onClipEvent (enterFrame) {
if (this.hitTest(_root.stage_mov.right_mov))
{
_root.stage_mov.hittext.text = "left";
}
if (this.hitTest(_root.stage_mov.left_mov))
{
_root.stage_mov.hittext.text = "right";
}
}
onClipEvent (enterFrame) {
if (_root.stage_mov.hittest.text == "right")
{
xspeed = 3;
this._x += xspeed;
}
else
{
if (_root.stage_mov.hittest.text == "left")
{
xspeed = 3;
this._x -= xspeed;
}
}
}
any advice would be very gratefully appreciated, oh and i'm currently using the latest flash
thanks mike
-
Senior Member
i'm currently using the latest flash
this is irrelevant since you're using as2, it is impossible to target latest flash.
regardless, before any of hit tests (or some other code) set the text, your second enterFrame handler will not know where to move.
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
|