well..for one, the error message is telling you exactly what is wrong
with your code.  the Stage object doesnt haave an event named
'addEventListener'..it's just 'addListener'. And since you are trying
to delagate to a class's function, I'd imagine there would be no
reason for the creation of a listener object, just define an
'onResize' function in teh class and register the class with the Stage
object to receive the onResize event:

class myClass{

    function myClass(){
        Stage.addListener(this)
    }

    function onResize(){
        //do stuff
    }

}

On 1/28/06, Robert Sandie <[EMAIL PROTECTED]> wrote:
> I have been trying to use a delegate for the Stage and have been having
> problems:
>
>
>
>
>
> /*
>
> * This works but hate calling _root and would like to include a Boolean into
> the LetsResize function.
>
> */
>
>
>
> private function mainController ( mc:MovieClip ) {
>
>
>
>
>
> var resizeThis = new Object();
>
> resizeThis.onResize = LetsResize;
>
> Stage.addListener(resizeThis);
>
> LetsResize();
>
>
>
>
>
> {
>
>
>
> private function LetsResize():Void
>
> {
>
>             _root.anObject._x  = Stage.width-20;
>
>
>
> }
>
>
>
>
>
>
>
> /*
>
> * This does not work and how I would prefer to get it to work
>
> */
>
>
>
> private function mainController (mc:MovieClip{
>
> {
>
> .
>
> // Error Rec'd: There is no method with the name 'addEventListener'
>
> Stage.addEventListener(resizeThis, Delegate.create(this,LetsResize))
>
>
>
> ..
>
> }
>
>
>
> private LetsResize(evt:Object):Void
>
> {
>
>   anObject._x = Stage.width-20;
>
>
>
> }
>
>
>
>
>
> Does anyone know what may be going on or a workaround where I will not be
> accessing root?
>
>
>
> I have used the delegate for many other things and usually it sends over the
> functions.
>
>
>
> Any assistance would be most appreciated,
>
>
>
> -rob
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to