Copy link to clipboard
Copied
Here is my code, I keep recieving error 1061.
public var userID:String; | ||
public var myUserID:String; | ||
public var myUsername:String; |
profile_btn.addEventListener(MouseEvent.CLICK, this.profileButtonClick);
private function profileButtonClick(_arg1:MouseEvent):void{ | |
var _local2:URLRequest = new URLRequest(("http://www.domain.com/userprofile.php?user=" + myUsername)); | |
navigateToURL(_local2, "_blank"); | |
} |
The point of this is to click on either a button or link to go directly to user's profile.
Copy link to clipboard
Copied
profile_btn.addEventListener(MouseEvent.CLICK, this.profileButtonClick);
should be simply
profile_btn.addEventListener(MouseEvent.CLICK,profileButtonClick)
Copy link to clipboard
Copied
You're right, however this is for .as class. Even removing (this) still has the same result.
Copy link to clipboard
Copied
Show the complete error message.
Copy link to clipboard
Copied
1061: Call to a possibly undefined method addEventListener through a reference with static type Class. |
Copy link to clipboard
Copied
I have it done right, had to go to one of my mc's and add
profile_btn.addEventListener(MouseEvent.CLICK, profileButtonClick); As an action.
Then I had to go to my .as and add
private function profileButtonClick(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest(("http://www.user/" + userToInvite));
navigateToURL(_local2, "_blank");
}
userToInvite meaning, user's screen name. It works well now.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now