• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

error #1069

Participant ,
Aug 28, 2012 Aug 28, 2012

Copy link to clipboard

Copied

hi

i get this error after doing some change in the hero class , i mean after this command

MovieClip(parent) only!.

the old code (works very 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 is the one who has the 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

TOPICS
ActionScript

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Aug 28, 2012 Aug 28, 2012

You have to remove any MovieClip(parent).fBall references overall. Use fBall directly as I've shown you above. I'll show you how your W key code would look rewritten with it:

if (event.keyCode == Keyboard.W)

{

    SOUNDCHANNEL = FIREBALLSOUND.play()

    fBall.name = "fb" + String(i);

    fBall.width = 20;

    fBall.x = 400

    fBall.y = 400

    fireballindex.push(fBall);

    MovieClip(parent).addChild(fBall);

    SOUNDCHANNEL = FIREBALLSOUND.play()

    i++;

    trace(i)

    trace(fBall.name)

}

Remove the Movie

...

Votes

Translate

Translate
Participant ,
Aug 28, 2012 Aug 28, 2012

Copy link to clipboard

Copied

sorry i forgot that  "permit debugging"

here

the message after the new debug

ReferenceError: Error #1069: Property fBall not found on MAIN and there is no default value.

at HERO/onEnterFrame()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines