Error 1061 Call To A Possibly Undefined Method
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and call to a possibly undefined method addeventlistener through a reference with static type class policies of this site About Us Learn more about Stack Overflow the company
Call To A Possibly Undefined Method Addframescript
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Call To A Possibly Undefined Method Dispatchevent
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
Call To A Possibly Undefined Method Settimeout
minute: Sign up Flash compiler error 1061: Call to a possibly undefined method run… but run exists! up vote 0 down vote favorite So I've been working on making a game in Processing but I think Flash would be a better way to get more people playing it, so I've decided to learn Flash. The problem is that I keep getting call to a possibly undefined method navigatetourl really stupid errors on incredibly simple things. For instance, I want to make a 'Block' object to use in a platform game. So I make a new .as file, name it Block.as, and define the Block class within it like so: package { public class Block { public function Block() { // constructor code } public function run() { } } } I don't want to add the code yet, I just want to ensure that this works. So in my main timeline code, I try to create an instance of the Block object and execute its run method: var block1:Block = new Block(); block1.run(); Every time it gives me this inane error: Scene 1, Layer 'Layer 1', Frame 1, Line 2 1061: Call to a possibly undefined method run through a reference with static type Block. What undefined method!? It's defined RIGHT THERE in Block.as. The class file is even in the same folder and everything. I'm getting REALLY annoyed at how poorly Flash handles such a ridiculously simple project. Does anyone know why Flash hates me? flash class properties undefined share|im
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 call to a possibly undefined method hittestobject through a reference with static type class Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs call to a possibly undefined method addchild Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, call to a possibly undefined method gotoandstop just like you, helping each other. Join them; it only takes a minute: Sign up 1061: Call to a possibly undefined method gotoAndStop through a reference with static type Class up vote 0 down vote favorite I've http://stackoverflow.com/questions/5161437/flash-compiler-error-1061-call-to-a-possibly-undefined-method-run-but-run-ex been using Adobe Flash CS4 for a couple of days. I've drawn a worm, with eyes and a mouth and these pieces are all MovieClip symbols. I have exported them to actionscript with the class name being the same as what they are (ie. the mouth MovieClip is exported as mouth). The mouth has 2 frames, one smiling and one frowning. I need to mouth to stay smiling at first, so in Frame 1 actions http://stackoverflow.com/questions/4416621/1061-call-to-a-possibly-undefined-method-gotoandstop-through-a-reference-with-s I wrote: mouth.gotoAndStop(1); But I get this compiler error: 1061: Call to a possibly undefined method gotoAndStop through a reference with static type Class. Why is this occuring? Thanks. actionscript-3 class flash-cs4 movieclip share|improve this question asked Dec 11 '10 at 12:09 Greg Treleaven 1,90171927 It depends where you placed your code. If you paced it inside the mouth symbol, simply calling gotoAndStop(1) or stop() should do the trick. –George Profenza Dec 11 '10 at 13:20 It worked, I knew it would be something really obvious. Is that the only way I can access the MovieClip in AS3 or can I access it through the main timeline's actions somehow? I got this working a long time ago when I had the trial of Flash I think, but I can't remember. –Greg Treleaven Dec 11 '10 at 13:46 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted You need to give your Movieclip an instance name in order to reference it by code (if you donĀ“t use stop() inside the mouth clip). Select your Movieclip and give it an instance name in the properties window. If you have nested your mouth instance and want to control it from the main timeline/class you should also declare the full body of the snake. snake.m
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the http://stackoverflow.com/questions/26268568/as3-error-1061-reference-with-static-type 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 you, helping each other. call to 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 spelling errors or the like. Can someone call to a 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 class. Erhu_H3_btn.startDrag(new Rectangle, false,(0,min,0,max)); needs to be: Erhu_H3_btn.startDrag(false,new Rectangle(0,min,0,max)); You can't directly reference o