As3 Error 1180 Addframescript
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 AS3 - Error #1180: Call to a possibly undefined method kill. up vote 0 down vote favorite This one is driving me crazy for a couple hours. I try to call a method kill(); (in function takeDamage()) which is in the same class, yet it won't find it. package classes.ship { imports ... public class Ship extends MovieClip { var speed:Number; var shootLimiter:Number; public static var health:Number; public static var maxHealth:Number; public function initialize() { var stageReff:Stage = this.stage as Stage; stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown); stage.addEventListener(KeyboardEvent.KEY_UP, reportKeyUp); stage.addEventListener("enterFrame", move); } //code public static function takeDamage(d):void { health -= d; if(health <= 0) { health = 0; kill(); } Main.healthMeter.bar.scaleX = health/maxHealth; } public function kill():void { var boom = new Explosion(); stage.addChild(boom); boom.x = this.x; boom.y = this.y; this.visible = false; //Main.gameOver(); } //code } } Has it to do with var stageReff:Stage = this.stage as Stage; ? Thanks in advance. actionscript-3 share|improve this question asked Jan 3 '12 at 21:16 Robbe Van Winckel 1602514 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote kill() is an instance method, but takeDamage is a static class method. You can't call instance methods from a static class method. You can only call instance methods when you have an instance reference to call it on. share|improve this answer answered Jan 3 '12 at 21:18 meddlingwithfire 1,417612 I feel so stupid right now, but how do I make an instance of the method? It's probably so easy, but I just can't find it. –Robbe Van Winckel Jan 3 '12 at 21:38 1 @RobbeVanWinckel You can't make an instance of a method. The problem is that takeDamage() is a method that belongs to the class Ship itself (NOT to an object of type Ship!). Judging from the rest of your code, you might want to just remove the "static" keyword from both takeDamage() and the health variable - they seem to belo
using your existing account on the new forums, check out this thread. Register Help Remember Me? Forum Today's Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links View Forum Leaders What's New? Advanced Search Forum Flash Flash IDE 1180: possibly undefined method Results 1 to 5 of 5 Thread: 1180: possibly undefined method Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode April 14th, 2009,04:19 PM #1 mrwizzer View Profile View Forum Posts 66 posts Registered User 1180: possibly undefined method I'm trying to use the AS3 version of Adobe's new Flash Media Server 3.5 http://stackoverflow.com/questions/8718729/as3-error-1180-call-to-a-possibly-undefined-method-kill bandwidth detection, using their documentation, (flashmediaserver_dev_guide). The BW detection works fine (runs a bandwidth check and displays the bandwidth in a trace statement), but that only seems to work if the flash file that accompanies the .as file is left completely blank/empty. As soon as I try to put in even the simplest actionscript, (stop() for example), I get an error message that says "1180: Call to a possibly undefined method addFrameScript." and a similar one https://www.kirupa.com/forum/showthread.php?324515-1180-possibly-undefined-method for the stop() method. Do I need to, in the .as class file, extend a class other than the Sprite class that's listed in the documentation? Any light you can shed would be appreciated. Reply With Quote April 14th, 2009,05:29 PM #2 senocular View Profile View Forum Posts 18,736 posts Semi-present Those are MovieClip methods that it looks like you're trying to use on a Sprite. Make sure your class instance is a MovieClip or extends MovieClip Reply With Quote April 14th, 2009,06:01 PM #3 Krilnon View Profile View Forum Posts Visit Homepage 10,065 posts ≈ ≠ = off topic: ------------------------- Originally Posted by senocular Make sure your class instance is a MovieClip or extends MovieClip There is a lame joke (or something) that could be made here involving is and how you could have left off the last 3 words of your sentence. And yes, I realize that you were just being clear, etc. etc., but I was oddly compelled to make this post. Reply With Quote May 21st, 2010,04:18 AM #4 adBuryD View Profile View Forum Posts 181 posts Registered User hello guys, I am posting in this *post* as i have a similar problem but not related to cs4 or 5 but cs3. I had read that sprites are movieclips with timelines so unless you need to go beyond frame one y
package classes.ship { imports ...[code]..... Has it to do with var stageReff:Stage = this.stage as Stage; ? View 2 Replies http://flash.bigresource.com/actionscript-3-Error-1180-Call-to-a-possibly-undefined-method--fJajhtEOm.html Similar Posts: ActionScript 3.0 :: 1180: Call To A Possibly Undefined Method Error For DEFINED Method Nov 19, 2010 I am getting this error: 1180: Call to a possibly undefined method http://kechengpuzi.com/q/s3116541/a/1 startWorld.but the method startWorld is defined as you can see in attachment. View 4 Replies ActionScript 3.0 :: Error #1180: Call To A Possibly Undefined Method? Feb 4, 2008 I get as3 error this error message a lot and I normally know how to resolve them. However, not this one! I call a function from within a class function (and the called function is within the class .as file.) My question is: does Actionscript allow you to call a function within a function cuz it sure appears not!My code: looks like thisActionScript Code:package asdata{//
addFrameScript in as3 package { import flash.display.Sprite; import flash.utils.*; public class SetTimeoutExample extends Sprite { private var delay:Number = 1000; // delay before calling myDelayedFunction public function SetTimeoutExample() { var intervalId:uint = setTimeout(myDelayedFunction, delay,stopTime); } public function myDelayedFunction():void { if(arguments[0] ==fk.playheadTime) {fk.pause();} } } }//this is my document class named SetTimeoutExample.as import flash.net.URLLoader; import fl.video.*; import flash.utils.getTimer; import flash.events.Event; fk.autoPlay = false; var myLoaderInfo=new Object(); myLoaderInfo.myParamsLoaded = false; myLoaderInfo.loaderComplete = loaderComplete; this.loaderInfo.addEventListener(Event.COMPLETE, myLoaderInfo.loaderComplete); myLoaderInfo.useParams = useParams; var myParams:Object = new Object(); var myParamsLoaded:Object = new Object(); function loaderComplete(myEvent:Event) { this.myParams = this.loaderInfo.parameters; this.myParamsLoaded = true;//Parametrelerin yuklendigine emin olduk. this.useParams(); fk.play(src); } var src:String; var startTime:Number; var stopTime:Number; function useParams() { var obj:Object = new Object(); var j; for (j in this.myParams) { if (j == "url") { src = this.myParams[j]; } else if (j=="bas") { startTime = int(this.myParams[j]); } else { stopTime = int(this.myParams[j]); } } } fk.addEventListener(VideoEvent.READY, bitti); function bitti(eventObject:VideoEvent):void { fk.seekSeconds(startTime); } //this is my player.fla hi,i get this 1180 error in as3.how can i solve this?i google it but i can't apply the solutions to my my code.i'm really new to as3.thanks for any help.
Myk | 2010-06-25 Do you have any timeline code? AddFrameScript() is the method that gets called to allow timeline code to execute. I've seen that error myself. Just make sure you don't have any code on the timeline in any of your assets and that should go away. SUPPORT US 扫一扫关注微信公众号 课程铺子, 可能是个更懂你的课程搜索引擎。 © 2016 课程铺子 kechengpuzi@gmail.com 课程铺子上线274天 课程铺子,每天陪你进步一点 冀ICP备16011938号-2