Posted by sheel on Tue 22 Sep 14:02
report abuse | View followups from sheel | download | new post
- package
- {
- import flash.display.MovieClip;
- import flash.events.Event;
- public class Main extends MovieClip
- {
- var speed:Number = 5;
- var walk:Walk;
- public function Main()
- {
- addEventListener(Event.ENTER_FRAME, Update);
- walk= new Walk ();
- walk.x = 200;
- walk.y = 50;
- walk.scaleX = 1;
- walk.scaleX = 1;
- addChild(walk);
- trace("Flash");
- }
- public function Update (e:Event) : void
- {
- walk.x+=speed;
- if(walk.x>400-walk.width)
- {
- speed= -speed;
- walk.scaleX = -1;
- trace(walk.x);
- }
- if(walk.x<0+walk.width)
- {
- speed= -speed;
- walk.scaleX = 1;
- trace(walk.x);
- }
- }
- }
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.