Could use some help with movement of Movie Clips


package  {

 

          import flash.display.movieclip

          import lamegame

          import flash.events.mouseevent

          import flash.events.event

          import flash.display.graphics

 

          public class heroone extends lamegame {

 

                    var kamehamehagfx:redcircle = new redcircle

                    var lamecircle:redcircle = new redcircle

                    var xslope:number

                    var yslope:number

 

 

 

                    public function heroone() {

 

                              var _herostrength = 20

                              var _herospeed = 2

                              var _herohealth = 140

                              kamehamehagfx.x = 30

                              kamehamehagfx.y = 30

                              stage.addeventlistener(mouseevent.mouse_down, kamehameha);

                              if(kamehamehagfx) {

                                        stage.addeventlistener(event.enter_frame, moveka);

                              }

 

 

                    }

 

                    public function kamehameha(evt:mouseevent) {

 

                              addchild(kamehamehagfx)

                              trace("gay")

                              var xslope:number = 1

                              var yslope:number = ((mousey - kamehamehagfx.y)/(mousex - kamehamehagfx.x)) ;

 

 

                    }

 

                    public function moveka(evt:event) {

 

                              trace("supergay")

                              kamehamehagfx.x += xslope;

                              kamehamehagfx.y += yslope;

                              trace(kamehamehagfx.x)

 

                    }

 

 

 

          }

 

}

 

when click mouse on stage, object spawns there no movement

when trace (kamehamehagfx.x) value 0 every time

   if(kamehamehagfx) {             //<-----------you need boolean, may change to  kamehamehagfx!=null

            stage.addeventlistener(event.enter_frame, moveka);

   }



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support