Actionscript Error 1061
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss call to a possibly undefined method addeventlistener through a reference with static type class the workings and policies of this site About Us Learn more
Call To A Possibly Undefined Method Play Through A Reference With Static Type Class.
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 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 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 Rectang
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 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 http://stackoverflow.com/questions/26268568/as3-error-1061-reference-with-static-type favorite I've 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 http://stackoverflow.com/questions/4416621/1061-call-to-a-possibly-undefined-method-gotoandstop-through-a-reference-with-s in Frame 1 actions 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,88171927 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 a
What should I do? We strongly urge all our users to upgrade to modern browsers for a better http://www.kongregate.com/forums/4-game-programming/topics/280840-as3-error-1061 experience and improved security. We suggest you install the latest version https://forums.adobe.com/thread/736781 of one of these browsers: Download Google Chrome Download Mozilla Firefox Download Microsoft Edge Download Apple Safari No Thanks … Kongregate p0 l0 f m s Settings Sign Out Sign in Register or Sign in: Username or email Password Remember me Forgot password? Games Categories call to Top Rated Action Multiplayer Hot New MMO Adventure & RPG My Favorites Strategy & Defense Shooter Upgrades Tower Defense Sports/Racing Zombie MMO More Categories Achievements Badges Recommended for Me Action Badges Rarest Badges Racing Badges Easiest Unearned Puzzle Badges Newest Badges All Badges Quests All Quests My Kong Trending with Friends Activity Feed g Register or sign in call to a to start receiving activity updates from around Kongregate! Forums Kongregate Game Forums General Gaming Technical Support Game Programming All Forums Dev Upload Your Game Kongregate is a community-driven browser games portal with an open platform for all web games. Get your games in front of thousands of users while monetizing through ads and virtual goods. Learn more » Visit our developers site » Learn more about our publishing program - we help game developers get their games out to millions of users on multiple platforms. Read Our Blog » We publish new content weekly, on game/data analysis, case studies, engineering solutions, and design insights. Access Documentation » Get everything you need to know about how to implement our APIs and SDKs into your game. see more results » {"url":"/search"} X Complete Initialization for 10 kreds 15% « Previous Next » Congratulations! You’ve completed your Kongregate account! Keep exploring Kongregate with more badges and games! Hide the progress bar forever? Yes No Forums → Game Programming → [AS3] Error 1061 (Solv
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 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 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 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 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. 2176Views 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 locate