Flash Actionscript 3 Error 1061
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you call to a possibly undefined method addeventlistener through a reference with static type class might have Meta Discuss the workings and policies of this
Call To A Possibly Undefined Method Play Through A Reference With Static Type Class.
site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting error Type 1061: Call to a possibly undefined method addEventListener through a reference with static type up vote 1 down vote favorite I moved my code from my Application to a separate AS class file and now I'm getting the following errors: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. 1180: Call to a possibly undefined method addEventListener. . package managers { import flash.events.Event; import flash.events.EventDispatcher; public class RemoteManager extends EventDispatcher { public function RemoteManager() { } public static function init(clearCache:Boolean = false):void { addEventListener(SETTINGS_CHANGE, settingChangeHandler); addEventListener(ITEMS_UPDATED, itemsUpdatedHandler); } } } actionscript-3 flex share|improve this question asked Aug 6 '12 at 10:02 1.21 gigawatts 4,005124691 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Your code addEventListener(SETTINGS_CHANGE, settingChangeHandler); evaluates to this.addEventListener(SETTINGS_CHANGE, settingChangeHandler); There is no this in a static method, since it's designed to function without an instance. Furthermore, you cannot attach an event listener and dispatch events from a static class. Either change your function declaration to public function init(clearCache:Boolean = false):void Or implement a singleton pattern to kinda get a "static class, that dispatches events". Singleton with event manag
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like http://stackoverflow.com/questions/11826131/getting-error-type-1061-call-to-a-possibly-undefined-method-addeventlistener-th you, helping each other. Join them; it only takes a minute: Sign up AS3 Error 1061 Reference with Static Type up vote 0 down vote favorite I'm new to AS3, and trying to create a draggable element. However, I keep getting error 1061, and I don't know why, because I'm pretty sure I don't have any http://stackoverflow.com/questions/26268568/as3-error-1061-reference-with-static-type spelling errors or the like. Can someone please tell me what I'm doing wrong? Here is my code: package { import flash.display.*; import flash.events.*; import flash.geom.Rectangle; public class Script extends MovieClip{ public var value:Number; private var max:Number; private var min:Number; public function Draggable(){ min = erhu_mc.y; max = erhu_mc.height - Erhu_H3_btn.height; Erhu_H3_btn.addEventListener(MouseEvent.MOUSE_DOWN, dragHandle); } function dragHandle(event:MouseEvent):void { Erhu_H3_btn.startDrag(new Rectangle, false,(0,min,0,max)); stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging); } function stopDragging(event:MouseEvent):void { Erhu_H3_btn.stopDrag(); stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging); } } } actionscript-3 function flash share|improve this question asked Oct 9 '14 at 0:35 Anne 31 1 It's because Erhu_H3_btn is the name of a class, not an instance name of an object on the stage. –Marty Oct 9 '14 at 4:01 I don't understand...'Erhu_H3_btn' is the name of my button, which is on my stage...so why is it a class and not an instance name? –Anne Oct 9 '14 at 9:19 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted There are 2 issues with your current cla
ElementsAdobe Dreamweaver Adobe MuseAdobe Animate CCAdobe Premiere ProAdobe After EffectsAdobe IllustratorAdobe InDesignView all communitiesExplore Menu beginsMeet the expertsLearn our productsConnect with your peersError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without https://forums.adobe.com/thread/736781 it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions http://flash.bigresource.com/ActionScript-3-0-Getting-1061-Error-with-hitTestObject-CXI1sYktX.html in ActionScript 3 All CommunitiesAdobe Animate CC - HomeActionScript 3 9 Replies Latest reply on Oct 12, 2010 7:18 AM by pawmunkey Button error, 1061 error, pawmunkey Oct 11, 2010 10:38 call to AM I am new to ActionScript 3. I created a simple button that I imported into the stage and I named and saved it as Microwave_btn and I wrote a simple script for it that says:stop (); import flash.display.*; import flash.events.*; Microwave_btn.addEventListener(MouseEvent.CLICK, Trace); function Trace (event:MouseEvent): void { trace("Microwave!"); } The properties for the Microwave_btn has the class labeled as: Microwave_btn and call to a the Base class as: flash.display.SimpleButton When I test the movie I get this error: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. 2222Views Tags: none (add) This content has been marked as final. Show 9 replies 1. Re: Button error, 1061 error, kglad Oct 11, 2010 10:52 AM (in response to pawmunkey) try: import flash.display.*; import flash.events.*;var btn:Microwave_btn=new Microwave_btn();addChild(btn); btn.addEventListener(MouseEvent.CLICK, Trace); function Trace (event:MouseEvent): void { trace("Microwave!"); } Like Show 0 Likes(0) Actions 2. Re: Button error, 1061 error, pawmunkey Oct 11, 2010 11:49 AM (in response to kglad) Thank you so much. What I don't understand is that I have two buttons on my screen now and the button that works is located on the top left corner of my screen. My original button which is located on top of the background image (microwave) does not invoke the Microwave Trace function.How do I get that to work and remove the Microwave_btn image from the top left corner of my screen and get original button to work? Like Show 0 Likes(0) Actions 3. Re: Button error, 1061
with this[code]... View 9 Replies Similar Posts: ActionScript 3.0 :: 1061: Call To A Possibly Undefined Method HitTestObject Through A Reference With Static Type Sep 11, 2011 Im trying to use the hit test built into flash, but its failing. I have used this many time before! but this time flash is crying at me. I Think i know why but im not sure how to fix it. Here is my hit test code:[Code]....I have tried multiple things, Changing instances, location of the code. I currently have 4 classes, Main, Missile, Enemy and House. House has nothing it in really. Missile make a missile, Enemy Makes a enemy. And main deals with adding it all to the stage, and making it randomly appear ect. View 8 Replies ActionScript 3.0 :: Error Happens When I Remove The NumOfKeys - Error #2007: Parameter HitTestObject Must Be Non-null? Feb 17, 2011 Code is working but i am getting the following error and it is driving me insane:TypeError: Error #2007: Parameter hitTestObject must be non-null.at flash.display:isplayObject/_hitTest()at flash.display:isplayObject/hitTestObject()at PlatformGame/checkCollisions()at PlatformGame/gameLoop()Here is my Frankenstein code...i just need it working. Error happens when I remove the numOfKeys-- where I examine the level. Had to remove some code because of length when posting here on FK. View 1 Replies Getting Error 1061 And No Blue EventListener Mar 27, 2010 I am a newbie with Flash CS4 and via a tutorial of Lynda.com I am trying to make my first website. With the exercise files of Lynda I had no problem, but with my own .psd file I am getting error 1061 after I tried to make a mouseEvent.I noticed that in the actions script the word "eventListener" stays black instead of changing into blue.This is the action script:Actionscript Code:stop();//handle events for buttons...about.addEventlistener(MouseEvent.CLICK, clickSection);function clickSection(evtObj:MouseEvent){//trace shows what's happening... in the output window trace("The about button was clicked!")}See attached screenshots for more info. View 11 Replies ActionScript 3.0 :: 1061 Error On Custom Class Aug 5, 2010 I've a 1061 problem with a custom class. My class is named lingua here the code: [URL] I've imported it in my main class but when i delcare a variable like this:Code: var a:String = lingua.getLang(); It gives me a 1061 error that says to me "call to a possibly undefinited method getLang(); Here the main: [URL] The problem stays in the function bottoniLingua at line 155. In fact i've commen