• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

i need help please

Participant ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

hi , how are you guys ? i hope you all fine..

here

i have 2 problems the first one is why some sounds files  change after importing  it into flash

and how can i fix that

second problem is why flash asking me to add semicolon !! this is the first time and (i guess) it is because of static type , because i get this problem when i did that(trying to access variable from another class) also i couldn,t fix it after adding semicolon

here are the 2 classes

MAIN CLASS

package
{

import flash.display.MovieClip;

import flash.events.Event;

import flash.events.KeyboardEvent;

    import flash.ui.Keyboard;
   import flash.media.Sound;


        import flash.media.SoundChannel;
public class MAIN extends MovieClip
{
  var LINKCONVERT:linkconvert = new linkconvert
  var checkpoint:Boolean
var fireballindex:Array = new Array
var ele:int
var i:int = 0
var FIREBIRD:firebird = new firebird
var SCREAM:scream = new scream
var SOUNDCHANNEL:SoundChannel = new SoundChannel
  public function MAIN()
  {

   addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
  

  }


  public function onAddedToStage(event:Event):void
  {

   addEventListener(Event.ENTER_FRAME,onEnterFrame);
    stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
    FIREBIRD.stop()

  }

  public function onEnterFrame(event:Event)
  {
FIREBIRD.x = hero.x
FIREBIRD.y = hero.y
if (hero.ELECTRICALSHIELD.stage){
healthbar1.width -=1
}

if (bat1h != null){
if (bat1h.stage){
if (hero.ELECTRICALSHIELD.stage){
  if (hero.hitTestObject(bat1)){
  bat1h.width -= 5
 
  }
  }
}


}
if (bat1 != null){
if ( bat1h != null){
  if (bat1h.width == 0){
   removeChild(bat1h)
      removeChild(bat1)
            removeChild(bat1b)
            bat1b = null

      bat1 = null
      bat1h = null
     
     

  }
}
}

if (bat1 != null){
if (bat1.stage){
  if (hero.hitTestObject(bat1)){
   healthbar1.width -=  5
  }
}
}

   if (bat1 != null)
   {
    if (hero.ELECTRICALSHIELD.stage){

    if (hero.hitTestObject(bat1))
    {

     healthbar1.width -=  1;

    }
   }
   }
   if (healthbar1.width >= 80 && healthbar1.width <= 100)
   {
    zelda1.gotoAndPlay(1);

   }

   if (healthbar1.width >= 60 && healthbar1.width <= 80)
   {

    zelda1.gotoAndPlay(2);

   }

   if (healthbar1.width >= 40 && healthbar1.width <= 60)
   {

    zelda1.gotoAndPlay(3);

   }

   if (healthbar1.width >= 20 && healthbar1.width <= 40)
   {

    zelda1.gotoAndPlay(4);

   }

   if (healthbar1.width >= 0 && healthbar1.width <= 20)
   {

    zelda1.gotoAndPlay(5);

   }


  

   if (hero.hitTestObject(portal3))
   {
    if (bat1 != null)
    {

     var map4:BACKGROUND = new BACKGROUND  ;

     removeChild(bat1);
     bat1 = null;

     // this doesn't need to be done unless you added a listener outside the Bat1 classs

    }//normal

   }//normal
  }//func
   public function onKeyDown(event:KeyboardEvent):void {

 
            if (event.keyCode == Keyboard.E)

                       {
         if (hero.visible){

  if(checkpoint){
   SOUNDCHANNEL = SCREAM.play()
                                hero.visible = false
        addChild(FIREBIRD)
        }

}
      if (!hero.visible){
if(FIREBIRD.stage){
  if(!checkpoint){
   if(HERO.marioflying == false){
 
  SOUNDCHANNEL = LINKCONVERT.play()
                                hero.visible = true
        removeChild(FIREBIRD)
        }
        }
}
      }
      checkpoint = !checkpoint
} //if event...


                       
   }//fun
}//class

}//pack

HERO CLASS


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 MARIOHASFALLEN:mariohasfallen = new mariohasfallen;
var static marioflying:Boolean = true;
var vy:int
var ROARING:roaring = new roaring
                var NIGHTJUNGLE:nightjungle = new nightjungle
var heromovesduringfirefly:Boolean

                var ELECTRICALSHIELD:electricalshield = new electricalshield;


                var fBall:fireball = new fireball();
var fBalla:fireball = new fireball();
  var fBallb:fireball = new fireball();

var fireshooting:Boolean = false
               
