error #1069


hi

 

i error after doing change in hero class , mean after command

 

movieclip(parent) only!.

 

the old code (works well)

 

package {


    import flash.display.movieclip;

    import flash.events.keyboardevent;

    import flash.ui.keyboard;

    import flash.events.event;

    import flash.sensors.accelerometer;
import flash.media.sound;
import flash.media.soundchannel;


    public class hero extends movieclip {
var nightjungle:nightjungle = new nightjungle
        var electricalshield:electricalshield=new electricalshield  ;
var fball:fireball = new fireball();

var fireballsound:fireballsound = new fireballsound
        var speed:int=3;
var fireballindex:array = new array
        var dir:int;
  var electricity:electricity = new electricity;
  var soundchannel:soundchannel = new soundchannel
  var firespeed:int = 10
  var totalfirespeed = 0
var i:int
        public function hero() {

            addeventlistener(event.added_to_stage,onaddedtostage);

        }

        public function onaddedtostage(event:event):void {

            addeventlistener(event.enter_frame,onenterframe );

            stage.addeventlistener(keyboardevent.key_down,onkeydown);

            stage.addeventlistener(keyboardevent.key_up,onkeyup);

           
soundchannel = nightjungle.play(1,1000)
            gotoandstop(4);
  

        }

 

        public function onenterframe(event:event):void {
  x += dir * speed
   if (fball.stage){
   fball.x += firespeed * dir;
   fball.width +=2
   fball.height += 2
   totalfirespeed +=1
  
   }
   if (totalfirespeed == 10){
    removechild(fball)
    totalfirespeed = 0
   
   
   }
  
        }

        public function onkeydown(event:keyboardevent):void {

            if (event.keycode==keyboard.right) {

                gotoandstop(2);

                dir=1;
    speed = 10
    if (electricalshield.stage)
    addchild(electricalshield)
   

            }


            if (event.keycode==keyboard.left) {

                gotoandstop(1);


                dir=-1;
    speed  = 10
    if (electricalshield.stage)
    addchild(electricalshield)

            }

            if (event.keycode==keyboard.up) {

                gotoandstop(1);

                y=10;

            }

            if (event.keycode==keyboard.q) {

                speed=30;

                addchild(electricalshield);
    soundchannel = electricity.play()
   
            }
if (event.keycode == keyboard.w) {

soundchannel = fireballsound.play()
    fball.name = "fb"+string(i);

fball.width = 50;
fball.x



fireballindex.push(fball);


addchild(fball);
soundchannel = fireballsound.play()

i++;
trace(i)
trace( fball.name)

   }
  if (event.keycode == keyboard.e) {
movieclip(parent).aa.x = x +100
  }
}

        public function onkeyup(event:keyboardevent):void {

            if (event.keycode==keyboard.q) {

                if (electricalshield.stage) {

                    removechild(electricalshield);
if (soundchannel != null)
                    speed=0;
     soundchannel = electricity.play(1,1)

                }

            }
      if (event.keycode==keyboard.w) {


      }
     

            if (event.keycode==keyboard.left) {
speed = 0
      gotoandstop(3);
      if (electricalshield.stage)
    addchild(electricalshield)

            } else if (event.keycode == keyboard.right) {
speed =0
                gotoandstop(4);
if (electricalshield.stage)
    addchild(electricalshield)
            }

        }

    }

}

 

 

 

 

 

new code (which 1 has error message)

 

package {


    import flash.display.movieclip;

    import flash.events.keyboardevent;

    import flash.ui.keyboard;

    import flash.events.event;

    import flash.sensors.accelerometer;
import flash.media.sound;
import flash.media.soundchannel;


    public class hero extends movieclip {
var nightjungle:nightjungle = new nightjungle
        var electricalshield:electricalshield=new electricalshield  ;
var fball:fireball = new fireball();

var fireballsound:fireballsound = new fireballsound
        var speed:int=3;
var fireballindex:array = new array
        var dir:int;
  var electricity:electricity = new electricity;
  var soundchannel:soundchannel = new soundchannel
  var firespeed:int = 10
  var totalfirespeed = 0
var i:int
        public function hero() {

            addeventlistener(event.added_to_stage,onaddedtostage);

        }

        public function onaddedtostage(event:event):void {

            addeventlistener(event.enter_frame,onenterframe );

            stage.addeventlistener(keyboardevent.key_down,onkeydown);

            stage.addeventlistener(keyboardevent.key_up,onkeyup);

           
soundchannel = nightjungle.play(1,1000)
            gotoandstop(4);
  

        }

 

        public function onenterframe(event:event):void {
  x += dir * speed
   if (movieclip(parent).fball.stage){
   movieclip(parent).fball.x += firespeed * dir;
   movieclip(parent).fball.width +=2
   movieclip(parent).fball.height += 2
   totalfirespeed +=1
  
   }
   if (totalfirespeed == 10){
    movieclip(parent).removechild(fball)
    totalfirespeed = 0
   
   
   }
  
        }

        public function onkeydown(event:keyboardevent):void {

            if (event.keycode==keyboard.right) {

                gotoandstop(2);

                dir=1;
    speed = 10
    if (electricalshield.stage)
    addchild(electricalshield)
   

            }


            if (event.keycode==keyboard.left) {

                gotoandstop(1);


                dir=-1;
    speed  = 10
    if (electricalshield.stage)
    addchild(electricalshield)

            }

            if (event.keycode==keyboard.up) {

                gotoandstop(1);

                y=10;

            }

            if (event.keycode==keyboard.q) {

                speed=30;

                addchild(electricalshield);
    soundchannel = electricity.play()
   
            }
if (event.keycode == keyboard.w) {

soundchannel = fireballsound.play()
    movieclip(parent).fball.name = "fb"+string(i);

movieclip(parent).fball.width = 20;
movieclip(parent).fball.x =400
movieclip(parent).fball.y = 400



fireballindex.push(movieclip(parent).fball);


movieclip(parent).addchild(fball);
soundchannel = fireballsound.play()

i++;
trace(i)
trace( movieclip(parent).fball.name)

   }
  if (event.keycode == keyboard.e) {
movieclip(parent).aa.x = x +100
  }
}

        public function onkeyup(event:keyboardevent):void {

            if (event.keycode==keyboard.q) {

                if (electricalshield.stage) {

                    removechild(electricalshield);
if (soundchannel != null)
                    speed=0;
     soundchannel = electricity.play(1,1)

                }

            }
      if (event.keycode==keyboard.w) {


      }
     

            if (event.keycode==keyboard.left) {
speed = 0
      gotoandstop(3);
      if (electricalshield.stage)
    addchild(electricalshield)

            } else if (event.keycode == keyboard.right) {
speed =0
                gotoandstop(4);
if (electricalshield.stage)
    addchild(electricalshield)
            }

        }

    }

}

 

thank you

you should include entire error message(s) in postings.  few exceptions, there couple of errors remember involve without having see message. 

 

be sure have enabled permit debugging option in flash publish settings before testing again message.  can isolating line problem is.

 

also, can others highlighting in code show problemed code is.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support