1009: when referencing stage.stagewidth from the child

I was hoping you could help me out my hair is getting grey.

I have a main.swf and a slider.swf. I load the slider.swf into main.swf.

In my slider.swf I have this code which adds an image to the stage from the Library:
Code: var photo1_mc:photo1 =new photo1; addChild(photo1_mc); photo1_mc.x=stage.stageWidth/2;

The code works fine when compiling slider.swf, but when loading the slider.swf into the main.swf I receive TypeError: Error #1009: Cannot access a property or method of a null object reference.

I assume it has to do with the stage.stageWidth. Is there a another way to reference the stage.

If I load the the image externally via a loader I can use the stage.stage Width.


Posted On: Thursday 3rd of January 2013 10:22:15 PM Total Views:  3795
View Complete with Replies

Related Messages:

accessing property of child of a display object   (578 Views)
i need some help to understand how to access a property of a child of a DisplayObject. within a class i have an object with the variable name: btnLMain i have assigned it a name property: = "btnLMain"; btnLMain also has a property: btnLMain.clickNum = 0; // thats the one i need to access when i instantiate the class (btnL) containing this code in the parent class i need to access the property "clickNum" so i did this: var dispObj:DisplayObject = btnL.getChildByName(btnLMain); displayObj.clickNum++; but then i get the error: 1119: Access of possibly undefined property clickNum through a reference with static type flash.display:DisplayObject. so then i reviewed documentation and from what i understand i am not able to access the property of the child of the DisplayObject as it is a static property... please correct me if i'm wrong. so now i am trying to figure out how to access that property in the child Class. do you have any advice for me
Can't remove all loaded children in a gallery because can't close() a loader!   (489 Views)
0 down vote favorite This is the code i used in a gallery that loads images sequentally. My problems comes in when you have to open a different image album and have to eliminate all the previously loaded children in the movieclip. The problem is that sometimes the user leaves the album page before ALL the pics laod so when they click on a new album to open it a new image is placed somewhere else cause the loader has already been launched. I've tryd to close() the loader but it doesn't seem to work. I'd appreciate it inmensly if you can give me a hand.
TypeError: #1009 Issues   (498 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 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.
The supplied DisplayObject must be a child of the caller.   (496 Views)
What does it mean And why doesnt my code work PHP Code: stop();;varTimerApple:Timer=newTimer(500);TimerApple.addEventListener(TimerEvent.TIMER,OnStartApple);TimerApple.start();functionOnStartApple(e:Event){ varaf:Sprite=newEnemy(); af.x=Math.random()*640; addChild(af); //Removefromstage,willgivepoint af.addEventListener(Event.ENTER_FRAME,hitTheGround) functionhitTheGround(e:Event):void { if(af.hitTestObject(Basket)){ removeChild(af); } } //Controllingbasket Basket.addEventListener(MouseEvent.MOUSE_DOWN,fl_ClickToDrag_2); functionfl_ClickToDrag_2(event:MouseEvent):void { Basket.startDrag(); } } And then the class "Enemy" PHP Code: package{; importflash.display.MovieClip; importflash.display.Sprite; importflash.text.TextField; publicclassAppleextendsSprite{ privatevarcore:Object; publicfunctionApple(){ addEventListener(Event.ADDED_TO_STAGE,onadd); } privatefunctiononadd(e:Event){ core=MovieClip(root); addEventListener(Event.ENTER_FRAME,loop); } privatefunctionloop(e:Event){ y+=10; } publicfunctionremoveListeners():void{ removeEventListener(Event.ENTER_FRAME,loop); } }}
Flash Replacing array and removing previous children   (472 Views)
all. I have a problem with replacing values in an array. I have this code that takes the string values out of an XML file: Code: publicfunction loadXML(xml:Event):void { container = new XML(; var aantalSommen:Number = container.somTotaal.length() -1; var randomSom:Number = Math.round(Math.random()*aantalSommen); uitkomstGetal = container.somTotaal.uitkomst.text()[randomSom]; trace("Uitkomst getal: "+uitkomstGetal) deSom = container.somTotaal.som.text()[randomSom]; trace("De som: "+deSom) Ballen = container.somTotaal.andereGetallen.text()[randomSom] +","+ container.somTotaal.uitkomst.text()[randomSom]; trace("Extra ballen: "+Ballen)getallenRij = Ballen.split(","); And then this code inside a function which adds a new child (tijdelijkeBal) for every string in the array: Code: for each (var buttonArray:String in getallenRij){ tijdelijkeBal = new Getal((String)(buttonArray)); tijdelijkeBal.x = Math.random() * stage.stageWidth; tijdelijkeBal.y = Math.random() * stage.stageHeight; addChild(tijdelijkeBal); tijdelijkeBal.mouseChildren = false; ballenRij.push(tijdelijkeBal); } And I have this in my constructor function: Code: lader.addEventListener(Event.COMPLETE, loadXML); lader.load(new URLRequest("sommen/plus.xml")); So far so good. Every time I reload my application, it takes a random set of 5 strings from the XML and it adds the 5 children. What I want to do is reload the XML so that the previous added childred are replaced with new ones when I execute another lader.load(new URLRequest("sommen/plus.xml")); Right now it's so that whenever I load a new URLRequest for the XML file it just adds new children and leaves the previous ones there. I tried doing removeChild(tijdelijkeBal); but that just removes one child. I think the last one in the array in fact. I hope this made sense.
Targeting mc children only   (481 Views)
Hi everybody, i want to target all the mc nested in a parent mc and I'm using this script Code: for (var i:uint = 0; i
Flash Error #1009: Cannot access a property or method of a null object reference.   (471 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\] at Levels()[C:\Users\Owner\Desktop\Flash AS3\Platform Game\Classes\] at DocumentClass()[C:\Users\Owner\Desktop\Flash AS3\Platform Game\Classes\] DocumentClass: Code: package { import flash.display.MovieClip; import flash.ui.Keyboard; import; import; import flash.utils.Timer; import; 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
Flex form layout - add first child vertically aligned with label   (505 Views)
Hi all.. In flex form layout the output will be horizontal 'test' But my constraint is i want to align the textbox(first child of the form item ) vertically with the label. How can i do this Any inputs invited
Same base class for two different child classes in different swfs   (596 Views)
, Following is my code of base class : Code: public class Application extends Sprite { private static var instance:Application; public function Application() { instance = this; } private function showBlurLayer(flag:Boolean):void { //some code here... } public static function showBlurLayer(flag:Boolean):void { instance.showBlurLayer(flag); } } swfA ==> Document class Code: public function SWFA extends Application { //FLV player code goes here... } swfB ==> Document class Code: public function SWFB extends Application { public function SWFB() { addEventListener("addedToStage", addedToStageHandler); } private function addedToStageHandler(e:Event):void { Application.showBlurLayer(true); var media:Media = new Media() addChild(media); } } SWFB ==> Media class Code: public class Media extends Sprite { public function Media() { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener("complete", completeHandler); var closeBtn:Button = new Button(); closeBtn.label = "Close"; closeBtn.addEventListener("click", closeClickHandler); addChild(closeBtn); } private function closeClickHandler(e:MouseEvent):void { Application.showBlurLayer(false); this.visible = false; } private function completeHandler(e:Event):void { addChild(loader); } } --------------------------------------- So the problem here is when I call Application.showBlurLayer(true), it works fine (actually it applies blur filter). But after the swfA is loaded correctly, and when I click on "Close" button and call Application.showBlurLayer(false), it does not work. Can some one help in this matter Thank you, Naresh
Flash Error #1009: Get On the....Stage!   (424 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; import; import; 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(; 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]; = _pages[i]; mc.buttonMode = true; mc.addEventListener(MouseEvent.CLICK, clickHandler); } _currentMenu = _menus[0]; displayPage(); } private function displayPage():void { _currentMenu.redpoint.visible = true; _currentPage =; resizeHandler(); addChild(_currentPage); } private function clickHandler(e:MouseEvent): void { _currentMenu.redpoint.visible = false; removeChild(_currentPage); _currentMenu = 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; = w; _navi.logo.x = w - 10; if(Boolean(_currentPage)) { _currentPage.x = w / 2; _currentPage.y = h / 2; } } } } m
how can i keep one child by default when my page loads?   (447 Views)
hi , i want to keep Default one child when my page loads.i have arraycollection of the that i have used repeater whose dataprovider is arraycollection.what i have to do for that can i put some code in init() function.but which code i should put in it any forward
Can't addchild within this class?   (499 Views)
I may be losing my mind. I am simply trying to add a textfield and addchild to that textfield. Here is the textfield class Code: package { import flash.display.*; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; public class TextTween { // public var label:TextField; // public var labelText:String; public function setLabel(str:String) { var labelText:String = str; configureLabel(labelText); } public function configureLabel(labelText:String):void { var tField:TextField = new TextField(); tField.text = labelText; tField.x = 200; tField.y = 200; tField.autoSize = TextFieldAutoSize.LEFT; tField.background = true; tField.border = true; var format:TextFormat = new TextFormat(); format.font = "Verdana"; format.color = 0xFF0000; format.size = 10; format.underline = true; tField.defaultTextFormat = format; // addChild(tField); trace (tField.text); // traces out perfectly } } // end class } // end package This is how I am calling it from Frame 1 Code: var texty:TextTween = new TextTween(); var blah:String = "blabbers"; texty.setLabel(blah); Works great until I try to addChild to that textField from either Frame 1 or the class itself. I can trace it perfectly, trace the class, trace the functions, trace everything in the functions but I can not addChild. Ugh. Anybody know whats going on This is scaring me.
#1009: Cannot access... Sprite/Child... ???   (499 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   (443 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   (547 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 at 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. 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   (469 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(); }
targeting child of parents child   (465 Views)
, I;m pretty new to Kirupa, but it has helped me alot in the past finding out more about Actionscript 3. I have a problem and I cannot get to fix it, it might be a simple thing but as I'm not a real OOP coder, I'm experiencing headaches . Here's the situation: I have a scene(as3) with on frame one the preloader that centers on the canvas, on the second frame there's two MC's; one containing the Background that scales proportionally and centers. The second MC on the same frame contains my website content(called main_) that doesn't scale but only centers on the canvas. Now I created two buttons in that main_ MC to jump to the next frame of the Backgroud MC. so actually I'm trying to target frames or framelabels of another child of the parent of main_ MC. I've tried multiple things like MovieClip(this.parent)... and adding the child to its parent and try to inherit its listener function. It throws errors or isn't doing anything. I think I'm not thinking in the correct hierarchy or I'm making a mistake. Or it might not even be possible, Does anybody have some suggestions thanx in advance!
Change parent without moving child   (555 Views)
, I'm working on a project and I need to be able to change the movieclips parent without moving the child, so I can tween it into position myself. Any ideas on how I would do this
where to add Event.ADDED_TO_STAGE with error #1009   (502 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 at at at and my as3 code is: Code: package{ import flash.display.*; import*; import gs.*; import fl.motion.easing.*; import framework.utils.LoadXML; import*; import*; import* import; import*; public dynamic class wotd_widget extends MovieClip{ //vars var loadXML:LoadXML = new LoadXML('',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($[0].title); trace($[0].description); wotd_In.text = $[0].title; des_In.text = $[0].description; var gt:GoogleTranslation = new GoogleTranslation(); gt.translate($[0].title,'en','de'); gt.addEventListener(GoogleApiEvent.TRANSLATION_RESULT,onTranslate); } private function onTranslate(e:GoogleApiEvent):void{ trans_In.text =; } private function init_btn():void{ this.mc01 = new trans_btn; this.mc01.x = 340.9; this.mc01.y = 234.4; addChild(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,0,{tint:0xFF75B6}); break; case 'rollOut': //this executes when you rolloff the 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(; trace(; trace(; trace(; output_trans.text =; } } } NEED YOUR HELP REALLY REALLY FAST!
How to add a child to a particular scene's stage?   (510 Views)
I have to scenes, dashboard and game. I want to add a child just to game's stage. Can someone tell me the syntax for this
Error #1009   (487 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
remove child = null before setting it to null?   (519 Views)
sometimes I remove child and trace it afterwards and it outputs null although I havent yet set it to null, why is that and do I need to set it to null also in that case Code: trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //[object MovieClip] holderArr[loadedThumbs].removeChild(holderArr[loadedThumbs].getChildByName("photo_bg")); trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //null holderArr[loadedThumbs].photo_bg = null; //trace(holderArr[loadedThumbs].getChildByName("photo_bg")); //null
Add link inside Addchild   (482 Views)
HI I have an MC that I want to add to Stage dynamically. Until here everything seems fine: for (var j:int = 0; j < nomePostosArray.length; j++) { var MC:MovieClip = new mc(); namelistscroller.text.addChild(MC);"newsMc"+j; trace("newsMc"+j); MC.y=MC.height*j+MC.y+20*j; trace(MC.y); MC.nome.text = j+". "+nomePostosArray[j]; MC.morada.text = moradaPostosArray[j]; MC.codigo.text = codigoPostosArray[j]; MC.contacto.text = contactosPostosArray[j]; MC.mapLink = ""; } the variable mapLink is inside the MC. This should be a link that should follow when someone press the link button inside MC. This is the only part that is not working. Can anyone give me a hint
How to remove childs from external Swfs?   (453 Views)
I have a huge doubt about controlling childs with external movies.. For example: Code: var myLoader:Loader = new Loader(); addChild(myLoader); The external swfs are loaded inside the myLoader variable.. How manage the external movies if they have a eventListener in a button like Code: removeMC.addEventListener(MouseEvent.CLICK, removeSwf); function (e:MouseEvent):void{ trace("What can I do"); } Simple doubt.. But I Need help!
Problems with removechild   (471 Views)
I wonder if someone can help me with removeChild i made a class preloadContent, it preloads content but when i want to load the next external image or swf he doesn't remove the old content, can someone help me with that, its a reocuring problem for me i dont understand the removechild stuff. this is my class: Code: package { import gs.*; import gs.easing.*; import flash.display.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import; import*; import*; public class PreloadContent extends MovieClip { public var main; public var xmlmenu; public var imageLoader:Loader; public var container; public var placeholder; public var changeSize; public var url; public var firstTime:Boolean = true; public var hoog; public var breed; public function PreloadContent(mainClass, container, placeholder, changeSize):void { this.main = mainClass; this.container = container; this.placeholder = placeholder; this.changeSize = changeSize; } public function preloadContent(contentUrl, hoog, breed):void { this.url = contentUrl; // Show Preloader this.placeholder.preloader.visible = true; this.hoog = hoog; this.breed = breed; // Set properties on my Loader object imageLoader = new Loader(); imageLoader.load(new URLRequest(url)); imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); } public function imageLoaded(e:Event):void { // Hide Preloader this.placeholder.preloader.visible = false; this.changeSize.changeSize(this.hoog, this.breed); // The container animation takes 1 seconde so wait until the animation is done and then load the image, 1, {onComplete:placeContent}); } public function placeContent():void { // remove content if (firstTime == false) { this.placeholder.imageLoadArea.removeChild(imageLoader); } // Load Content this.placeholder.imageLoadArea.addChild(imageLoader); trace(image); firstTime = false; } public function imageLoading(e:ProgressEvent):void { // Get current download progress var loaded:Number = e.bytesLoaded / e.bytesTotal; // Send progress info to "preloader" movie clip this.placeholder.preloader.SetProgress(loaded); } } }
How to remove child?   (469 Views)
When beginning without any key pressed the ryustance_mc plays as it should. When right or left key is pressed the ryuwalk_mc plays but the ryustance_mc plays at the background. How to remove it from the holder The thing is when I stop pressing any of the keys then ryustance_mc must play again. function control(event:Event):void { if(rightKeyIsDown) { holder_mc.addChild(ryuwalk_mc);; holder_mc.x += speed; } if(leftKeyIsDown) { holder_mc.addChild(ryuwalk_mc);; holder_mc.x -= speed; } } initializeGame();[/code] Please help me. Thank You
Help with Error #1009   (474 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*; 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.
visible children with invisible parents   (483 Views)
Hi all, I've looked but can't find this anywhere. This may well just be because it can't be done but here goes. Does anyone know of a way that I can make a MoviecClip "visible=false" whilst stopping just one of its children's, children's, children...etc from also going invisible. I am aware that it can be done by setting them all individually but this will take a lot of code (and I like tidy code...and I'm lazy), and I am reluctant to use a loop as it will interrupt the animation that is going on at the time. Any suggestions would be appreciated.
Very Strange Issue with Error #1009   (570 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 at at Here is my project.
delete all children   (503 Views)
I have a movieclip that will have between 3 and 6 children in it. I need a way to delete all the children. What is the best way to do this Cheers, AK
1009 error after putting the preloader.   (545 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.
Access a var inside a child MC   (482 Views)
I'm new to AS3 and have a movie clip on the stage that contains a var, the MC is called "myMC" ie Code: var path = "my path";//this is in the first frame of myMC I want to access this value from the parent element, in this case it is the stage. So on the first frame on my stage i have, Code: trace(myMC.path);// this returns underfined This would work in AS2. Can i access this or do i need to create a class to access vars of a child
TypeError: Error #1009: Cannot access a property or method of a null object reference   (492 Views)
hello, I'm new to flash and AS3, so maybe this is a dumb question but, I have a preloader that I want to tween down the alpha and move to the next frame. I have a tween variable tweening the alpha channel down to 0 and adding an event listener that moves to the next frame. here's my code: Code: stop(); this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress); this.loaderInfo.addEventListener(Event.COMPLETE, onComplete); function onProgress(e:ProgressEvent):void { var; var; var pct:Number=loaded/total; loader_mc.scaleX=pct; } function onComplete(e:Event):void { var loaderTween:Tween = new Tween(loaderOutline_mc,"alpha",Strong.easeOut,1,0,1,true) var loaderTween2:Tween = new Tween(loader_mc,"alpha",Strong.easeOut,1,0,1,true) } //************NEEDS TO BE CORRECTED************* loader_mc.addEventListener (Event.ENTER_FRAME, menuLoad); function menuLoad (event:Event):void { //trace(loader_mc.alpha) if (loader_mc.alpha==0) { nextFrame(); loader_mc.removeEventListener (Event.ENTER_FRAME, menuLoad); } } when I run the application it moves to the next frame, however I get an error code that repeats consecutively reading: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Production_6_fla::MainTimeline/menuLoad() and does not stop repeating. I can still run the program but this is really making everything run super slow... I commented out everything in the "if statement" seperately and evrything outside of the "if statement"to see where the problem lies. the problem is in the nextFrame(); code. I tried to add "stage.nextFrame(); but that did not work, and Stage.nextFrame(); and gotoAndStop(2); and stage.gotoAndStop(2); and I really can't figure out what is going on... I'm banging my head against the wall on this one.
Stage and Keyboard getting TypeError: Error #1009:   (485 Views)
Trying to hook up a keyboard listener to the stage but am getting a runtime error. Spent over an hour trying to figure out what's going on, but from everything I've seen (online and in a reference book) the stage should not be null, but it is. Code: package ghg.system { import flash.display.*; import; import; public class Input extends Sprite { public function Input() { super(); stage.addEventListener( KeyboardEvent.KEY_DOWN, keyDownListener ); stage.addEventListener( KeyboardEvent.KEY_UP, keyUpListener ); } private function keyDownListener( e:KeyboardEvent ) :void{} private function keyUpListener( e:KeyboardEvent ) :void{} } } The specific run-time error is: TypeError: Error #1009: Cannot access a property or method of a null object reference. at ghg.system::Input() at Main() at russianreactor_fla::MainTimeline/frame1() Any idea why the stage is null Do I have to do some type of initialization on it
clicking on a sprite with a textfield child   (552 Views)
kirupers!!! I've been out of as3 for a few weeks but when I start coding again, I start coming back again to the forum I have a movieclip in the library (menu_button) which only consists of a textfield. This is an item of a dynamic menu I build by adding new instances of the menu_button class. It seems that when I click in the movieclip, it's the textfield that fires the mouse event, instead of the movieclip which contains the textfield. Whe I do trace( I get "dynamic" (for dynamic textfield I supose...) Another problem I have is that when I do menu_button.buttonMode= true I don't get that gloved hand we all love... this should be simple... Am I missing something important TIA! Pier
Error #1009 at loading an external swf   (659 Views)
I am using FlashDevelop 3 for my project, and I am trying to load an swf (created in Flash CS3 and with timeline code). What does it mean Code: [Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference. Execution halted in 'spontaneousBox.swf' ffffffffat 0xExecution halted in 'spontaneousBox.swf' ffffffff (-1) PS: i can load images fine, and other swfs built with FlashDevelop. EDIT: it seems that i only get the error the first time I load the swf, after trying to load again, it loads ok.
Controlling .text prop of a TextField as a child object of a MovieClip - not working   (594 Views)
, I know this one is going to sound ridiculously stupid, but while I am more than capable of controlling the text property of a TextField when it is on the stage by itself, my testing of a altering a TextField's text as a child of a MovieClip object is failing miserably. Can anyone tell me what kind of knuckleheaded mistake I'm making I tried to write out the code as clean as possible below... //IMPORTS... //VARIABLES... //create movieclip object var myMovieClip:MovieClip = new MovieClip(); //create object to be made a child object of myMovieClip var myChildObject:TextField = new TextField(); myChildObject.text = "Child Object"; = "Object1";//COMMANDS... TextField //add myChildObject as a child of myMovieClip myMovieClip.addChild(myChildObject); //place myMovieClip on the stage addChild(myMovieClip);//ADDEVENTLISTENERS... //this will allow user to click on the stage activating a change in the x-coordinate of myChildObject stage.addEventListener(MouseEvent.CLICK, changeChildObjectProperties); stage.addEventListener(MouseEvent.MOUSE_WHEEL, add2ndObject);//FUNCTIONS... //ADDEVENTLISTENER FUNCTIONS... function changeChildObjectProperties(event:MouseEvent):void { //CHANGING THE 'x' & 'width' PROPERTIES WORK JUST FINE... myMovieClip.getChildByName("Object1").x += 50; myMovieClip.getChildByName("Object1").width = 250; //!!!THIS IS THE THING THAT DOESN'T WORK NO MATTER WHAT... myMovieClip.getChildByName("Object1").text = "Object1's text has been changed..."; } function add2ndObject(event:MouseEvent):void { var my2ndChildObject:TextField = new TextField(); = "Object2_" + myMovieClip.numChildren; my2ndChildObject.text =; myMovieClip.addChild(my2ndChildObject); my2ndChildObject.y += 20; } //END ADDEVENTLISTENER FUNCTIONS //NORMAL FUNCTIONS... //END NORMAL FUNCTIONS //END FUNCTIONS
How to ignore masking on one particular child   (483 Views)
Hi , I was working with masks today and something was bugging me... For example, I have a Movieclip and 2 Childs: - Parent: Movieclip - Child of Movieclip: Mask - Child of Movieclip: Shadow Now, Mask is working properly for Movieclip and is also applying the mask effect to Shadow. I would like Shadow to stay behind Movieclip but to ignore the Mask effect. Is it possible Or should Shadow be adopted by Stage instead of Movieclip
Inconsistent referencing behaviour   (629 Views)
Can any one tell me why the listenerevent functions seem to be inconsistent. The second one works. The first one doesn't, complaining about a NULL parameter being passed to navigateToURL. I used to have the links in an array, and as you can see by my commented out code, I wanted to loop this. Any help here Code: var links1 = new URLRequest("link1.html"); var links2 = new URLRequest("link2.html"); var links3 = new URLRequest("link3.html"); var links4 = new URLRequest("link4.html"); //for (y=1;y
child swapdepths?   (505 Views)
I have a question about a child component's hitTest. Say I have a MainCanvas component which holds ViewZero, ViewOne and ViewTwo. Further, ViewTwo holds a ComboBox (which I'm creating from scratch). MainCanvas- - ViewZero - ViewOne - ViewTwo -ComboBox Within that ComBox, I have a dropdown which slides up and down. When the ComboBox is dropdown is visible, I want to test for it's hitTest so I can close it. For example, in AS2 I can do something like this: Code: private function mouseDownHandler() : Void { closeOnMouseUp = isDropVisible && (!dropdownCanvas.hitTest(_level0._xmouse, _level0._ymouse, false) } private function mouseUpHandler() : Void { if (closeOnMouseUp) //Close the dropdown; }
TypeError: Error #1009 :(   (462 Views)
I don't understand why I am getting this error.... package Classes { public class HomePage extends Sprite { public function HomePage():void { buildLogo(); } 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; addChild(LogoBg); } }} 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 { addChild(display); fillTheBoard(); } } } 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 and
Play a movie clip continuously throughout different scenes   (481 Views)
Here's what i'm trying to do: I have a movie clip playing throughout my movie to simulate an old computer screen, but when i change scenes, the movie clip starts over at the beginning. How do I have the movie clip play continuously without restarting when i change scenes
Flash Creating a Seekbar for FlvPlayback   (445 Views)
, I'm trying to provide a seekbar for a FLVPlayback. I have MovieClips (Graphics) for the base bar, fill bar and thumb. How can I attach these MovieClips to the FLVPlayback using AS3 code Do I have to create a skin, if so then how I'm using the Flash CS4 (Not Flex). I've searched the web without a lot of success in finding code examples.
Flash load SWF created by AC 3.0 to SWF in 2.0   (520 Views)
Hi please from all people who have experience i have i big problem i am doing my assignment and i should submit it on 29/4/2011. And i create some of document by Action script 3.0 and other by Action script 2.0, my question is how i can load SWF created in AC 2.0 via document has been created in AC 3.0 i saw some of thread hear about loading but i tried it didn't work please please any help