Statics are not inherited in that way.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of George Riley
Sent: Friday, May 09, 2008 1:19 PM
To: [email protected]
Subject: [flexcoders] Custom events and static constants

 

Hi FlexCoders,

I've got a custom event that extends mx.event.VideoEvent:

package com.ted.services.youtube.events
{
    import flash.events.Event;
    import mx.events.VideoEvent;

    public class YouTubeVideoEvent extends VideoEvent
    {
        public var duration:Number;
        
        public function YouTubeVideoEvent(type:String,
bubbles:Boolean=false, cancelable:Boolean=false, state:String=null,
playheadTime:Number=0, duration:Number=0)
        {
            super(type, bubbles, cancelable, state, playheadTime);
            this.duration = duration;
        }
        
        override public function clone():Event {
               return new YouTubeVideoEvent( type, bubbles, cancelable,
state,
playheadTime, duration );
        }
        
    }
}

However, in a component that uses a static constant of the base
mx.event.VideoEvent class in this manner:

dispatchEvent(new
YouTubeVideoEvent(YouTubeVideoEvent.PLAYHEAD_UPDATE,false,false,null,inf
oObj.playheadTime,infoObj.duration));

FlexBuilder complains when compiling:

1119: Access of possibly undefined property PLAYHEAD_UPDATE through a
reference with static type Class.

It looks like my custom event is not inheriting the static constants of
its base class!???  Or am I missing something?  Any suggestion much
appreciated.

-George Riley

 

Reply via email to