1009 error

I have just started action scripting......not doing very difficult stuff, just giving the navigation for an stuck and getting this error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at aug_19_2011_03_fla::MainTimeline/frame139()
at flash.display::MovieClip/gotoAndPlay()
at aug_19_2011_03_fla::MainTimeline/onloginclick()

here is the entire code

findmycar_btn.addEventListener(MouseEvent.CLICK,onf indmycarclick);
locatedealer_btn.addEventListener(MouseEvent.CLICK ,onlocatedealerclick);
mymazda_btn.addEventListener(MouseEvent.CLICK,onmy mazdaclick);
maintenance_btn.addEventListener(MouseEvent.CLICK, onmaintenanceclick);
service_btn.addEventListener(MouseEvent.CLICK,onse rviceclick);

function onfindmycarclick(e:MouseEvent):void

function onlocatedealerclick(e:MouseEvent):void

function onmymazdaclick(e:MouseEvent):void

function onmaintenanceclick(e:MouseEvent):void

function onserviceclick(e:MouseEvent):void

offers_btn.addEventListener(MouseEvent.CLICK,onoff ersclick);

function onoffersclick(e:MouseEvent):void

recall_btn.addEventListener(MouseEvent.CLICK,onrec allclick);

function onrecallclick(e:MouseEvent):void

The moment i am adding recall button during the end i am getting this error..please help me to sort out this.

Posted On: Friday 19th of October 2012 03:23:54 AM Total Views:  213
View Complete with Replies

Related Messages:

