TypeError: Error #1009 :(

I don't understand why I am getting this error....

package Classes {
public class HomePage extends Sprite {
public function HomePage():void

public function buildXML():void
var xml:XML =

public function buildLogo():void{
color.color = 0x000000;
LogoBg = drawSquare(200,150,0,0,color);
LogoBg.x = 200;
LogoBg.y = 200;

I have more functions but I am having trouble with nested classes.
Here is the code in the document class.

package Classes {
import Classes.HomePage;
private var c:Object = new HomePage();

public class BuildHome extends Sprite {

public function BuildHome():void


When I use the buildXML function in my constructor, everything works fine. but when I try to use buildLogo it gives me this error..

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Classes::HomePage/buildLogo()
at Classes::HomePage$iinit()
at Classes::BuildHome$iinit()

could it be addChild without a reference since I assume that this nested class couldn't access the stage Or something like that.. gurus help please


Posted On: Thursday 25th of October 2012 11:32:01 PM Total Views:  441
View Complete with Replies

Related Messages:

papervision3d typeerror error 1009   (256 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.
AS3 Image Map Linking Issue - No compiler errors   (262 Views)
, I've made an image map in Flash using AS3, however it does not seem to be working properly. The links only work in a strange succession. In order to click all the links you must first click the last link followed by the first link, then the second link. After that the image map behaves as it is supposed to. I'm not sure why this is happening. It complies without error and aside from the little quirk mentioned above, it works beautifully. I've checked and double checked the AS, even copied and pasted some code from one button to another to see if it would make a difference, but to no avail. I am using the code listed below: [codebox] button1.addEventListener(MouseEvent.CLICK, callLink1); function callLink1 (event: MouseEvent) :void { var url:String = (""); var request:URLRequest = new URLRequest (url); try { navigateToURL (request, "_parent"); } catch (e:Error) { trace ("Error occurred!"); } [/codebox] Any and all help would be much appreciated,
Need help with a 1119 error plz   (166 Views)
Description 1119:Access of possibly undefined property myLoader through a reference with static type flash.display.DisplayObjectContainer. Source this.parent.myLoader.load(new URLRequest( + ".swf")); I am pretty new to CS3 and i cant understand why i am getting this compiler error. The source is in a mc with buttons of the same name as the external swfs it loads. This mc is in my main Timeline. I cant get my main Timeline(menu) to load any external swf. I would really appreciate some advice on this problem if anyone can.
error message   (221 Views)
TypeError: Error #1009: Cannot access a property or method of a null object reference. at play_fla::MainTimeline/frame1() I am receiving this error message when my site loads. I have set up a simple flash button to go from frame 1 to frame 2. Frame 2 has a video on it and I am getting the above error message when the page loads. The url is Here is the code I have used to create the simple flash page. I am very new to AS3 so dont judge me forward_btn.addEventListener(MouseEvent.CLICK, moveForward); back_btn.addEventListener(MouseEvent.CLICK, moveBackward); function moveForward(e:MouseEvent):void { nextFrame(); //or gotoAndStop(2); } function moveBackward(e:MouseEvent):void { prevFrame(); //or gotoAndStop(1); }
1009 error after putting the preloader.   (534 Views)
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="'','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="'','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="'','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="'','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="'','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.
Runtime error with flex4, FDT or CS4   (293 Views)
Last resort, post the forum I use FDT with eclipse for almost every project i work on, I recently started to use it to compile also. When compiling i get a runtime error [Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert se.testsajt.components.preloader:reloader@1335c871 to aijaj.abstracts.component.AbstractComponent. Fault, This seems like Im just stupid and dont understand that I cant convert one class to another, but the thing is that Preloader extends AbstractComponent. So this really should work. I also tried to implement an interface for the components to use this for all the handling but that didnt work either. The weird stuff is that when compiling in the CS4 IDE it works just fine, but then when i open the output swf in latest flashplayer i get the same error as before. If someone has the same problem please help me.
using the same code without conflict error?   (187 Views)
in as 2.0, u could use the same code many times. i'm making a gallery, and i want to have many galleries. but when i copy my gallery code, it says "a conflict exists with definition" how can you make many galleries without this error my galleries codes are in different frames.
"fscommand("fullscreen","true");" error AS3   (200 Views)
, Is the fullscreen function the same for AS3 as it was AS2 Currently I have "fscommand("fullscreen","true");" in the first frame of my movie and it launches my projector into fullscreen mode, which is what I want. however, it also launches any subsequent movie I load from an external file using the getURL command into full screen as well. Any ideas
No compiler errors...nothing on stage!   (323 Views)
well i have this code as compiled class Code: package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import; public class Bouncing extends Sprite { private var ball:Ball; private var vx:Number; private var vy:Number; public function Bouncing(); { init(); } private function init():void { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; ball = new Ball(); ball.x = stage.stageWidth / 2; ball.y = stage.stageHeight / 2; vx = Math.random() * 10 - 5; vy = Math.random() * 10 - 5; addChild(ball); } } } and this sub-class Code: package { import flash.display.Sprite; public class Ball extends Sprite { public var radius:Number; private var color:uint; public function Ball(radius:Number = 20, color:uint = 0xFF0000) { this.radius = radius; this.color = color; init(); } public function init():void { graphics.beginFill(color); graphics.drawCircle(0, 0, radius); graphics.endFill(); } } } I get no complier errors , but the swf is empty(background color 0x000000). Can' t find the error which drives me crazy! Anyone experienced similar situation (always wanted to use yoda!)
ColorTransform onRollOut error   (206 Views)
I just started playing around with drawing things using action script, specifically with "ColorTransform". I am able to set one transform just fine, but when I attempt to use a second transform to reset the movie clip to it's original values I get an error. Can movie clips only have one ColorTransform, or is it because the movie clip is being generated through code Here is the code: Code: var targetX:Number var targetY:Number stage.addEventListener(MouseEvent.CLICK, onClick); function onClick(event:MouseEvent):void { targetX =; targetY =; if ((targetX + targetY) > 500) { makeRectangle(); } else { makeCircle(); } } function makeCircle():void { var shape1:MovieClip = new MovieClip();, 0x00ff00);;, targetY, 50);; addEventListener(MouseEvent.ROLL_OVER, colorT); addEventListener(MouseEvent.ROLL_OUT, colorReset); addChild(shape1); } function makeRectangle():void { var shape2:MovieClip = new MovieClip();, 0x33ff00);;, targetY, 50, 50); addEventListener(MouseEvent.ROLL_OVER, colorT); addEventListener(MouseEvent.ROLL_OUT, colorReset); addChild(shape2); } function colorT(event:MouseEvent):void { trace("rollover!"); var colorT:ColorTransform = new ColorTransform(); colorT.blueOffset = -100; colorT.redOffset = 100; = colorT; } function colorReset(event:MouseEvent):void { trace("rollout!"); var colorReset:ColorTransform = new ColorTransform(); colorReset.blueOffset = 100; colorReset.redOffset = -100; = colorReset; }
Button inside Movieclip error!!   (217 Views)
Hi i have designed a site where the user can move elements around the stage, and within some of these elements(movieclips) there are buttons insde them that link to various frame labels that are located on the main movieclips time line. The action to control the button is on the main movieclip time line and not within the element itself. These code used is: Code: paper2.webBttn.addEventListener(MouseEvent.CLICK, webButton); function webButton(e:MouseEvent):void { gotoAndPlay("web"); } the error i keep getting is: Code: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/setChildIndex() at FlashAS3Portfolio2_fla::holder_14/doDrag()
[help]as3 xml error   (342 Views)
So I'm playing around with xml and as3. Now I got this: Code: var fileList:XMLList = bookInput.Songs.file1; And now I want that if you push a button, file1 changes in file2. So I got this: Code: var j:uint=1; But when I change the first snipped in this: Code: var fileList:XMLList = bookInput.Songs.file+j; it gives this error: TypeError: Error #1034: Type Coercion failed: cannot convert "1" to XMLList. How to fix it
AS3, error 1119 - when class is same name as last folder in package.   (325 Views)
I have this strange error, I have a class defined like so: ------ Code: package net.guttershark.model { public class Model { private static var instance:Model; public var test:Boolean; public static function gi():Model { if(instance == null) instance = new Model(); return instance; } } } ------ It throws error 1119 any time I try to use it like so: trace(; The error: "1119: Access of possibly undefined property test through a reference with static type Model. Now when I simply rename the class to this: Code: package net.guttershark.model { public class Model2 { private static var instance:Model2; public var test:Boolean; public static function gi():Model2 { if(instance == null) instance = new Model2(); return instance; } } } I get no errors, and it works fine. Whey does the class name conflict with the last folder in the package structure And is there a way around this
setChildAt errors and troubles   (237 Views)
all, I'm trying to make a simple gallery with over lapping images, when clicked I trying to make the selected image change its index value to come to the front. I seem to be hitting a brick wall with ArgumentErrors and RangeErrors... This is my code Code: private function xmlLoadedHandler(event:Event):void { _xmlObject = new XML(; addChild(container); var i:uint = 0; for each(var image:XML in _xmlObject.image) { i = i + 1; var displayImage:ImageDisplay = new ImageDisplay(_xmlPath + image.@src); container.addChildAt(displayImage, 0); = "image" + i; trace(; displayImage.x = image.@x; displayImage.y = image.@y; displayImage.alpha = 0.5; displayImage.rotation = Math.random() * 15; displayImage.addEventListener(MouseEvent.CLICK, onMouseEventHandler); } trace("There are", container.numChildren, "images in this gallery!"); } private function onMouseEventHandler(event:MouseEvent):void {, container.numChildren - 1); //var circle:Sprite = Sprite(; //var topPosition:uint = container.numChildren - 1; //container.setChildIndex(circle, topPosition); //container.setChildIndex(container.getChildAt(1), 0); } I've tried a few different ways in the onMouseEventHandler function but so far turned up nothing.
"Type coercion error" when I'm not coercing types   (190 Views)
Here's an FLA of what I'm experiencing: 6135_help.fla I don't understand it at all. I have two different movieclips with the same name on different frames, and for some reason Flash is exploding. Please help me. I am so confused.
Kinda urgent question (code error = frozen flash :S), and then a URL question   (443 Views)
Code: import; import; navigateToURL(new URLRequest('',"_blank"); There is no autoRecovery u must save ur work often.
IE - JS error w/ addCallBack & call   (247 Views)
** sorry mods - could you move this to the AS2 section ... my mistake ** I've got a little color-picker swf that tells JS when a new color has been selected, and recieves a new color from JS. Everything works perfectly in FireFox, but throws "Object doesn't support this property or method" in IE 7. I've been all over the interweb and can't find any solutions that work.
removeChild errors   (237 Views)
I am trying to create a movie clip by using a button in Flash. The button's instance is cir_btn which creates a circle on the stage I am using an external .as file to generate the public class Cir which calls upon several mouse actions as well as referrence a movie clip in my library that contains a shape. The movie clip's name is circle and it has a linkage of circle I am able to repeatedly generate circles inside of the swf, however when I try to use the remove button, this is what I get: ReferenceError: Error #1065: Variable circ is not defined. at Cir/::removeCirc() Here is the code for my .as file: package { import flash.display.MovieClip; import; public class Cir extends MovieClip { var timeline:MovieClip; public function Cir(tl:MovieClip) { timeline=tl; timeline.cir_btn.addEventListener(MouseEvent.MOUSE _DOWN, onMouseDown); timeline.reset_btn.addEventListener(MouseEvent.MOU SE_DOWN, removeCirc); } public function onMouseDown( event:MouseEvent ):void { var circ:MovieClip = new circle; circ.x = 110; circ.y = 70; this.addChild(circ); } private function clicked(e:MouseEvent):void { removeEventListener(MouseEvent.CLICK,clicked); } private function removeCirc( event:MouseEvent ):void { parent.removeChild(circ); } } } Just to see if I was ever meeting the removeCirc function, I did both a trace and I changed the code from parent.removeChild(circ); to parent.removeChild(this); which does remove the circle from the stage, but I can't generate a new circle as long as I have the swf open. I am having a very hard time unlearning AS2 to learn AS3. Can any one help me out EXTRA CREDIT: I am also looking for a way to constrain the circle movie clip to a certain portion of the stage only. Some kind of bounds command so that the movie clip will only display in a rectangular area inside of the swf. This is not as important right now as figuring out how to remove the circle, but I will need to get to it eventually.
jpg into swf - loaded into 2nd swf - error!   (221 Views)
I've got a runtime jpg that I'm loading into a swf via loader.load() - works great. However, when this primary swf is loaded into a secondary swf - via a button (MouseEvent.CLICK) I get the following error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found. The primary swf is loaded into the secondary swf when the button is clicked - just with the error above and without the jpg. discussed above is occuring as I test project locally. Apparently, here is yet another concept in AS3 that I'm missing. Help is appreciated.
removeChild 2ce -> error   (170 Views)
I have a script which at some point MIGHT remove a child removeChild(obj[2]); At the end of script I need another script which has to remove the child if it is still present. I thought that if(obj[2]){ removeChild(obj[2]); } would do the trick. But even if it's removed in first part, then the second part still tries to remove it (it still sees obj[2] as TRUE) even though it already was removed from stage. Results in error ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. Am I doing something wrong here