Missing () after Mountain instantiation, first of all... var mountain:Mountain = new Mountain();
On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec <[EMAIL PROTECTED]> wrote: > Hi > (posted in flashnewbies but the list is not very active and i need to > solve this problemas soon as possible) > i have a problem while creating a as3 short animation: > > When i test the movie(all done with as3) i get this: > > TypeError: Error #1009: Cannot access a property or method of a null > object reference. > at Mountain/init2() > at Mountain$iinit() > at RisingCroix/::init() > at RisingCroix$iinit() > > > my code: > package { > import flash.display.Sprite; > import flash.events.Event; > import flash.filters.*; > > public class RisingCroix extends Sprite { > private var croix:Croix; > private var croix2L:Croix2; > private var croix2R:Croix2; > > private var vy:Number=5; > private var glowFilter:GlowFilter; > private var blurFilter:BlurFilter; > private var blurFilter2:BlurFilter; > > public function RisingCroix() { > init(); > } > private function init():void { > croix=new Croix; > addChild(croix); > croix.x=stage.stageWidth / 2; > croix.y=stage.stageHeight; > > croix2L = new Croix2; > addChild(croix2L); > croix2L.x=stage.stageWidth /4; > croix2L.y = stage.stageHeight; > > croix2R = new Croix2; > addChild(croix2R); > croix2R.x = stage.stageWidth /4 *3; > croix2R.y = stage.stageHeight; > > var mountain:Mountain = new Mountain //i guess > it is here wher it stucks > addChild(mountain); > mountain.x = stage.stageWidth / 2; > mountain.y = stage.stageHeight / 2; > > glowFilter = new GlowFilter(0xFFFF00, 0.6, 30, > 30, 2, 1); > blurFilter = new BlurFilter(6,6,1); > blurFilter2 = new BlurFilter(13,13,3); > > addEventListener(Event.ENTER_FRAME, onEnterFrame); > } > public function onEnterFrame(event:Event):void { > if (croix.y>stage.stageHeight/2) { > croix.y -=vy; > } > if (croix2R.y>stage.stageHeight/2-10) { > croix2R.y -= vy/3*2; > croix2L.y -= vy/3*2; > } > croix.filters = [blurFilter, glowFilter]; > croix2R.filters = croix2L.filters =[blurFilter2]; > > } > } > } > > and the Mountain CLass > > package { > import flash.display.Sprite; > > public class Mountain extends Sprite { > private var color1:uint=0x003300; > private var color2:uint=0x001700; > > public function Mountain() { > init2(); > } > public function init2():void { > > graphics.beginFill(color1); > graphics.drawRect(0,0,stage.stageWidth, > stage.stageHeight/2); > graphics.endFill(); > } > } > } > > > > -- > Pedro D.K. > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders