Btw, adding a new topic every few hours that addresses the same issue, but with a slightly different name, is really bad form.
-TH --- In [email protected], "turbo_vb" <timh...@...> wrote: > > The stage isn't available immediately. That's why you get a null error. > With a little trickery: > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > creationComplete="onCreationComplete()" > > resize="getStageDimensions()"> > > > > > <mx:Script> > > <![CDATA[ > > private function onCreationComplete():void > > { > > callLater( getStageDimensions ); > > } > > > > > private function getStageDimensions():void > > { > > if ( stage ) > > { > > trace( "height:" + stage.height ); > > trace( "width:" + stage.width ); > > } > > } > > ]]> > > </mx:Script> > > > > > -TH > > --- In [email protected], "markflex2007" <markflex2007@> > wrote: > > > > > > I try to get current stage size with the code,but I get error > > "TypeError: Error #1009: Cannot access a property or method of a null > object reference.". > > It seems I get error for stage.height. > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" > > creationPolicy="all" resize="resizeHandler(event)"> > > <mx:Script> > > <![CDATA[ > > import mx.events.ResizeEvent; > > > > > > private function resizeHandler(event:ResizeEvent):void{ > > > > > > trace("height:" + stage.height); > > trace("height:" + stage.width); > > > > } > > ]]> > > </mx:Script> > > > > ... > > ... > > > > </mx:Application> > > > > > > Please help me.Thanks > > > > Mark > > >

