Skip navigation
Currently Being Moderated

warnning :1090 please help

Apr 21, 2012 3:49 AM

hi guys

 

i have  3 classes in the library (external classes) and 1 document class called Main

the program running but with 2 warrnings

C:\Users\win7\Desktop\first rpg\HERO.as, Line 49Warning: 1090: Migration issue: The onKeyDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0.  You must first register this handler for the event using addEventListener ( 'keyDown', callback_handler).

 

C:\Users\win7\Desktop\first rpg\HERO.as, Line 76Warning: 1090: Migration issue: The onKeyUp event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0.  You must first register this handler for the event using addEventListener ( 'keyUp', callback_handler).

 

 

so i cant move the hero because these warrnings then i tried to do what warrning said

 

in HERO class i did this

 

addEventListener('keyDown',callback_handler);

addEventListener('keyUp',callback_handler);

then i get 2 errors without warnnings

 

here are the classes code (the external classes ) in the lib

 

MAINMAP1 class

package

 

{

import flash.system.System;

import flash.system.fscommand;

 

    import flash.display.MovieClip;

import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.events.KeyboardEvent;

 

    import flash.ui.Keyboard;

 

    import flash.events.Event;

 

    import flash.events.MouseEvent;

    import flash.display.Stage;

public class MAINMAP1 extends MovieClip {

    var vx:int = 0

    var vy:int = 0

   

  public function MAINMAP1(){

    addEventListener(Event.ADDED_TO_STAGE, onAdded)

   

  }

  public function onAdded (event:Event):void  {

     

}

}

}

 

tree1 class

 

package{

    import flash.system.System;

import flash.system.fscommand;

 

    import flash.display.MovieClip;

import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.events.KeyboardEvent;

 

    import flash.ui.Keyboard;

 

    import flash.events.Event;

 

    import flash.events.MouseEvent;

    import flash.display.Stage;

   

   

   

   

    public class tree1 extends MovieClip{

       

       

   

        public function tree1 (){

                addEventListener(Event.ADDED_TO_STAGE, onAdded)

 

 

        }

                public function onAdded (){

                   

                                              addEventListener(Event.ENTER_FRAME, onEnterFrame);

 

                }

    public function onEnterFrame(event:Event){

        {

         

           

        }

    }

 

}

}

      

 

HERO class

 

package{

    import flash.system.System;

import flash.system.fscommand;

 

    import flash.display.MovieClip;

import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.events.KeyboardEvent;

 

    import flash.ui.Keyboard;

 

    import flash.events.Event;

 

    import flash.events.MouseEvent;

    import flash.display.Stage;

   

   

   

   

    public class HERO extends MovieClip{

       

       

    private var vx:int = 0;

        private var vy:int = 0;

 

        public function HERO (){

                addEventListener(Event.ADDED_TO_STAGE, onAdded)

 

 

        }

               

                public function onAdded (event:Event):void  {

      gotoAndStop(3)

     

          addEventListener(Event.ENTER_FRAME, onEnterFrame);

        stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);

            stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);

 

 

  }

    public function onEnterFrame(event:Event){

       

        x += vx

        y += vy

       

    }

 

    public function onKeyDown(event:KeyboardEvent){

        if (event.keyCode == Keyboard.LEFT){

            gotoAndStop(2)

            vx = -5

           

           

       

        }

                if (event.keyCode == Keyboard.RIGHT){

                    gotoAndStop(1)

                                vx = 5

 

                   

                   

                }

        if (event.keyCode == Keyboard.DOWN){

           

            vy = +5

            gotoAndStop(6)

}

if (event.keyCode == Keyboard.UP){

           

            vy = -5

           

}

 

    }

public function onKeyUp(event:KeyboardEvent){

            if (event.keyCode == Keyboard.LEFT ||event.keyCode == Keyboard.RIGHT ){

                vx= 0;

               

            }

if (event.keyCode == Keyboard.UP ||event.keyCode == Keyboard.DOWN ){

                vy= 0;

            }

   

       

    }

 

         

 

}

}

 

   

 

THE DOCUMENT CLASS (Main)

 

package  {

   

    import flash.system.System;

import flash.system.fscommand;

 

    import flash.display.MovieClip;

import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.events.KeyboardEvent;

 

    import flash.ui.Keyboard;

 

    import flash.events.Event;

 

    import flash.events.MouseEvent;

    import flash.display.Stage;

       

 

   

    public class Main extends MovieClip {

       

        var mainmap1:MAINMAP1 = new MAINMAP1;

        public function Main() {

            addChild(mainmap1);

           

           

        }

    }

   

}

 

done

the program run but i cant move the hero because of these warrnings

 

thank you

 
Replies
  • Currently Being Moderated
    Apr 21, 2012 4:16 AM   in reply to thunderxlight11111

    Migration issues pertain to using AS1/AS2-like coding in an AS3 file.  In your case, you have a few function names that are AS2 built-in functions and that is why the migration warnings are occuring.  If you want to avoid the warnings change the names of your functions... namely: onEnterFrame , onKeyDown, and onKeyUp

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points