error #1009   (102 Views)
Any ideas TypeError: Error #1009: Cannot access a property or method of a null object reference. at jumpingjack_fla::MainTimeline/frame1()[jumpingjack_fla.MainTimeline::frame1:4] Debug session terminated. Code: import fl.ik.*; var body : IKArmature = IKManager.getArmatureAt(0); var leftHand : IKBone = body.getBoneByName("LeftHand"); var leftHandJoint :IKJoint = leftHand.tailJoint; var moveLeft : IKMover = new IKMover(leftHandJoint, leftHandJoint.position); if(leftHandJoint.position.y != 86) { leftHandJoint.position.y = 86; } else if(leftHandJoint.position.y == 86) { leftHandJoint.position.y = 100; }
Error #1009 Function with ceveral if statements won't run completely   (101 Views)
, Starting to learn actionscript bit by bit. But im running into a problem i can't solve atm. Does anyone have a clue what the solution is a fla CS3 document with labels and dropzones assignment. Place 10 labels on dropzones in de correct order. I've created a function to check if the labels are on the right dropzones. But the function ( private function controle ():void) runs only the first two if then else constructions. When proceeding to the third i get and error namely; TypeError: Error #1009: Cannot access a property or method of a null object reference. at lijstcompleet/controle() at lijstcompleet/checkTarget() the file is the document class. is a seperate class. I did not post the class because of the length. This is the function causing the problem. private function controle ():void { if(Vlabel1.hitTestObject(getChildByName("inst_drop zone0"))) { getChildByName("inst_thumbsup0").alpha = 100; getChildByName("inst_thumbsdown0").alpha = 0; trace ("controle juist1") } else { getChildByName("inst_thumbsdown0").alpha = 100; getChildByName("inst_thumbsup0").alpha = 0; trace ("controle fout1") } if(Vlabel2.hitTestObject(getChildByName("inst_drop zone1"))) { getChildByName("inst_thumbsup1").alpha = 100; getChildByName("inst_thumbsdown1").alpha = 0; trace ("controle juist2") } else { getChildByName("inst_thumbsdown1").alpha = 100; getChildByName("inst_thumbsup1").alpha = 0; trace ("controle fout2") } if(Vlabel3.hitTestObject(getChildByName("inst_drop zone2"))) { getChildByName("inst_thumbsup2").alpha = 100; getChildByName("inst_thumbsdown2").alpha = 0; trace ("controle juist3") } else { getChildByName("inst_thumbsdown2").alpha = 100; getChildByName("inst_thumbsup2").alpha = 0; trace ("controle fout3") } if(Vlabel4.hitTestObject(getChildByName("inst_drop zone3"))) { getChildByName("inst_thumbsup3").alpha = 100; getChildByName("inst_thumbsdown3").alpha = 0; trace ("controle juist4") } else { getChildByName("inst_thumbsdown3").alpha = 100; getChildByName("inst_thumbsup3").alpha = 0; trace ("controle fout4") } } For more info PM me or see the attached documents. Help would be much appreciated. * i know some things could be done with less code kind regards mephisto102
code error 1009. Not sure how to fix. noobie here.   (137 Views)
i am having trouble with two codes i have inside my project. to give as many details i can, i have a labels layers home, threeD, art, digitalArt, and pcCaseMod. i have an actions layer below the labels layer. then below that my content layer with all my content. this code is on the actions layer under home: stop(); // Start Main Nav function openLabel(event:MouseEvent):void { switch (event.currentTarget) { case home_btn : gotoAndStop("home"); this is on key 1 break; case threeD_btn : gotoAndStop("threeD"); this is on key 20 break; case art_btn : gotoAndStop("art"); this is on key 40 break; case digitalArt_btn : gotoAndStop("digitalArt"); this is on key 60 break; case pcCaseMod_btn : gotoAndStop("pcCaseMod"); this is on key 80 break; } } home_btn.addEventListener(MouseEvent.CLICK, openLabel); threeD_btn.addEventListener(MouseEvent.CLICK, openLabel); art_btn.addEventListener(MouseEvent.CLICK, openLabel); digitalArt_btn.addEventListener(MouseEvent.CLICK, openLabel); pcCaseMod_btn.addEventListener(MouseEvent.CLICK, openLabel); // End Main Nav on the actions "threeD" key , i have this code to do a page flip within that section: i did remove the stop(); to see if that cuased it and it was not the problem. stop(); import fl.transitions.Tween; import fl.transitions.easing.Strong; import fl.transitions.TweenEvent; container.sidea.flip.addEventListener(MouseEvent.C LICK,onflip); container.sideb.flip.addEventListener(MouseEvent.C LICK,onflip); addEventListener(Event.ENTER_FRAME,loop); var isStill:Boolean=true; var arraytween:Array = new Array(); function onflip(e:Event) { if (isStill) { arraytween.push(new Tween(container,'rotationY',Strong.easeOut,contain er.rotationY,container.rotationY+180,1,true)); arraytween[0].addEventListener(TweenEvent.MOTION_FINISH,reset); isStill=false; } } function reset(e:Event) { isStill=true; arraytween=[]; } function loop(e:Event) { if (container.rotationY>=90 && container.rotationY=360) { container.rotationY=0; } } when i debug the movie,i clicked on the threeD button, then the art button. after the click on the art button this message pops up: Error #1009: Cannot access a property or method of a null object reference. at threeD/loop()[threeD::frame20:30] the line i wrote in green is were the error is stemming. im really new to this.
Help to workaround Error#1009   (80 Views)
, I'm working on a PowerPoint-like animation. It starts with a .swf that acts as my stage and external .swf are subsequently loaded via "NEXT" buttons. My "NEXT" buttons are located inside the various external files (namely page01.swf, page03.swf, page06.swf, page09.swf, etc.) I have a problem with the buttons when I placed the code to load the next .swf file in the .swf containing the button itself. [Example: I am in page01.swf which carries the button with instance name "next_btn01". In the AS, the mouseclick event would trigger a load of "page02.swf", together with removeChild().] But the problem is that I cannot advance to page03.swf without getting an "Error#1009: Cannot access a property or method of a null object reference. I understand this Error#1009 to be caused by an event listener on my stage in the ActionScript for page02.swf, according to . The thing is I don't very much understand what is being explained except that the line addChild() has to be added before the eventListener(). Can somebody tell me exactly where I should move the line addChild() to Or is there any way to work around having to have an event listener on the stage in page02.swf Lastly, can anyone tell me, just by looking at the codes, whether the external .swfs are being removed/unloaded This is because I have a "REPLAY" button at the last .swf but it only plays the last frame of each .swf during the reply instead. ActionScript for page00.swf (which acts as my Stage) PHP Code: stop();varpage:MovieClip;varloader:Loader=newLoader();vardefaultPage:URLRequest=newURLRequest("page01.swf");loader.load(defaultPage);addChild(loader);//BtnsUniversalFunctionfunctionbtnClick(event:MouseEvent):void{ removeChild(loader); varnewPageRequest:URLRequest=newURLRequest(".swf"); loader.load(newPageRequest); addChild(loader);} ActionScript for page01.swf PHP Code: stop();varloader:Loader=newLoader();next_btn01.addEventListener(MouseEvent.CLICK,btnClick);functionbtnClick(myevent:MouseEvent):void{ addChild(loader); varnewPageRequest:URLRequest=newURLRequest("page02.swf"); loader.load(newPageRequest); removeChild(loader);} ActionScript for page02.swf: PHP Code: stop();varmyBoundaries:Rectangle=newRectangle(431,409,0.1,-15);varloader:Loader=newLoader();MGAswitch.addEventListener(MouseEvent.MOUSE_DOWN,dragSwitch);functiondragSwitch(event:MouseEvent):void{ MGAswitch.startDrag(false,myBoundaries);}stage.addEventListener(MouseEvent.MOUSE_UP,dropSwitch);functiondropSwitch(event:MouseEvent):void{ MGAswitch.stopDrag(); if((MGAswitch.hitTestObject(targetArea))){ varnewPageRequest:URLRequest=newURLRequest("page03_test.swf"); loader.load(newPageRequest); addChild(loader); }}targetArea.addEventListener(Event.ENTER_FRAME,hitTest);functionhitTest(yourEvent:Event):void{ if((MGAswitch.hitTestObject(targetArea))){ //trace("success"); MGA_on.alpha=1; }else{ //trace("fail"); MGA_on.alpha=0; }}loader.addEventListener(MouseEvent.CLICK,unloadcontent);functionunloadcontent(myevent:MouseEvent):void{removeChild(loader);}
1009 Error in very basic game   (198 Views)
Hi . I'm currently making the basic groundwork to a game. On my main timeline I have two frames. The first frame has the 'start screen' let me say, which actually is a little different to the norm in that you can move your character across the screen and activate thinkg to pop up like instructions, so kind of making agame of your standard first screen if that makes sense, like the opening to the game Braid. I have it so that when the character touches (hitTestObject) a square the frame goes to (gotoAndStop) frame 2, and then on frame 2 the actual game will start. The error is this: TypeError: Error #1009: Cannot access a property or method of a null object reference. at gameBasis_fla::MainTimeline/startGame() It shows on the output panel for my three functions - one function is for keypresses, the other for an enter_frame popup animation and the other is the function which takes the game from frame 1 to frame 2. Any ideas Here's my code just incase you need it. I've explained this shockingly badly, any questions just ask! ActionScript Code: function fadeOutF(evt:Event):void{ if (characterBoy_mc.hitTestObject(house_mc)){ fadingOut = false; if(!fadingIn){ fadingIn = true; var fadeIn:Tween = new Tween(house_mc.fadeText_mc, "alpha", Strong.easeOut, 0, 1, 3, true); } } else { fadingIn = false; if(!fadingOut){ fadingOut = true; var fadeOut:Tween = new Tween(house_mc.fadeText_mc, "alpha", Strong.easeOut, 1, 0, 3, true); } } } function startGame(evt:Event):void{ if(characterBoy_mc.hitTestObject(invisiEnter_mc)){ gotoAndStop(2); } } house_mc.fadeText_mc.addEventListener(Event.ENTER_FRAME, fadeOutF); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyIsDown); stage.addEventListener(Event.ENTER_FRAME, startGame); , First of all, The error means that an object you use in the function doesn't have a value in it. this is a null object reference. Now it is the trick to find out which object it is. To test this you can use trace(). at the beginning of each of your functions you can put trace(value) to test if the object exists. if this returns anything else then null or undefined, the object shouldn't be null. When you have found the value that is null, the next step is, of course, making sure it is initialised before the function is called... I hope this helps, good luck! , Firstly, try to use the tags to post code, much easier to read. That 1009 error means one of the objects you are referencing in startGame is not set at the time of the call. I don't do any timeline coding, so I am not 100% sure what is happening here. Does the function fadeOut work If so, it might be a problem with invisiEnter_mc not being found at run-time. Double check that it is declared properly
error 1009 | already read all stickies   (165 Views)
heyo all! i'm making a mega simple navigation; nonetheless, it's outputting: " TypeError: Error #1009: Cannot access a property or method of a null object reference. at foundation_fla::MainTimeline/frame1()[foundation_fla.MainTimeline::frame1:3] " the brief code i wrote was: stop(); view_btn.addEventListener(MouseEvent.CLICK, goView); function goView(e:MouseEvent):void { gotoAndStop("view"); }
Help with this Error #1009   (83 Views)
I'm familiar with Error #1009: Cannot access a property or method of a null object reference. but in this case I'm baffled about how to fix my code so that it still does what I need it to do while not producing the error. Here's my very simplified example. I use "addBtn" button to put a movie clip "mc" on the stage (from the library), and a "deleteBtn" to delete mc. Also, with addBtn I start a timer that iterates a var called counter. mc has some code that looks at counter on the parent and executes a trace statement when counter hits 30. I use an ENTER_FRAME event for mc to listen constantly to the value of counter. So the code looks like this: stage/root: PHP Code: varcounter:int;vartimer:Timer=newTimer(100);timer.addEventListener(TimerEvent.TIMER,iterateCounter);functioniterateCounter(event:TimerEvent):void{ counter++; counterField.text=counter.toString();}varmc=newMC;//addChild(mc);addBtn.addEventListener(MouseEvent.CLICK,addMC);functionaddMC(event:MouseEvent):void{ addChild(mc); timer.start();}deleteBtn.addEventListener(MouseEvent.CLICK,deleteMC);functiondeleteMC(event:MouseEvent):void{ removeChild(mc); timer.stop();} mc has this code: PHP Code: addEventListener(Event.ENTER_FRAME,mc_listen);functionmc_listen(event:Event):void{ if({ trace("counterhit30");}} Coded this way, I get the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at MC/mc_listen() The error pops up repeatedly, I assume as a result of the ENTER_FRAME listener perpetrator. Also, the error shows up immediately, not waiting for addBtn to be clicked. I am able to add mc just fine if I get rid of the buttons and just do an addChild(mc) (by uncommenting the line that's commented out). But the problem is NOT with the removeChild(mc), which was my initial assumption, because I can comment out the removeChild(mc) and still get the error. So what's going on, and what do I need to change I assume the offending functionality is but I don't understand what the problem is, or why it's a problem when I'm using the buttons, but not when I get rid of the buttons and just do the addChild(mc). One more thing: The program still works while the error is firing repeatedly -- I get the trace. I don't really understand that either....
Please PLease help [TypeError: Error #1009: null object reference]   (124 Views)
I am making an OOP scroll bar. I have three classes 1. ScrollBox This class contains the scroll bar and a container that hold the images to be scrolled. 2. Scroll Bar This class controls the scrolling of the bar and dispatches a scrollbar event containing the percentage to which the thumb bar is moved. 3. ScrollBarEvent class. This class simply fires an event with the event object containing the percentage of the scroll bar scrolling. Now Everything was running fine when it was on the stage but as I moved the code in classes it give a TYPE ERROR 1009 saying it cant access a property or method of null object reference. The error comes when I create an object of scroll bar inside the scroll box class. I am pasting the code for the classes below. SCROLL BAR Class Code: package { import flash.display.*; import*; public class ScrollBar extends MovieClip { private var xOffset:Number; private var xMin:Number; private var xMax:Number; public function ScrollBar():void { xMin = 0; xMax = track.width - thumb.width; thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown); track.addEventListener(MouseEvent.MOUSE_DOWN, trackDown); stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp); } public function trackDown(e:MouseEvent):void { //stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove); //yOffset = mouseY - thumb.y; thumb.x = mouseX ; if (thumb.x = xMax) { thumb.x = xMax; } dispatchEvent (new ScrollBarEvent(thumb.x / xMax)); } private function thumbDown(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove); xOffset = mouseX - thumb.x; } private function thumbUp(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove); } private function thumbMove(e:MouseEvent):void { thumb.x = mouseX - xOffset; if (thumb.x = xMax) { thumb.x = xMax; } dispatchEvent (new ScrollBarEvent(thumb.x / xMax)); e.updateAfterEvent(); } }//end of class }// End of package ScrollBox Class Code: package { import flash.display.*; import*; import caurina.transitions.*; public class ScrollBox extends MovieClip { private var scrollBar:ScrollBar; private var masker:Masker; private var content:Content; public function ScrollBox():void { scrollBar = new ScrollBar(); scrollBar.x = 100; scrollBar.y = 50; addChild(scrollBar); scrollBar.addEventListener(ScrollBarEvent.VALUE_CHANGED, sbChange); } public function sbChange(e:ScrollBarEvent):void { Tweener.addTween(content, {x:(-e.scrollPercent*(content.width - masker.width)), time:1}); } }//end of class }// End of package Scroll bar movie clip is in the library and contains two movieclips one with instance name thumb and another one with name track. Can anyone please help I have really given up on this now
Avoiding Error #1009 when loading external swf   (96 Views)
, I've often encountered this error when loading one swf into another, especially when loading papervision pv3d examples, and finally figured out why: when the loaded swf refers to stage anywhere in its startup sequence stage does not exist until that swf has been added to the stage... The solution was to move startup code to a function and test for availability of stage... Code: public function Main() { if (stage == null) { addEventListener(Event.ADDED_TO_STAGE, startup); } else { startup(); } } private function startup(event : Event = null) : void { stage.scaleMode = StageScaleMode.NO_SCALE; init3D(); createCube(); stage.quality = StageQuality.LOW; this.addEventListener(Event.ENTER_FRAME, loop); } Hope this helps someone.
TypeError: Error #1009   (145 Views)
, my first every project I've made an mp3 player and implemented an equalizer that syncs to beat. However when executed it works, but I get this error and any attempt to fix it fails. I can get rid of the erro, but then the EQ bars stop working... Anyway here is a sample of the code as I know this is the area of the problem. Code: addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { // ANIMATED EQ BARS CODE eqLeft1.gotoAndStop (Math.round(my_channel.leftPeak * 9) ); // 10 is the amount of frames in our EQbar clips eqRight1.gotoAndStop (Math.round(my_channel.rightPeak * 11) ); // 10 is the amount of frames in our EQbar clips eqLeft2.gotoAndStop (Math.round(my_channel.leftPeak * 16) ); // 10 is the amount of frames in our EQbar clips And the error ... Quote: TypeError: Error #1009: Cannot access a property or method of a null object reference. at mp3_fla::MainTimeline/onEnterFrame()[mp3_fla.MainTimeline::frame1:94]
Error #1009   (167 Views)
So i'm very new to flash. Like extremely new. I'm working on a project and am getting that error#1009 message over and over again. Here is the code please help me ActionScript Code: stop(); button_1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_1); function fl_MouseOverHandler_1(event:MouseEvent):void { Door12_open.visible = true; } button_1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_1); function fl_MouseOutHandler_1(event:MouseEvent):void { Door12_open.visible = false; } button_1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_2); function fl_MouseOverHandler_2(event:MouseEvent):void { Door12_close.visible = false; } button_1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_2); function fl_MouseOutHandler_2(event:MouseEvent):void { Door12_close.visible = true; } button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame); function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void { gotoAndPlay(25); } the instance names of the movie clips are correct but I have no clue what I'm doing. Thank you in advanced , trace all of the instance names at the top of the script.
Error 1009 help   (148 Views)
I need help with an 1009 that i can't solve by myself. If you could help i would be very happy. I have a main class, where i define the array enemies and a class, where the problem is. The probelm when debugging is in the pointed line: ActionScript Code: public function targetNearby(e:Event) { >>for (var v:int = MovieClip(parent).enemies.length - 1; v >= 0 ; v--) { if (this.x + 250 > MovieClip(parent).enemies[v].x) { targetnearby = true; } else { targetnearby = false; } } } This makes me think it is because of enemies.length being null, but that is impossible in that situation... Any ideas
TypeError: Error #1009?   (160 Views)
Alright so I'm working on making a skill calculator for this a game. This one I am working on right now has multiple skill calculators in a single flash file, but for some reason that I can't figure out, the skill calculator won't actually calculate. Here is a pastebin length to the AS code Alright, I apoligize for its length, but I really have no idea what I'm doing wrong with this one. Here is the output: Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at allInOneCalc_fla::MainTimeline/changeCalc() at at at fl.controls::ComboBox/onListChange() at at at fl.controls::SelectableList/handleCellRendererClick() I get that error the second I select a calc and it goes to that frame, and when I input all the information it gives me a "0 and whatever text I had it add" for the answer. Please help, I've been stuck on this for a while. EDIT: I Believe I did the wrong type of event for lines 22, 25 but I'm still not sure with what type of event I should use. Any advice is greatly appreciated
error 1009 problem   (158 Views)
i am new to flash and have no idea how to get around this problem. (i am using as3) I have added a gotoAndStop function on a symbol to take me back to frame 1 When i run the movie and click on this button i get this error TypeError: Error #1009: Cannot access a property or method of a null object reference. at housedesign1_fla::MainTimeline/frame1() at flash.display::MovieClip/gotoAndStop() at housedesign1_fla::MainTimeline/gohome() I have tried looking through forums to see if anything can help but i still don't have an idea about why this error is occuring. I have a few frames in between frame with function and the destination frame which have a symbol with a similar function. I copied the symbol and changed the instance name in each frame. This is the code for the function home_btn.addEventListener(MouseEvent.CLICK,gohome) ; function gohome(evt:MouseEvent): void { gotoAndStop(1); } I also get the error from the code i used to make text appear and disappear. The error occurs when i click on box1. Here is the code for this. txt1.visible=false box1.addEventListener(MouseEvent.MOUSE_OVER, showtxt); box1.addEventListener(MouseEvent.MOUSE_OUT, hidetxt); function showtxt(evt:MouseEvent): void { txt1.visible=true; } function hidetxt(evt:MouseEvent): void { txt1.visible=false; } box1.addEventListener(MouseEvent.CLICK, solarpage); function solarpage(evt:MouseEvent): void { gotoAndStop(16); } I get the same type of error for this too TypeError: Error #1009: Cannot access a property or method of a null object reference. at housedesign1_fla::MainTimeline/hidetxt() This is my guess as to where the error may be but im not sure. These two errors are not related to each other. If this code is of no use then i will put other parts up. I tried to attach the file but the file size was too big.
TypeError: #1009 Issues   (175 Views)
Okay. I'm trying to make a popup alert modal window thing with an external class. I have a simple swf set up with just some random sample text, a rectangle, and a button (just so I can tell if it's working or not). What I want to happen is for the "alert" class to initialize upon startup of the swf and then when I click the button (instance: btn), the alert will show up. If I get rid of all AS in the swf and set alert as the document class, it shows up just fine, so I think it should be working, but for some reason I get this instead when I try the button function: TypeError: Error #1009: Cannot access a property or method of a null object reference. at alert$cinit() at global$init() at alertTester_fla::MainTimeline/frame1() Here's the code in my alertTester swf: Code: import alert; alert.msgAlert = "This is me testing stuff out."; btn.addEventListener(MouseEvent.CLICK, displayAlert); function displayAlert(e:MouseEvent):void { alert.showAlert(); } And here's the code in Code: package { import flash.display.MovieClip; import flash.display.*; import*; import flashx.textLayout.formats.Float; import flash.text.TextField; import flash.geom.Matrix; import flash.text.*; public class alert extends MovieClip { private static var stage:Stage = null; private static var bkgd:Sprite; private static var msgBox:Sprite; private static var msg:TextField; public static var msgAlert:String = "Test."; //for alert box itself public static var rectW:int = 200; public static var rectH:int = 150; private static var rectX:Number = (stage.stageWidth/2) - (rectW/2); private static var rectY:Number = (stage.stageHeight/2) - (rectH/2); public function alert() { addEventListener(Event.ADDED_TO_STAGE, added); } private function added(event:Event):void { init(stage); } private function init(stageRef:Stage):void { stage = stageRef; trace("Initialized!"); } public static function showAlert():void { if (stage == null) { trace("Alert class has not been initialized!"); return; } //initialize bkgd = new Sprite(); msgBox = new MovieClip(); msg = new TextField(); //assign content bkgd = createBkgd(); msgBox = createBox(); msgText(msgAlert); //add children msgBox.addChild(msg); bkgd.addChild(msgBox); stage.addChild(bkgd); } private static function createBkgd() : Sprite { //setup/initialize var overlay:Sprite = new Sprite(); //make rectangle/cover stage;,0,stage.stageWidth,stage.stageHeight);; overlay.alpha = .85; //return return overlay; } private static function createBox() : Sprite { //setup/initialize necessary variables var box:Sprite = new Sprite(); var colors:Array = new Array(0xFFFFFF, 0xE1E1E1); var alphas:Array = new Array(1, 1); var ratios:Array = new Array(0,125); var mat:Matrix = new Matrix(); //make rectangle/alert box mat.createGradientBox(rectW,rectH,(Math.PI/2),rectX,rectY);, colors, alphas, ratios, mat);,rectY,rectW,rectH,25,25);; //return return box; } private static function msgText(alertMsg:String):void { //create formatter and font var myFormat:TextFormat = new TextFormat(); var myFont = new Font(); //format formatter myFormat.size = 14; myFormat.align = TextFormatAlign.CENTER; myFormat.font = "Arial"; //declare and assign message variable var msgWords:String = alertMsg; //set text field properties msg.autoSize = TextFieldAutoSize.CENTER; msg.defaultTextFormat = myFormat; msg.background = false; msg.border = false; msg.selectable = false; msg.type = TextFieldType.DYNAMIC; msg.textColor = 0x000000; msg.antiAliasType = AntiAliasType.ADVANCED; msg.embedFonts = true; msg.text = msgWords; //set position msg.x = rectX + rectW/2 - msg.width/2; msg.y = rectY + rectH/5; } } } I originally had the "init" function as a public static function so I could do "alert.init(stage);" from the swf, but it gave me this same error.
Flashgame TypeError: Error #1009 AND howto stoptimer   (223 Views)
, i'm making my first flash game but Ive run into some problems. Is there anyone here that can help Here is the game: Everytime I reach the next level I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Game_fla::MainTimeline/movecircle() I also want the timer to stop counting when I die or finnish. I've tried Code: if (platforms.currentFrame == platforms.totalFrames -1) { timer.stop(); } which didn't work.
CS4: Error #1009   (146 Views)
I'm making an interactive video in Flash for a class. I'm having trouble when importing more than one video. Whenever I do, I get this error (Error #1099): Cannot access a property or method of a null object reference. This error occurs in Scene 3 specifically. I have tried re-importing the video, but that didn't fix it. Below is the ActionScript I'm attempting to use. ActionScript 3.0: Scene 1: stop(); /*tell both buttons to listen for a click and if there is a click, to perform a specific function*/ myPlayButton.addEventListener(MouseEvent.CLICK, StartMovie); myStopButton.addEventListener(MouseEvent.CLICK, StopMovie); mySkipButton.addEventListener(MouseEvent.CLICK, SkipMovie); //start the movie function StartMovie(evt:MouseEvent):void {; } //stop the movie function StopMovie(evt:MouseEvent):void { forestIntro.stop(); } //skip the movie function SkipMovie(evt:MouseEvent):void { gotoAndPlay(1,"Scene 2"); } Scene 2: stop(); myForestButton.addEventListener(MouseEvent.CLICK, SkipMovie2); function SkipMovie2(evt:MouseEvent):void { gotoAndPlay(1,"Scene 3"); } Scene 3: stop(); /*tell both buttons to listen for a click and if there is a click, to perform a specific function*/ myPlayButton2.addEventListener(MouseEvent.CLICK, StartMovie2); myStopButton2.addEventListener(MouseEvent.CLICK, StopMovie2); mySkipButton2.addEventListener(MouseEvent.CLICK, SkipMovie3); //start the movie function StartMovie2(evt:MouseEvent):void {; } stop the movie function StopMovie2(evt:MouseEvent):void { forestIntro2.stop(); } //skip the movie function SkipMovie3(evt:MouseEvent):void { gotoAndPlay(1,"Scene 4"); }
Error 1009 at MethodInfo-6   (215 Views)
So I'm making a game and I keep getting this error; TypeError: Error #1009: Cannot access a property or method of a null object reference. at MethodInfo-6() And I'm really not sure why. Or what MethodInfo 6 is. If anyone would mind taking a look at what I have/have any ideas or advice I'd appreciate it forever! I uploaded the file here; this! Muchas Gracias!
1009 Error, for no noticeable reason   (200 Views)
I am a complete rookie when it comes to flash, but I have coded in many programming languages before this. The reason why I am so totally confused as to why this error is occurring, is simply because I didn't change any code to get this error. I was messing around with a glow filter, I test my game and BOOM. The infamous 1009 error apears when I test my little game. =[ I even pressed Ctrl + Z a million times to get back to a state where I knew my project worked, but I still get the same error. I get an output error of: "TypeError: Error #1009: Cannot access a property or method of a null object reference. at DocumentMain/enterFrameHandler()" Can anyone think of any quick fixes Thank you very much for any help. =] Here's my code - pastebin(D O T)com(S L A S H)DfN3h8ye
Between Errors 1009 and 1010   (209 Views)
Obviously I have not assigned correct instances hence the errors though I spent hours reading the relevant posts. The problem seems to be that I don't know how to define the instance "shut" of close_btn inside the instance "popup1" of 01_mc_master. The line giving the error 1009 is: popup1.shut.close_btn.addEventListener(MouseEvent. CLICK, closebuttClick); and the 1010: popup1.close_btn.addEventListener(MouseEvent.CLICK , closebuttClick); Thank you for directing me here. Maciek