var lastpos:int


                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


                var fdir:int


               


                var fireballFlying:Boolean; // keep track of fireball


               


                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);


                       


                        gotoAndStop(4);


         

                }


               


                public function onEnterFrame(event:Event):void
  {

if(visible){
if(y <325){
  y += 10
 
  if(marioflying){
   SOUNDCHANNEL = MARIOHASFALLEN.play()
   marioflying = false
  }
 
  if(y>=325){
  y = 325
  marioflying = true
  }
}
}

if(fBall.width > 55){
fBall.width = 55
}
if(fBall.height > 55){
fBall.height = 55
}
                   


y += vy


                        x += dir * speed


                       


                        if (fBall.stage)


                        {


                                fBall.x += firespeed * fdir;


                               


                                fBall.width += 0


                               


                                fBall.height += 0


                               


                                totalfirespeed += 1


                               


                        }


                        if (totalfirespeed == 20)


                               


                        {


                                if (fBall.stage)


                                {


                                        MovieClip(parent).removeChild(fBall);


                                       


                                        totalfirespeed = 0;


                                       


                                        // fireball done flying

fdir = dir
                                        fireballFlying = false;
         
          fireshooting = false;


                                }


                               


                        }


               


                }


               


                public function onKeyDown(event:KeyboardEvent):void


                {


                       


                        if (event.keyCode == Keyboard.RIGHT)


                        {


                                gotoAndStop(2);


                               


                                // is fireball flying?


                                if (fireballFlying == false)
       
        {

                                         fdir = +1

}

                               


                                dir = 1;


                                speed = 10


                                if (ELECTRICALSHIELD.stage)


                                        addChild(ELECTRICALSHIELD)
if(MovieClip(parent).FIREBIRD.stage){
speed =30
}

                             
MovieClip(parent).FIREBIRD.gotoAndStop(2)


                        }


                       


                        if (event.keyCode == Keyboard.LEFT)


                        {

                               

                                gotoAndStop(1);

                               

                                // is fireball flying?

                                if (fireballFlying == false)

                                {

                                        fdir = -1

                                      
                                }

                             

                                dir = -1;

                                speed = 10

                                if (ELECTRICALSHIELD.stage)

                                {

                                        addChild(ELECTRICALSHIELD)

                                }

                           
MovieClip(parent).FIREBIRD.gotoAndStop(1)
if(MovieClip(parent).FIREBIRD.stage){
speed =30
}

                        }

                       

                        if (event.keyCode == Keyboard.UP)

                        {

                               

                               

                               if (MovieClip(parent).FIREBIRD.stage)
{
                              
vy = -30

}
                               

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

                        {
if (MovieClip(parent).FIREBIRD.stage)
{
                              
        vy = 30
      

}

      }

                        if (event.keyCode == Keyboard.Q)

                        {

                                if(visible){

                                speed = 30;

                               

                                addChild(ELECTRICALSHIELD);

                                SOUNDCHANNEL = ELECTRICITY.play()

        }

                        }

                        if (event.keyCode == Keyboard.W)

                        {

                                // tell myself a fireball is shot

                                fireballFlying = true;


if(!fireshooting){
fireshooting = true
                             

                               

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

                                fBall.width = 25;
           fBall.height = 25;

                                fBall.x = x + 20

                                fBall.y = y + 10
        
       
                               

                                fireballindex.push(fBall);
       
       
          if(this.visible == false){  
         if (MovieClip(parent).FIREBIRD.stage){
         fBall.width += 30
         fBall.height += 30
        SOUNDCHANNEL = ROARING.play()
        }
          }

                               

                                MovieClip(parent).addChild(fBall);
if(this.visible == true){
if (!MovieClip(parent).FIREBIRD.stage){
                                SOUNDCHANNEL = FIREBALLSOUND.play()
       
}}
  if(this.visible == false){

                              SOUNDCHANNEL = ROARING.play()
}
                               

                                i++;

                               

                                trace(i)

                               

                                trace(fBall.name)

                               

                        }
      }
                       

           

                }

               

                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)

MovieClip(parent).FIREBIRD.gotoAndStop(1)

                               

                        }

                         if (event.keyCode == Keyboard.RIGHT)

                        {

                                speed = 0

                                gotoAndStop(4);

                                if (ELECTRICALSHIELD.stage){

                                        addChild(ELECTRICALSHIELD)
        }
          
MovieClip(parent).FIREBIRD.gotoAndStop(2)

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

                        {
       vy = 0
      }
      if (event.keyCode == Keyboard.DOWN)

                        {
       vy = 0
      }
    }
   //Ł„Ų§ Ų§Ł„Ł‡ Ų§Ł„Ų§ Ų§Ł„Ł„Ł‡
    // there is no god except 1 god
    }
}

and here is the error message

C:\Users\Owner n\Desktop\project ā€«(4)ā€¬ ā€«ā€¬\HERO.as, Line 39 1086: Syntax error: expecting semicolon before marioflying.

thank you guys for all the help in all my threads

TOPICS
ActionScript

Views

2.1K

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 , Sep 04, 2012 Sep 04, 2012

How does yours...

     var static ...

look the same as...

     public static var ...

?

Votes

Translate

Translate
LEGEND ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

You need to indicate which is line 39 of the Hero class code.

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
Participant ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

???

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
LEGEND ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

???

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
Participant ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

i dnt understand your answer , it is very short??

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
LEGEND ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

No one is likely to want to try to figure out which line of your Hero code is line 39.  You need to help others to help you by indicating which line of your Hero code is line 39.

You should not put all of your file(s) code into your posting every time you post.  It is unnecessary and makes reading your posting more difficult.  Only include the code that is directly relevant to your problem.  In this case, a few lines around line 39 might be sufficient to start with.

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
Participant ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

ohh sorry

its here

var static marioflying:Boolean = true;

the second variable in the hero class

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
LEGEND ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

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
Participant ,
Sep 04, 2012 Sep 04, 2012

Copy link to clipboard

Copied

i,ve donwatching the examples in your link and it looks correct for me ? but it is not

so ... where should i put it?

thank you for your replay

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
LEGEND ,
Sep 04, 2012 Sep 04, 2012

Copy link to clipboard

Copied

How does yours...

     var static ...

look the same as...

     public static var ...

?

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
Participant ,
Sep 06, 2012 Sep 06, 2012

Copy link to clipboard

Copied

thank you for your help

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
LEGEND ,
Sep 06, 2012 Sep 06, 2012

Copy link to clipboard

Copied

LATEST

You're welcome

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
LEGEND ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

I wont be able to help with your sound issue.  You should probably start a new posting for that.  It is recommended you keep one topic/problem per posting - it helps finding solutions easier for others.

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