I need a code to move my image form left to right on mouse overusing javascript funct

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

// to save file size, the loaded sprite sheet only includes left facing animations
// we could flip the display objects with scaleX=-1, but this is expensive in most browsers
// instead, we generate a new sprite sheet which includes the flipped animations
createjs.SpriteSheetUtils.addFlippedFrames(spriteSheet, true, false, false);

// create a BitmapSequence instance to display and play back the sprite sheet:
bmpAnimation = new createjs.BitmapAnimation(spriteSheet);

// set the registration point (the point it will be positioned and rotated around)
// to the center of the frame dimensions:
bmpAnimation.regX = bmpAnimation.spriteSheet.frameWidth/2|0;
bmpAnimation.regY = bmpAnimation.spriteSheet.frameHeight / 2 | 0;

// start playing the first sequence:
// walk_h has been generated by addFlippedFrames and
// contained the right facing animations
bmpAnimation.gotoAndPlay("walk_h"); //walking from left to right

// set up a shadow. Note that shadows are ridiculously expensive. You could display hundreds
// of animated rats if you disabled the shadow.
bmpAnimation.shadow = new createjs.Shadow("#454", 0, 5, 4);

// have each monster start at a specific frame
bmpAnimation.currentFrame = 10;
stage.addChild(bmpAnimation);

// we want to do some work before we update the canvas,
// otherwise we could use Ticker.addListener(stage);
createjs.Ticker.addListener(window);
createjs.Ticker.useRAF = true;
createjs.Ticker.setFPS(60);
}

//called if there is an error loading the image (usually due to a 404)
function handleImageError(e) {
console.log("Error Loading Image : " + e.target.src);
}

function tick() {
// Hit testing the screen width, otherwise our sprite would disappear
if (bmpAnimation.x >= screen_width - 16) {
// We've reached the right side of our screen
// We need to walk left now to go back to our initial position
bmpAnimation.direction = -90;
bmpAnimation.gotoAndPlay("walk")
}

if (bmpAnimation.x < 16) {
// We've reached the left side of our screen
// We need to walk right now
bmpAnimation.direction = 90;
bmpAnimation.gotoAndPlay("walk_h");
}