Skip to main content
Known Participant
May 4, 2008
Question

Problem with ActionScript

  • May 4, 2008
  • 7 replies
  • 667 views
hello I encountered this error while I running an action script file in flash cs3: 1013: The private attribute may be used only on class property definitions.

and this is the function that make this error:

private function clickListener(e:MouseEvent):void{
var phase:String;
switch(e.eventPhase){
case EventPhase.CAPTURING_PHASE:
phase = "Capture";
break;

case EventPhase.AT_TARGET:
phase = "Target";
break;

case EventPhase.BUBBLING_PHASE:
phase = "Bubbling";
break;
}
trace("Current event phase: "+ phase);
}
thank you very much and I appreciate you .sincerly yours Mohsena
This topic has been closed for replies.

7 replies

kglad
Community Expert
Community Expert
May 5, 2008
that has all sorts of errors. the one relevant to this thread to remove your private function from the contructor function.
mohsenaAuthor
Known Participant
May 5, 2008
continue of the codes (part2):

private function clickListener(e:MouseEvent):void{
var phase:String;
switch(e.eventPhase){
case EventPhase.CAPTURING_PHASE:
phase = "Capture";
break;

case EventPhase.AT_TARGET:
phase = "Target";
break;

case EventPhase.BUBBLING_PHASE:
phase = "Bubbling";
break;
}
trace("Current event phase: "+ phase);
}
}
}
}
mohsenaAuthor
Known Participant
May 5, 2008
Hello Kglad ,I tried to send it to two messege:
part 1:
package{
flash.display.Sprite;
public class TestEventPhase extends Sprite{
public function TestEventPhase():void{
var t:TextField = new TextField();
t.text = "click here";
t.autoSize = TextFieldAutoSize.LEFT;
stage.addChild(t);

stage.addEventListener(mouseEvent.CLICK,clickListener,true);

stage.addEventListener(mouseEvent.CLICK,clickListener,false);
mohsenaAuthor
Known Participant
May 5, 2008
Hello Kglad ,I tried to send it to two messege:
part 1:
package{
flash.display.Sprite;
public class TestEventPhase extends Sprite{
public function TestEventPhase():void{
var t:TextField = new TextField();
t.text = "click here";
t.autoSize = TextFieldAutoSize.LEFT;
stage.addChild(t);

stage.addEventListener(mouseEvent.CLICK,clickListener,true);

stage.addEventListener(mouseEvent.CLICK,clickListener,false);
kglad
Community Expert
Community Expert
May 5, 2008
show your class file using the attach code option in this forum.
mohsenaAuthor
Known Participant
May 5, 2008
Hello and thank you very much. I tried to attach codes before ,but it send me back this error " it will not allowed more than 250 character" ,would you please guide me what should I do then?
Sincerely yours Mohsena
mohsenaAuthor
Known Participant
May 5, 2008
Hello and thank you for your attention ,realy the function is in class file but it send me back the mentioned error(013: The private attribute may be used only on class property definitions) would you please guide me ?
Sincerely yours Mohsena
kglad
Community Expert
Community Expert
May 4, 2008
if that's in a class file there should be no problem. if that code is not in a class file, remove private from your function definition.