Error 1009 Problems


I am currently devoloping my game and at run-time I get the error 1009..
This is just a test file but what im trying to do is there will be 2 buttons, a button to spawn some and a button to make them shoot.. When you click the spawn button once it will spawn a guy, you click it again and it will spawn him again but in a different spot.. that works fine, but what I need it to do is to make it so you can click on either guy, which selects him then you click shoot and he starts to shoot...

I spawn both, I click on the top one, then Click shoot.. he shoots, I click on the bottom one and try to shoot and I get the error: Error #1009: Cannot access a property or method of a null object reference.

If I do it vice versa I can get them both to shoot, I still get the errors but they are shooting..

The code is: Code: import com.cfreps.utils.GlobalVar; var RifleSquadNum:GlobalVar = new GlobalVar(); var RSquad1Select:GlobalVar = new GlobalVar(); var RSquad2Select:GlobalVar = new GlobalVar(); RifleButton.addEventListener(MouseEvent.MOUSE_DOWN, RifleHandler); function RifleHandler (e:MouseEvent) { RifleSquadNum.incData(1) if(RifleSquadNum.getVar() == 1) { var RifleSquad1:RifleSquad = new RifleSquad(); RifleSquad1.x = 450 RifleSquad1.y = 100 addChild(RifleSquad1); RifleSquad1.addEventListener(MouseEvent.MOUSE_DOWN, Rifle1Handler); function Rifle1Handler (e:MouseEvent) { if(RSquad1Select.getVar() == 0) { RSquad1Select.incData(1) } else if(RSquad1Select.getVar() == 1) { RSquad1Select.incData(0) } } } if(RifleSquadNum.getVar() == 2) { var RifleSquad2:RifleSquad = new RifleSquad(); RifleSquad2.x = 450 RifleSquad2.y = 150 addChild(RifleSquad2); RifleSquad2.addEventListener(MouseEvent.MOUSE_DOWN, Rifle2Handler); function Rifle2Handler (e:MouseEvent) { if(RSquad2Select.getVar() == 0) { RSquad2Select.incData(1) } else if(RSquad2Select.getVar() == 1) { RSquad2Select.incData(0) } } } ShootButton.addEventListener(MouseEvent.MOUSE_DOWN, ShootHandler); function ShootHandler (e:MouseEvent) { if(RSquad1Select.getVar() == 1) { RifleSquad1.gotoAndStop(2) } else if(RSquad2Select.getVar() == 1) { RifleSquad2.gotoAndStop(2) } } } The problem is at line 63 which is in the ShoootHandler function and is:
Code: RifleSquad1.gotoAndStop(2)

Posted On: Thursday 25th of October 2012 10:12:25 PM Total Views:  281
View Complete with Replies

Related Messages:

XML: error #1010? WHY?   (112 Views)
, i got a little problem with my script. I need to put a XML node into a variable. So i made this script after the XML is loaded: var actualnode:XML; var button:MovieClip = new MovieClip(); function LoadXML() { for each (var node:XML in MyXML.children()) { with (node) { button.XML = node; actualnode=button.XML; //trace(button.nodo.children)//
btnHandler 1120 error   (135 Views)
//add event listeners to our buttons myBtn.addEventListener (MouseEvent.CLICK, btnHandler); myBtn.addEventListener (MouseEvent.ROLL_OVER, btnHandler); myBtn.addEventListener (MouseEvent.ROLL_OUT, btnHandler); //add our buttons to our btnMenu array btnMenu.push(myBtn); my code keeps throwing 1120 error, zip file attached
Image loader class and IO errors - why do they happen and what can I do about them?   (116 Views)
I'm developer for a site that does a fair bit of image loading, using an ImageLoader class I developed. The various classes that call this class are set up to email me an error message when the ImageLoader has an IO error. My idea in setting this up was to alert me if somehow an image got corrupted or renamed and needed to be repaired. Typically the calling classes will run through an array of images needed for a page - maybe 5-10 or more - and start (basically) simultaneous image loads for all of them (in other words, not waiting for one image to load before starting the next). The calling class will run a test onEnterFrame to ensure all the images have loaded before proceeding with the next step in the script. Fairly often (maybe once every day or two) I get a flurry of IO error emails for a bunch of different images, all within the space of a second or so. This suggests that the webserver lost its mind for a moment and wasn't able to respond to the current set of file requests. Immediate subsequent testing shows no problems - the webserver came back right away. This occurrence is infrequent and is by far the exception - normally it all works fine. Any thoughts on why this happens Is this just "the way it goes" with webservers It's a shared hosting account on My next question is, any idea how I should handle it Should I tell the image requests to keep running until they get a positive response Or maybe run a certain number of times, or for a certain amount of time Or perhaps wait and then try after a certain pause Here's my image loader class, though not sure this is a specific code issue or more of a general process question... ActionScript Code: package src.imageProcessing { /****************************************** Import Statements ******************************************/ import flash.display.*; import flash.utils.*; import; import; import; import*; public class ImageLoader extends Sprite { private var theImageLoader:Loader = new Loader(); public var loadInitialized:Boolean; public var loadComplete:Boolean; private var theRequest:URLRequest; public var ioError:Boolean; public var loadedBytes:Number = 0; public var totalBytes:Number = 0; public var pctLoaded:Number = 0; public var slideNo:int; public var imageNo:int; public var floaterNo:int; public var itemHandle:String; /************************************** ** Constructor **************************************/ public function ImageLoader(fileName:String) { theRequest = new URLRequest(fileName); theImageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); theImageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,trackProgress); theImageLoader.contentLoaderInfo.addEventListener(Event.INIT, imageInitialized); theImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, theLoadComplete); } public function tryLoad():void { theImageLoader.load(theRequest); } public function fileNotFound():Boolean { if (ioError) { return true; } else { return false; } } public function getImage():Sprite { var image:Sprite = new Sprite(); image.addChild(theImageLoader.content); return image; } public function getSmoothedImage():Bitmap { var image:Bitmap = theImageLoader.content as Bitmap; image.smoothing = true; image.pixelSnapping = PixelSnapping.NEVER; return image; } private function trackProgress(evt:ProgressEvent):void { totalBytes = evt.bytesTotal; loadedBytes = evt.bytesLoaded; pctLoaded = (loadedBytes/totalBytes) * 100; } private function imageInitialized(e:Event):void {, imageInitialized); loadInitialized = true; dispatchEvent(new Event("initialized")); } private function theLoadComplete(e:Event):void {, theLoadComplete);,trackProgress); loadComplete = true; } private function ioErrorHandler(e:IOErrorEvent):void { ioError = true; dispatchEvent(new Event("ioError")); } } }
Problems with a 1069 error   (122 Views)
I've shortened the code samples below so that it's more readable. Here's the rub:I create a whole bunch of MovieClips containing the letters a-z. These MovieClips are children of a parent MovieClip called "levelTwo". When they're clicked, they send off some data to levelTwo for evaluation (It's Hangman). Problem is that on click I get a 1069 error. It WAS a 1061 error until I added the bit in LetterButton Here's the relevant code: LetterButton: Code: package { import flash.display.MovieClip; import; import; public class LetterButton extends MovieClip { var buttonText:String; public function LetterButton(lText:String,objX:int,objY:int) { trace ("Creating new button"); x = objX; y = objY; buttonText = lText; letterText.text = buttonText; this.stop(); addEventListener(MouseEvent.MOUSE_OVER,onMouseOver); addEventListener(MouseEvent.MOUSE_OUT,onMouseOut); this.addEventListener(MouseEvent.CLICK,onMouseClick); } private function onMouseOver(event:Event):void { gotoAndStop(2); letterText.text = buttonText; //trace ("You're over me and my text is " + buttonText); } private function onMouseOut(event:Event):void { gotoAndStop(1); letterText.text = buttonText; //trace ("You're out of me and my text is " + buttonText); } private function onMouseClick(event:Event):void { trace ("I am clicked and I am " + buttonText);; } } } And the relevant bit from levelTwo: Code: public function checkGuess(guess:String):void { //Check to see if the guess matches the string trace ("Guess: "+guess); for(var i:int=0;i
not sure how to fix this error: The Class "Ball" must subclass...   (177 Views)
So I am trying to create a document class for my program, and I know all the code is correct because I already have the program working. I am currently trying to rebuild the program, and I simply copy and pasted all the working code into my new program. I have 2 document classes, and when I run the program i get an error, and I don't know how to fix it. It says "The class 'ball' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type." I don't understand why it isn't working now, is there some setting that I need to turn on to get it to work I do have the line of code : import flash.display.MovieClip; Can anyone help Let me know if you need more information about my program.
away3D add/remove/add again error   (215 Views)
hi, i have one problem, and i've been searching a lot but can't find an answer with this, i hope you can help me... with an addChild i'm loading an external swf with away3D content, it loads without a problem, then i want to unload it, i've tryied with unload(); and removeChild, and it unload, until here, everything woks perfect... BUT.... when i try to load again the movie there's an error... Error #1009: No se puede acceder a una propiedad o a un mtodo de una referencia a un objeto nulo. at CUBE_fla::MainTimeline/MouseDown() this is the code to insert the movie, it is in a function with a listener a normal button... and the code to unload... ActionScript Code: var galeria3D = new Loader(); galeria3D.load(new URLRequest("CUBE.swf")); contSwfext.addChild(galeria3D); cubeTit.m9.addEventListener(MouseEvent.CLICK, cierraCub); function cierraCub (e:MouseEvent):void{ galeria3D.unload(); i think that the problem is not here, because i'm doing exactly the same with another swf movies and this is not happening... i think the problem is in CUBE.swf, cause it has a stage.addEventListener...then the movie tries to acced to the stage when it is not ready yet... but i don't know how to solve it... this is the code in CUBE that i think is causing the problem ActionScript Code: function MouseDown(event:MouseEvent):void{ lastPanAngle = camera.panAngle; lastTiltAngle = camera.tiltAngle; lastMouseX = stage.mouseX; lastMouseY = stage.mouseY; move = true; view.render(); } stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown); I tried adding a contentLoaderInfo but doesn't work, i mean it loads without problem, and unload... but same problem... loading again i have the same error... and the movie turns slow... this is the code anyway... ActionScript Code: var contenedor:MovieClip = new MovieClip(); var galeria3D:Loader = new Loader(); galeria3D.load(new URLRequest("CUBE.swf")); galeria3D.contentLoaderInfo.addEventListener(Event.COMPLETE, insertMovie); function insertMovie(evt:Event):void{ addChild(contenedor).name = "contenedor"; contenedor.addChild(galeria3D).name = "galeria3D"; } if you have any idea to solve it i'll appreciate that, i'm desperate, my actual solution is just to made an alpha when it is load but the solution is far away from being an elegant solution, and the movie runs kind of slow... Thank's for your attention...
Preloading error   (197 Views)
Hi , I am quite confident i am having no issue with my preloader codes and have managed to identify why i keep getting the Error #1009: Cannot access a property or method of a null object reference. My preloader.swf is loading a home.swf. Within this home.swf i have some codes that makes reference to the stage. EG stage.stageWidth/2 Once i deleted away this line of code there is no error. Is there anyway that i can still reference my stage in home.swf without getting Error #1009
AIR Comunnicaton error via HTTPS   (144 Views)
, I have Flash AIR application, that communicates with server via HTTPS protocol. On MAC I install requested certificate and it works fine, but unfortunently on Windows 7 and XP I have this error: "[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032" errorID=2032]" I aasume its something wrong with system configuration, but anyone know how to fix this
AIR Unload SWF error   (211 Views)
I'm writing an Android app and I have a loader that brings in an external swf. I want to create an event so that when the back button is pressed it unloads the swf. But I can's seem to get it to work. Any ideas Code: private function jumptest (event:TouchEvent):void{ var infoloader:Loader = new Loader(); var infoURL:URLRequest=new URLRequest("MapInspectorGW.swf"); infoloader.contentLoaderInfo.addEventListener(Event.COMPLETE, infoDone); infoloader.load(infoURL); NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, infoBack); } private function infoDone (loadEvent:Event) { addChild(loadEvent.currentTarget.content); } private function infoBack (event:KeyboardEvent):void { if (event.keyCode == Keyboard.BACK) { infoloader.unload(); } }
URLLoader() ioError and Stream error on first call...   (140 Views)
When my PNG encoded data is sent to my uploader php file its throwing an error the very first time and only after I havent done it in a while... half an hour maybe... it says this: Code: Error opening URL '' Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: Then when I press the button a second time it goes through fine. If I close and re-test the movie its fine ... the only way to reproduce it is to wait a while and try it for the first time. Any clues whats causing this
How to terminate a Flash application upon unforeseen errors?   (155 Views)
How to terminate a Flash application upon unforeseen errors Dear all, I am writing up an app that must not be allowed to shut down the users system under any circumstances, thus I need to learn how I can terminate my app. What tools are there to do this So, Is there a basic way to have a global error sniff that somehow determines that the app needs to be terminated and thus prevents affecting other processes that are running PLS advice Jaxz
error when live, local fine. urgent   (130 Views)
hi , I've got an AS3 FP10 project compiling in FlashBuilder4. It's an Away3D project absed around a *.dae file. It runs perfectly locally in the release/debug roots and runs fine if I move the release to a network drive etc but when I upload all the release files I get this error: Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: at I'm assuming this means that the *.dae file cannot me found, but it does exist at the specified location 'assets/maya/world.dae' help... please... Rich
cs5, fp9. Vector3d and Matrix3d error   (235 Views)
Hi! I've made a form with TLFTextfield but now I've been told flash player version has to be 10.1.22 tops. So, as I'm using CS5 and I don't know how to roll back de publisher version I've tried to compile it in fp9. This causes TLFTextfields to go back to classic Textfields, no big problem. But as I compile I get: 1046: Type was not found or was not a compile-time constant: Matrix3D. 1046: Type was not found or was not a compile-time constant: Vector3D. The funny thing is I don't explicitely use any of these classes and I don't know where does this come from. I use comboboxes, inputs, checkboxes, buttons and some movieclips. It would help if someone knew how to get rid of these errors or, even better, how to compile with an older subversion of fp10
Timer error :(   (182 Views)
i made timer for my game, and code is var countDownIncLvl2:Number=1; var totalSecsLvl2 = 60; var countDownSecsLvl2 = totalSecsLvl2; counterLvl2.text=countDownSecsLvl2; var timeLvl2:Timer = new Timer(countDownIncLvl2*1000); time.addEventListener(TimerEvent.TIMER,tickLvl2); function tickLvl2(e:TimerEvent):void { if (countDownSecsLvl2 == 0){ trace("count down complete"); time.stop(); countDownSecsLvl2 = totalSecsLvl2;gotoAndPlay(1);} else { countDownSecsLvl2= countDownSecsLvl2-countDownIncLvl2; counterLvl2.text=countDownSecsLvl2; } } if(time.running == true) { trace("alredy running"); } else { counterLvl2.text=totalSecsLvl2; time.start(); } but it keeps showing me error in output as: TypeError: Error #1009: Cannot access a property or method of a null object reference. at proba1_fla::MainTimeline/tickLvl2() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() please somebody help
error: 1010 help   (209 Views)
Hi all, I have one of those pesky TypeError: Error #1010: A term is undefined and has no properties - errors... I know what 2 lines are causing it, but the lines from what i can tell are coded properly... First, I set a variable to a string inside of a for loop Code: var buttonName:String = "btn"+i; then later, i basically call each button and position it like so: Code: mc_name.otherMc_name[buttonName].x = 15; mc_name.otherMc_name[buttonName].y = 1000; basically I'm targeting the instance name btn1, btn2, btn3 in the for loop and positioning them But the 2 lines above that use the square brackets are causing the error 1010 - if i swap out the string/instance name in [brackets] and hard code the actual button instance name like so: Code: mc_name.otherMc_name.btn1.x = 15; that particular button not only positions itself fine but the error goes away.. when i use the brackets everything works as it should, but i get the pesky error. Why would something that far as i can tell is coded correctly throw an error If it were looking for an instance name that didn't exist could that cause the issue (so in an array it starts counting from 0, and i have 20 buttons, so i should actually be counting to 19, not 20... and if the code is looking for the 20th button instance name could that cause the issue) any help is appreciated! just trying to be a clean coder here
help w/ error   (209 Views)
can someone explain this error to me Code: 1061: Call to a possibly undefined method getRealNum through a reference with static type exam:XaMLDiplomat. the code is here: Code: private function recordSelection(e:ResponseEvent):void { var qnum:Number = myDiplomat.getRealNum(currentQ); var resp:String = e.letter; var ans:String = myDiplomat.getAnswer(qnum); myRecords.newResponse(qnum, resp, ans); //trace("number:"+qnum+" response:"+resp+" ans:"+ans); mySkipper.setAnswered(currentQ); myTab.showProgress((mySkipper.answerCount())/(myDiplomat.getQCount())); } and specifically this line seems to be the culprit. Code: var qnum:Number = myDiplomat.getRealNum(currentQ);
Please help with my Text draw error.   (198 Views)
all, I have a bunch of text that I have drawn onto the screen via the draw function. I have the format of that text set via textFormat: Code: var myFormat:TextFormat = new TextFormat(); myFormat.size = 21; myFormat.font = "Arial"; mTextField.setTextFormat(myFormat); Now, the first time that this text draws itself, it works fine. But, when I try to update the htmltext in the textfield, it draws itself in a format that isn't the one I set. I'm certain that the textformat isn't changed by anything. I'm wondering if flash draws text in the last textFormat that is created, not as the textfield is set. Can anyone confirm this Or, could you provide any input
syntax error   (248 Views)
I have an old AS2 application that I am updating to AS3. When I run the application I get an error 1087: Syntax error: extra characters found after end of program. It refers to Frame 21, line 1 and the source sited in the compile out box window is: on (release) { But when I go to Frame 21, line 1, I don't see any on(release) functions if I search the action script for that frame there are no on (release) { functions. If I double click the error it usually takes me to the spot in the code where the error is located but it doesn't do that either. So what is this error telling me How do I find the on (release) { function it's complaining about
swf error only the first time   (123 Views)
I have a main.swf that contains 3 swfs (one.swf, two.swf, three.swf). If I go to three.swf , it gives an error (TypeError: Error #1009). However, if I go to two.swf and return to three.swf, it works. I don't know why Thank you
class error - must subclass   (123 Views)
I've made a movie clip with buttons in it called 'myContent'. I want each button to reference a different video in the video player on the main stage. This movie clip is linked to a scrollpane, since there is not enough real-estate. I right clicked on the myContent movie clip in the library and chose 'export for actionscript' under properties. then used the script: scrollPane.source=myContent; scrollPane.setSize(205, 500); to get the scroll bar to work. When I add the script in the myContent movie clip to reference the different videos I get a few errors: 1152: A conflict exists with inherited definition in namespace public. 5000: The class 'fl.controls.ScrollBar' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type. It seems I must tell the scroll bar to look in a subclass When I get rid of the script telling it to load the videos, the scroll bar works and I get no errors, but when I put in the script to load the videos, its a major malfunction. Any ideas would be much appreciated.