If the instance is dynamic (if you instantiate it and then add it as a child, instead of being an object that's already in the stage), you cannot access the stage on the constructor. It'll return null - stage is not known until the container is added to the display list. You have to add a method fired by ADDED_TO_STAGE, and inside that method, THEN call stage.addEventListener.

Try tracing the value of "stage" right before adding the event listener. If it's "null", that's the problem you're facing.

Other solution, better for bigger projects, is having some kind of singleton that composes stage and has it fully accessible at anytime.

Finally, calling stage.addEventListener() when stage doesn't exist would give you an error. If it's just silently ignoring that without displaying any error message, I suggest you install the debug player instead.


Zeh

Patrick J. Jankun wrote:
already done this, before even adding that listener, this is the whole code i want to get working:

public function PbMain() : void
{
    StageAlign.TOP_LEFT;
    StageQuality.HIGH;
    StageScaleMode.NO_SCALE;
    stage.addEventListener(Event.RESIZE, initialise);
}

private function initialise() : void
{ trace( "Initialised" );
    stage.removeEventListener(Event.RESIZE, initialise );
    init();
}

On Jun 5, 2008, at 4:37 PM, Eduardo Omine wrote:

I think you must set stage.scaleMode = StageScaleMode.NO_SCALE.

--
Eduardo Omine
http://blog.omine.net/
http://www.omine.net/
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

------------------------------------------
fancy skills to pay the bills
www.jankun.org

Phone:  +43 660 96 969 - 01
web:    jankun.org
mail:   p[at]jankun.org

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to