Skip to main content
October 11, 2014
Question

Atribute outside the class ? anyone help ?

  • October 11, 2014
  • 1 reply
  • 481 views

Hello My name is Steven , can anyone help me how can i deal with this stuff ?

Here is the code that show error atribute outside the class, bla bla bla and total of 4 error including error syntax, etc


package batrai_fla {

import flash.display.*;

   public dynamic class Battery_3 extends movieclip {

  

   public var pick:movieclip;

  

   public function Battery_3(){

addFrameScript(0, frame1);

}

function frame1(){

stop();

}

   }

}//package batrai_fla

package batrai_fla {

import flash.display.*;

   public dynamic class lamp_1 extends movieclip { 

  

public var pick:movieclip; 

}

}//package batrai_fla

?package batrai_fla {

import flash.events.*;

import flash.display.*;

import adobe.utils.*;

import flash.accessibility.*;

import flash.errors.*;

import flash.external.*;

import flash.filters.*;

import flash.geom.*;

import flash.media.*;

import flash.net.*;

import flash.printing.*;

import flash.system.*;

import flash.text.*;

import flash.ui.*;

import flash.utils.*;

import flash.xml.*;

   public dynamic class MainTimeline extends movieclip {

  

   public var b:movieclip;

public var l:movieclip;

public var lNempel;

public var nempel;

   public function MainTimeline(){

addFrameScript(0, frame1);

}

public function cekTempel(_arg1:MouseEvent){

if ((((b.x == l.x)) && ((b.y == l.y)))){

} else {

b.gotoandplay(2);

nempel = !(nempel);

lNempel = false;

};

}

function frame1(){

nempel = false;

lNempel = false;

stage.addEventListener(Event.ENTER_FRAME, main);

b.addEventListener(MouseEvent.MOUSE_DOWN, cekTempel);

l.addEventListener(MouseEvent.MOUSE_DOWN, cekTempel2);

}

public function cekTempel2(_arg1:MouseEvent){

if ((((b.x == l.x)) && ((b.y == l.y)))){

} else {

nempel = false;

lNempel = !(lNempel);

};

}

public function main(_arg1:Event){

if (nempel == true){

b.pick.alpha = 1;

b.x = ((math.ceil((mouseX / 50)) * 50) - 25);

b.y = ((math.ceil((mouseY / 50)) * 50) - 25);

} else {

b.pick.alpha = 0;

};

if (lNempel){

l.pick.alpha = 1;

l.x = ((math.ceil((mouseX / 50)) * 50) - 25);

l.y = ((math.ceil((mouseY / 50)) * 50) - 25);

} else {

l.pick.alpha = 0;

};

if ((((((((((((l.y == 75)) && ((l.x == 275)))) && ((b.y == 325)))) && ((b.x == 225)))) && (!(nempel)))) && (!(lNempel)))){

l.gotoandstop(2);

} else {

l.gotoandstop(1);

};

}

   }

}//package batrai_fla

SO I WANT TO MAKE >> WHEN I MOVE THE BATTERY PER 50X50 PX EVERY ONE MOVE AND WHEN I PUT THE BATTERY AND THE LAMP INTO RUGHT PLACE, THE LAMP IS ON, PLEASE TELL ME WHERE IS MY FAULT ? THX

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
October 11, 2014

that error usually means you have mismatched or unmatched curly brackets.  format your code so it's easier to see where that occurs.

and while you're at it, put different classes in different files to make it even easier on yourself.

October 12, 2014

thank you kglad for your answer, but can u lend me some help for make this swf work  please ?,thx

kglad
Community Expert
Community Expert
October 12, 2014

yes, start by putting different classes in different class files.