Hi, Cory, That is really interesting. I played with it a little and I got this Warning:
Warning: 3553: Function value used where type void was expected. Possibly the parentheses () are missing after this function reference. and of course it threw an actual error when I set up the function with arguments. I wonder if there is some sort of precedent/reasoning for that working... If you write something like this, it behaves like almost like a property: function stuff():int { return 1; } var a = stuff; but this: function stuff():int { return 1; } stuff; shows that warning. Anyway, it's curious and thanks for setting me straight! -jonathan On Mon, Mar 17, 2008 at 5:25 PM, Pedro Kostelec <[EMAIL PROTECTED]> wrote: > I doesn't. I posted the iles on the net. > Can you please throw a look at? > http://www.box.net/shared/wettvhs84s > > Thanks > > On Mon, Mar 17, 2008 at 4:50 PM, Cory Petosky > <[EMAIL PROTECTED]> wrote: > > Jonathan, that's actually legal in ActionScript. Ugly and misleading, > but legal. > > > > Pedro, change Mountain2 to this: > > > > import flash.events.Event; > > > > import flash.display.Sprite; > > public class Mountain extends Sprite { > > private var color1:uint=0x003300; > > private var color2:uint=0x001700; > > > > public function Mountain() { > > addEventListener(Event.ADDED_TO_STAGE, > stageListener); > > } > > public function stageListener(event:Event):void { > > > > > > graphics.beginFill(color1); > > graphics.drawRect(0,0,stage.stageWidth, > > stage.stageHeight/2); > > graphics.endFill(); > > } > > > > You don't have a reference to the stage until the object is actually > > added -- using an event listener to wait until you're added to the > > stage solves the problem. > > > > > > > > > > On 3/17/08, jonathan howe <[EMAIL PROTECTED]> wrote: > > > 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 > > > > > > > > > -- > > Cory Petosky : Lead Developer : PUNY > > 1618 Central Ave NE Suite 130 > > Minneapolis, MN 55413 > > Office: 612.216.3924 > > Mobile: 240.422.9652 > > Fax: 612.605.9216 > > http://www.punyentertainment.com > > > > > > _______________________________________________ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > -- > 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