SEARCH YOUR SOLUTION HERE  

1009 error after putting the preloader.



i've put simple preloader on frame 1.
since then i get an 1009 error message.
I debugged the file and it seems like it is referring to 'franklin_button'
but this is the button on the stage.
i've checked the instance name thousand times and it is correct name.

yet without the preloader, the whole thing works find without a problem.
I do not see where it should have gone wrong. Please help!

frame 1(preloader script)
stop();
this.loaderInfo.addEventListener(ProgressEvent.PRO GRESS,checkLoadProgress);
function checkLoadProgress(event:ProgressEvent):void {
var progressPercentComplete:Number=(event.bytesLoaded / event.bytesTotal)*100;
loaded_txt.text=String(Math.floor(progressPercentC omplete))+" %";
if (progressPercentComplete==100) {
this.loaderInfo.removeEventListener(ProgressEvent. PROGRESS,checkLoadProgress);
play();
}
}

frame 2(main script)
stop();

var franklin:franklin_descprtion = new franklin_descprtion();
var tour:tour_d = new tour_d();
var clock:clock_d = new clock_d();
var identity:identity_d = new identity_d();
var buio:buio_d = new buio_d();

this.franklin_button.addEventListener(MouseEvent.M OUSE_OVER, mouseOverHandler);
function mouseOverHandler(event:MouseEvent):void {
this.franklin.x=264.6;
this.franklin.y=36.6;
addChild(franklin);

}
this.franklin_button.addEventListener(MouseEvent.M OUSE_OUT, mouseOutHandler);
function mouseOutHandler(event:MouseEvent):void {
this.removeChild(franklin);
}

this.franklin_button.addEventListener(MouseEvent.M OUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var jscommand1:String="window.open('http://www.0303pm.net/motion/frank.mov','win','height=350,width=300,toolbar=no, scrollbars=yes');";
var url1:URLRequest=new URLRequest("javascript:"+jscommand1+" void(0);");
navigateToURL(url1, "_blank");
}

this.identity_button.addEventListener(MouseEvent.M OUSE_OVER, mouseOverHandler_1);
function mouseOverHandler_1(event:MouseEvent):void {
this.identity.x=196.9;
this.identity.y=91.6;
this.addChild(this.identity);

}

this.identity_button.addEventListener(MouseEvent.M OUSE_OUT, mouseOutHandler_1);
function mouseOutHandler_1(event:MouseEvent):void {
this.removeChild(this.identity);
}

this.identity_button.addEventListener(MouseEvent.M OUSE_DOWN, mouseDownHandler_1);
function mouseDownHandler_1(event:MouseEvent):void {
var jscommand1:String="window.open('http://www.0303pm.net/motion/identity.mov','win','height=350,width=300,toolbar= no,scrollbars=yes');";
var url1:URLRequest=new URLRequest("javascript:"+jscommand1+" void(0);");
navigateToURL(url1, "_blank");
}

this.buio_button.addEventListener(MouseEvent.MOUSE _OVER, mouseOverHandler_2);
function mouseOverHandler_2(event:MouseEvent):void {
this.buio.x=558.5;
this.buio.y=314.6;
this.addChild(this.buio);
}
this.buio_button.addEventListener(MouseEvent.MOUSE _OUT, mouseOutHandler_2);
function mouseOutHandler_2(event:MouseEvent):void {
this.removeChild(this.buio);
}

this.buio_button.addEventListener(MouseEvent.MOUSE _DOWN, mouseDownHandler_2);
function mouseDownHandler_2(event:MouseEvent):void {
var jscommand1:String="window.open('http://www.0303pm.net/motion/buio.avi','win','height=350,width=300,toolbar=no,s crollbars=yes');";
var url1:URLRequest=new URLRequest("javascript:"+jscommand1+" void(0);");
navigateToURL(url1, "_blank");

}



this.tour_button.addEventListener(MouseEvent.MOUSE _OVER, mouseOverHandler_3);
function mouseOverHandler_3(event:MouseEvent):void {

this.tour.x=212.5;
this.tour.y=359;
this.addChild(this.tour);

}


this.tour_button.addEventListener(MouseEvent.MOUSE _OUT, mouseOutHandler_3);
function mouseOutHandler_3(event:MouseEvent):void {
this.removeChild(this.tour);
}

this.tour_button.addEventListener(MouseEvent.MOUSE _DOWN, mouseDownHandler_3);
function mouseDownHandler_3(event:MouseEvent):void {
var jscommand:String="window.open('http://www.0303pm.net/motion/tour.avi','win','height=350,width=300,toolbar=no,s crollbars=yes');";
var url:URLRequest=new URLRequest("javascript:"+jscommand+" void(0);");
navigateToURL(url, "_blank");
}



this.clock_button.addEventListener(MouseEvent.MOUS E_OVER, mouseOverHandler_4);
function mouseOverHandler_4(event:MouseEvent):void {
this.clock.x=985.8;
this.clock.y=270.5;
addChild(this.clock);
}

this.clock_button.addEventListener(MouseEvent.MOUS E_OUT, mouseOutHandler_4);
function mouseOutHandler_4(event:MouseEvent):void {
this.removeChild(this.clock);
}



this.clock_button.addEventListener(MouseEvent.MOUS E_DOWN, mouseDownHandler_4);

function mouseDownHandler_4(event:MouseEvent):void {
var jscommand1:String="window.open('http://www.0303pm.net/motion/clock.mov','win','height=350,width=300,toolbar=no, scrollbars=yes');";
var url1:URLRequest=new URLRequest("javascript:"+jscommand1+" void(0);");
navigateToURL(url1, "_blank");
}


p.s. i also tried to seperate them on different scenes but this doesn't work either.

Posted On: Thursday 25th of October 2012 10:49:32 PM Total Views:  427
View Complete with Replies




Related Messages:

Between Errors 1009 and 1010   (183 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
1009 error   (196 Views)
I have just started action scripting......not doing very difficult stuff, just giving the navigation for an application.....got 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 { gotoAndPlay("findmycar"); } function onlocatedealerclick(e:MouseEvent):void { gotoAndPlay("locatedealer"); } function onmymazdaclick(e:MouseEvent):void { gotoAndPlay("mymazda"); } function onmaintenanceclick(e:MouseEvent):void { gotoAndPlay("maintenance"); } function onserviceclick(e:MouseEvent):void { gotoAndPlay("service"); } offers_btn.addEventListener(MouseEvent.CLICK,onoff ersclick); function onoffersclick(e:MouseEvent):void { gotoAndPlay("offers") } recall_btn.addEventListener(MouseEvent.CLICK,onrec allclick); function onrecallclick(e:MouseEvent):void { gotoAndPlay("recall") } The moment i am adding recall button during the end i am getting this error..please help me to sort out this.
stage.stageWidth & Height not working: 1009   (210 Views)
I've decided to start re-writing my project, but this time making the use of class files rather than nesting code inside my MovieClips. Now it's come to the "message box" that I previously wrote, and I'm having some troubles. (note: I don't really want to download a pre-built one as my message box class end up being the backbone for several custom interfaces). The problem is that I cannot, for the life of me, figure out why my message box class cannot access "stage.stageWidth", "stage.stageHeight", "MovieClip(root).currentWidth", etc. I'm rather hoping that someone will be able to shed some light on what I'm hoping is a novice error. (I'm very new to using class files.. as in.. this project new). This is the code for the working "messageBox.as": ActionScript Code: package com.components{ import flash.display.Shape; import flash.display.MovieClip; public class messageBox extends MovieClip { public function messageBox():void { drawBacking(); } public function drawBacking():void { var rectangle:Shape = new Shape ;// initializing the variable named rectangle rectangle.graphics.beginFill(0x000000); rectangle.graphics.drawRect(0, 0, 100, 100); rectangle.graphics.endFill(); rectangle.alpha=0.5; addChild(rectangle); } public function clear():void { var num:int = this.numChildren; for (var i:int=0; i
papervision3d typeerror error 1009   (207 Views)
, I have following error when using papervision3d, setting "mouse3D.enabled = true;" in Lines3D typeerror error 1009 cannot access a property or method of a null object reference at org.papervision3d.core.utils::Mouse3D/updatePosition() at org.papervision3d.core.utils::InteractiveSceneMana ger/handleEnterFrame() Anyone know how to fix the problem.
CS3 TypeError #1009 when using a preloader   (147 Views)
I keep getting the same error message ever since I tried adding a preloader. Everything seems to function properly, but obviously there's something wrong. Does anyone know how to fix this TypeError: Error #1009: Cannot access a property or method of a null object reference. at CaptainSUL_fla::MainTimeline/onProgress() heres my script: stop(); this.loaderInfo.addEventListener(ProgressEvent.PRO GRESS, onProgress); this.loaderInfo.addEventListener(Event.COMPLETE, onComplete); function onProgress(e:ProgressEvent):void { var loaded:Number = e.target.bytesLoaded; var total:Number = e.target.bytesTotal; var pct:Number = loaded/total; loader_mc.scaleX = pct; loaded_txt.text = "Loading..."+(Math.round(pct*100))+"%"; } function onComplete(e:Event):void { gotoAndStop("2"); }
Error 1009 Null object reference   (144 Views)
Guys, So I embed a graphic, [Embed(source = "../../../_site/graphics/pinksquare.png", mimeType="application/octet-stream")] public var pub_graph1:Class; and then I reference it to render it as a bitmap. var var_bmpImage:BitmapData = (new pub_graph1() as Bitmap).bitmapData; this is where the problem lies. I can trace pub_graph1() right before this line of code and it comes back [class achieve_pub_graph1] I can't figure out what is causing this error. Any Ideas
TypeError: Error #1009: Cannot access a property or method of a null object reference   (131 Views)
Just starting to delve into as3. I have made a flash website with four navigation buttons (home, products, about, contact). When user clicks on "products", an external movie clip is loaded and everything works fine. User clicks any button after that, and myLoader.unloadAndStop, the swf is removed when you navigate away from "products". However, if the "home", "about", or "contact" buttons are clicked first (before the external swf has been loaded), it of course, throws the 1009 error. I need some sort of if/else statement to check whether or not the external swf is loaded, remove it if it is, and if not, just navigate to the "page" clicked. buttons code: home_mc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler); home_mc.buttonMode = true; home_mc.useHandCursor = true; function fl_MouseClickHandler(event:MouseEvent):void { myLoader.unloadAndStop(); gotoAndStop("home"); } products_mc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler2); products_mc.buttonMode = true; products_mc.useHandCursor = true; function fl_MouseClickHandler2(event:MouseEvent):void { gotoAndStop("products"); } about_mc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler3); about_mc.buttonMode = true; about_mc.useHandCursor = true; function fl_MouseClickHandler3(event:MouseEvent):void { myLoader.unloadAndStop(); gotoAndStop("about"); } contact_mc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler4); contact_mc.buttonMode = true; contact_mc.useHandCursor = true; function fl_MouseClickHandler4(event:MouseEvent):void { myLoader.unloadAndStop(); gotoAndStop("contact"); } "products" code: var myLoader:Loader = new Loader(); var url:URLRequest = new URLRequest("newTees/newTees.swf"); myLoader.load(url); addChild(myLoader); myLoader.x = 262; myLoader.y = 150;
TypeError: Error #1009   (158 Views)
Hi - This error occurs whenever I return to a particular frame that contains the following AS... import fl.controls.UIScrollBar; my_text.addEventListener(Event.SCROLL,updateScroll Bar); function updateScrollBar(evt:Event):void{ my_scroll.update(); } var req:URLRequest = new URLRequest("external.txt"); var loader:URLLoader = new URLLoader(); function fileLoaded(event:Event):void { my_text.text = loader.data; } loader.addEventListener(Event.COMPLETE, fileLoaded); loader.load(req); This is the first frame of the movie that contains a dynamic text control that is loaded with the contents of an external text file. There is no problem when it first loads, the error occurs when I return to this frame from another one. I suspect the problem is with the addEventListener but I do not know how to handle this. Please help
Preloader pops TypeError: Error #1009:   (129 Views)
Hi to you all. I've made preloaders in the past, but now I'm getting this error, and I don't know what is exactly the problem. TypeError: Error #1009: Cannot access a property or method of a null object reference at com.mugui::Footer() If I erase all references of the footer from my Main Class the flash works normal. So the problem comes from my footer, but why. My main class: Code: public class MuguiMain extends MovieClip { private var contentHolder:Sprite = new Sprite; private var mainContent:MainContent = new MainContent(); private var footer:Footer = new Footer(); private var loader:Loader; private var swfContent:MovieClip; private var swfContentHolder:Sprite = new Sprite(); public function MuguiMain():void { this.addEventListener(Event.ENTER_FRAME, preload); } public function preload (e:Event):void { var total:Number = this.stage.loaderInfo.bytesTotal; var loaded:Number = this.stage.loaderInfo.bytesLoaded; loaderText.text = Math.floor((loaded/total)*100) + "%"; if(total == loaded) { gotoAndStop("ini"); this.removeEventListener(Event.ENTER_FRAME, preload); MuguiIni(); } } public function MuguiIni():void { addEventListener("clickCatalogo", clickCatalogo,false,0,true); addEventListener("clickClose", unLoadSwf,false,0,true); addEventListener("clickInicio", clickInicio,false,0,true); addEventListener("clickQuienes", clickQuienes,false,0,true); addChild(contentHolder); contentHolder.addChild(mainContent); contentHolder.addChild(footer); } My footer class: Code: public function Footer():void { this.x = 1000; this.y = 432; catalogoBtn.addEventListener(MouseEvent.CLICK, clickCatalogo,false,0,true); TweenMax.to(this,2,{x:523, ease:Expo.easeOut}); catalogoBtn.buttonMode = true; } public function clickCatalogo(e:MouseEvent):void { dispatchEvent(new Event("clickCatalogo",true)); } } } Hope anyone can spot the problem. Thank in advance for any hint on this issue. Greetings.
TypeError: #1009 Issues   (428 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 cote 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 alert.as: Code: package { import flash.display.MovieClip; import flash.display.*; import flash.events.*; 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 overlay.graphics.beginFill(0x929292); overlay.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight); overlay.graphics.endFill(); 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); box.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, mat); box.graphics.drawRoundRect(rectX,rectY,rectW,rectH,25,25); box.graphics.endFill(); //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.
Flash Error #1009: Cannot access a property or method of a null object reference.   (385 Views)
I dont understand these errors or how to fix them. Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Function/Levels/$construct/createLvl()[C:\Users\Owner\Desktop\Flash AS3\Platform Game\Classes\Levels.as:54] at Levels()[C:\Users\Owner\Desktop\Flash AS3\Platform Game\Classes\Levels.as:95] at DocumentClass()[C:\Users\Owner\Desktop\Flash AS3\Platform Game\Classes\DocumentClass.as:23] DocumentClass: Code: package { import flash.display.MovieClip; import flash.ui.Keyboard; import flash.events.KeyboardEvent; import flash.events.Event; import flash.utils.Timer; import flash.events.TimerEvent; import Classes.Levels public class DocumentClass extends MovieClip { public var gameTimer:Timer; private var LevelActionScript; public var character:Character; public function DocumentClass() { character = new Character(); addChild( character ); LevelActionScript = new Levels(); LevelActionScript.Levels(); /*gameTimer = new Timer(500); gameTimer.addEventListener( TimerEvent.TIMER, CharacterMovement ); gameTimer.start(); }*/ var leftKeyDown:Boolean = false; var upKeyDown:Boolean = false; var rightKeyDown:Boolean = false; var downKeyDown:Boolean = false; var mainSpeed:Number = 7; var mainJumping:Boolean = false; var jumpSpeedLimit:int = 15; var jumpSpeed:Number = jumpSpeedLimit; character .addEventListener(Event.ENTER_FRAME, moveChar); function moveChar(event:Event):void { if (leftKeyDown) { character.x -= mainSpeed; } if (rightKeyDown) { character.x += mainSpeed; } if (upKeyDown || mainJumping) { mainJump(); } } stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown); function checkKeysDown(event:KeyboardEvent):void { if (event.keyCode == 37 || event.keyCode == 65) { leftKeyDown = true; } if (event.keyCode == 38 || event.keyCode == 87) { upKeyDown = true; } if (event.keyCode == 39 || event.keyCode == 68) { rightKeyDown = true; } if (event.keyCode == 40 || event.keyCode == 83) { downKeyDown = true; } } stage.addEventListener(KeyboardEvent.KEY_UP, checkKeysUp); function checkKeysUp(event:KeyboardEvent):void { if (event.keyCode == 37 || event.keyCode == 65) { leftKeyDown = false; } if (event.keyCode == 38 || event.keyCode == 87) { upKeyDown = false; } if (event.keyCode == 39 || event.keyCode == 68) { rightKeyDown = false; } if (event.keyCode == 40 || event.keyCode == 83) { downKeyDown = false; } } function mainJump():void { if (! mainJumping) { mainJumping = true; jumpSpeed = jumpSpeedLimit * -1; character.y += jumpSpeed; } else { if (jumpSpeed < 0) { jumpSpeed *= 1 - jumpSpeedLimit / 75; if (jumpSpeed > - jumpSpeedLimit / 5) { jumpSpeed *= -1; } } if (jumpSpeed > 0 && jumpSpeed = stage.stageHeight - character .height) { mainJumping = false; character.y = stage.stageHeight - character.height; } } } } } } Levels: Code: package { import flash.display.Sprite; import flash.display.MovieClip; public class Levels extends MovieClip { public var character:Character; //LEVEL VARIABLES //the current lvl var lvlCurrent:int = 1; /*The key for the level arrays: 1: Regular Block X: Main Character */ //this variable will hold the character var X:String = 'MAIN'; //the array for level 1 var lvlArray1:Array = new Array( 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 ); public function Levels() { character = new Character(); //creating the level //this guy will hold all of the blocks var blockHolder:Sprite = new Sprite(); //then we add him to stage //current row that we are creating var row:int = 0; addChild(blockHolder); function createLvl():void { //getting the current level that we are on var lvlArray:Array = MovieClip(root)['lvlArray' + lvlCurrent]; //we have to find how far this level goes //this will be used so we know when to move to the next row //there will always be 16 rows, so this is how we find it out //of course, this will make the lvl formatting very strict var lvlColumns:int = Math.ceil(lvlArray.length / 16); //now we must create the level for (var i:int = 0; i
Flash Error #1009: Get On the....Stage!   (354 Views)
Greetings and Salutations Everyone! Can someone please help me resolve this issue I keep getting the same error("TypeError: Error #1009: Cannot access a property or method of a null object reference. at FullFla$iinit()") -I gather that I am attempting to call an object that is not presently on the stage, BUT I am unclear exactly what steps to take to correct it...Add a wrapper DisplayObject or do I change an the Event that I am listening for Please give me some guidance. I appreciate it immensely. package { import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.display.Sprite; import flash.display.MovieClip; import flash.display.Loader; import flash.net.URLRequest; import flash.events.MouseEvent; import flash.events.Event; public class FullFla extends Sprite { private var _loading:Loading; private var _navi:Navi; private var menuList:Array = ["home", "about", "work"]; private var _menus:Array = new Array(); private var _pages:Array = new Array(); private var _urlNo:uint = 0; private var _currentMenu:MovieClip; private var _currentPage:Sprite; public function FullFla() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; _loading = new Loading(); _navi = new Navi(); for (var i:int=0; i < menuList.length; i++) { var mc:MovieClip = _navi[menuList[i]]; _menus.push(mc); mc.redpoint.visible = false; } resizeHandler(); stage.addEventListener(Event.RESIZE, resizeHandler); addChild(_loading); addChild(_navi); loadSwf(); } private function loadSwf():void { var url:String = menuList[_urlNo] + ".swf"; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler); var req:URLRequest = new URLRequest(url); loader.load(req); } private function completeHandler(e:Event):void { _pages.push(e.target.content); if(_urlNo < menuList.length - 1 ) { _urlNo++; loadSwf(); } else { removeChild(_loading); _loading = null; startPage(); } } private function startPage():void { for (var i:int = 0; i < _menus.length; i++ ) { var mc:MovieClip = _menus[i]; mc.page = _pages[i]; mc.buttonMode = true; mc.addEventListener(MouseEvent.CLICK, clickHandler); } _currentMenu = _menus[0]; displayPage(); } private function displayPage():void { _currentMenu.redpoint.visible = true; _currentPage = _currentMenu.page; resizeHandler(); addChild(_currentPage); } private function clickHandler(e:MouseEvent): void { _currentMenu.redpoint.visible = false; removeChild(_currentPage); _currentMenu = e.target as MovieClip; displayPage(); } private function resizeHandler(e:Event = null):void { var w:Number = stage.stageWidth; var h:Number = stage.stageHeight; if (Boolean(_loading)) { _loading.x = w / 2; _loading.y = h / 2; } _navi.y = h; _navi.bar.width = w; _navi.logo.x = w - 10; if(Boolean(_currentPage)) { _currentPage.x = w / 2; _currentPage.y = h / 2; } } } } m
#1009: Cannot access... Sprite/Child... ???   (432 Views)
I have button is scroolbar. I can link it with: scrooll_mc.content_mc.five.addEventListener(MouseE vent.CLICK, clickFive); function clickFive(evtObj:MouseEvent){ trace("uz triju bt") gotoAndStop("antras"); } But the problem comes when I go to link of that button and come back it doesnt work. Flash gives an error: #1009: Cannot access a property or method of a null object reference. at bandymai_fla::MainTimeline/frame1() at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at bandymai_fla::scrollMkkkC_1() at flash.display::MovieClip/gotoAndStop() at bandymai_fla::MainTimeline/clickSection() Im a little lost now, maybe anybody can help with that
Error 1009 Problems   (370 Views)
, 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)
menu button with a TypeError: Error #1009   (445 Views)
Hi everybody, I'm working on a Flash CS4 presentation which has a menu page as well as a navigation bar (with a timer) that appears for 5 seconds and then disappears until the user moves the mouse again. The play and stop buttons are working fine but when I click on the menu button it takes me back to the menu page but then I get this Flash error message: TypeError: Error #1009: Cannot access a property or method of a null object reference. at ADAGIO_3_fla::MainTimeline/showmenu() TypeError: Error #1009: Cannot access a property or method of a null object reference. at ADAGIO_3_fla::MainTimeline/hidemenu() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.utils::Timer/tick() I don't know if it's an issue with the timer or something else that's missing. I posted the fla here if anyone can check it out. http://rapidshare.com/files/345010518/ADAGIO_3test.fla For now only the 3rd menu button is active until I'm finished.
TypeError: Error #1009: Cannot access a property or method of a null object reference   (395 Views)
I'm new to code, and here's my problem. Any advice "TypeError: Error #1009: Cannot access a property or method of a null object reference. at type_fla::whole_1/thumbUp()" Here's my code stop(); import caurina.transitions.*; var xOffset:Number; var xMin:Number = 0; var xMax:Number = sb.track.width - sb.thumb.width; sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown); stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp); function thumbDown(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove); xOffset = mouseX - sb.thumb.x; } function thumbUp(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove); } function thumbMove(e:MouseEvent):void { sb.thumb.x = mouseX - xOffset; if(sb.thumb.x = xMax) sb.thumb.x = xMax; var sp:Number = sb.thumb.x / xMax; Tweener.addTween(content, {x-sp*(content.width-masker.width)), time:1.5}); e.updateAfterEvent(); }
where to add Event.ADDED_TO_STAGE with error #1009   (425 Views)
. I have an error code #1009 and have been googling around and found a lot of links, yet I'm not sure where to put the Event.ADDED_TO_STAGE to make my project work. The error code is Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at be.boulevart.google.ajaxapi.translation::GoogleTranslation/onResponse() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() and my as3 code is: Code: package{ import flash.display.*; import flash.events.*; import gs.*; import fl.motion.easing.*; import framework.utils.LoadXML; import be.boulevart.google.ajaxapi.translation.*; import be.boulevart.google.ajaxapi.*; import be.boulevart.google.ajaxapi.search.* import be.boulevart.google.apicore.GoogleApiKeyStore; import be.boulevart.google.events.*; public dynamic class wotd_widget extends MovieClip{ //vars var loadXML:LoadXML = new LoadXML('http://wordsmith.org/awad/rss1.xml',onComplete); private var mc01:MovieClip; private var mclayout:MovieClip; //constructor public function wotd_widget():void{ trace('wotd'); init_btn(); } private function onComplete($xml:XML):void{ trace($xml.channel.item[0].title); trace($xml.channel.item[0].description); wotd_In.text = $xml.channel.item[0].title; des_In.text = $xml.channel.item[0].description; var gt:GoogleTranslation = new GoogleTranslation(); gt.translate($xml.channel.item[0].title,'en','de'); gt.addEventListener(GoogleApiEvent.TRANSLATION_RESULT,onTranslate); } private function onTranslate(e:GoogleApiEvent):void{ trans_In.text = e.data.result; } private function init_btn():void{ this.mc01 = new trans_btn; this.mc01.x = 340.9; this.mc01.y = 234.4; addChild(this.mc01); TweenMax.to(this.mc01,1,{x:340.9, y:234.4, ease:Cubic.easeOut,onComplete:onComplete1}); } private function onComplete1():void{ this.mc01.buttonMode = true; this.mc01.addEventListener(MouseEvent.ROLL_OVER,mEvent01); this.mc01.addEventListener(MouseEvent.ROLL_OUT,mEvent01); this.mc01.addEventListener(MouseEvent.CLICK,mEvent01); } function mEvent01(e:MouseEvent):void{ switch(e.type){ case 'rollOver': //this executes when you rollover the target TweenMax.to(MovieClip(e.target),0,{tint:0xFF75B6}); break; case 'rollOut': //this executes when you rolloff the target TweenMax.to(MovieClip(e.target),0,{removeTint:true}); break; case 'click': //this executes when you click the target onClick01(); break; } } private function onClick01():void{ var gt:GoogleTranslation = new GoogleTranslation(); gt.translate(input_trans.text,'en','de'); gt.addEventListener(GoogleApiEvent.TRANSLATION_RESULT,onTranslation); } function onTranslation(e:GoogleApiEvent):void{ trace(e.data.to); trace(e.data.orig); trace(e.data.from); trace(e.data.result); output_trans.text = e.data.result; } } } NEED YOUR HELP REALLY REALLY FAST!
Error #1009   (408 Views)
I am new to flash. I am experiencing random (at least to me) errors (#1009) while navigating through my tested file. I can't reproduce them everytime. It only happens sometimes. Usually they occur after I have clicked back and forth between different pages (frames). Sometimes the error shows up once, and the file moves on as if nothing bad has happened. Sometimes the error continuosly displays, which really slows down the test. One example of such: TypeError: Error #1009: Cannot access a property or method of a null object reference. at About28_fla::MainTimeline/clickResumeFromAbout() The general structure of my file is this: I have pages laid out on separate frames with movieclips embedded within each other on the frames. Navigational movieclip buttons remain on essentially every frame. Three of them are: 'About', 'Contact', and 'Resume'. I wrote Listeners for each frame that go from that frame to any of the others. For example, to get from my 'Resume' frame from the 'About' frame, I wrote a Listener called 'clickResumeFromAbout', which is what the above error refers to. The code in context: Code: mResumeGlow.addEventListener(MouseEvent.CLICK, clickResumeFromAbout); function clickResumeFromAbout(e:MouseEvent):void { mBoxAbout.gotoAndPlay(mBoxAbout.totalFrames-mBoxAbout.currentFrame); mBoxAbout.addEventListener(Event.ENTER_FRAME, enterResume); function enterResume(event:Event):void { if (mBoxAbout.currentFrame == 150){ mBoxAbout.stop(); mBoxAbout.removeEventListener(Event.ENTER_FRAME, enterResume); gotoAndStop("Resume"); } } } However, the error above occurs when I click 'Resume' from 'Contact' (not from 'About' as the error states). It only occurs after I've been flipping between frames for a bit (I'm assuming I've clicked 'About' at some point). I can't figure out if I'm referencing something at the wrong time or what. Any ideas
Help with Error #1009   (406 Views)
I've started to work with classes and i've come across this error: Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Ball$iinit() at bouncingBall_CS3_fla::MainTimeline/bouncingBall_CS3_fla::frame1() The following is my class: Code: package { import flash.display.MovieClip; import flash.events.*; import flash.display.*; public class Ball extends MovieClip { private var timer:uint = 0; private var initPos:Number = 0; private var initSpeed:Number = 0; private var tehground:MovieClip; private var myBall:MovieClip; private const decay:Number = .9; private const grav:Number = 32 / stage.frameRate; public function Ball(ground:MovieClip, ball:MovieClip):void { tehground = ground; myBall = ball; timer = 0; initPos = myBall.y; myBall.addEventListener(Event.ENTER_FRAME, fall); } private function fall(e:Event):void { timer += 1; checkGround(); myBall.y = initPos + .5 * grav *(timer * timer); } private function checkGround() { if (tehground.hitTestPoint(myBall.x, initPos + .5 * grav * (timer * timer)+1, true)) { myBall.removeEventListener(Event.ENTER_FRAME, fall) while (!tehground.hitTestPoint(myBall.x, myBall.y-1, true)) { myBall.y++; } initPos = myBall.y; timer = 0; initSpeed = decay * Math.sqrt(Math.abs(2 * (myBall.y - tehground.y))); myBall.addEventListener(Event.ENTER_FRAME, rise); } } private function rise(e:Event):void { timer += 1; myBall.y -= .5 * grav * (timer * timer) - initSpeed * timer; } } } And this is on the first frame of flash: Code: var myBall:Ball = new Ball(tehground, tehball); tehground and tehball are instance names of 2 different MovieClips.
Very Strange Issue with Error #1009   (467 Views)
I'm trying to load an external .swf using UILoader. If the .swf doesn't have any code, it loads fine. But if I add any code, even only comments. It gives me this error. Code: TypeError: Error #1009: Cannot access a property or method of a null object reference. at main_fla::MainTimeline/__setProp_BackgroundLoader_Scene1_BG_0() at main_fla::MainTimeline() TypeError: Error #1009: Cannot access a property or method of a null object reference. at main_fla::MainTimeline/LoadComplete() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() Here is my project. http://kritphong.co.cc/downloads/project.zip