AS3 Question...

  • Started
  • Last post
  • 1 Response
  • must_dash

    I'm a bit out of the loop with AS3 and components... so hope someone can shed some light... I have a component which I've dragged to the stage and given it the instance name myDictionary

    and then put this code in the first frame...

    myDictionary.addEventListener(Ev... onLoadComplete);
    function onLoadComplete(event:Event):void {
    // on load complete code, for example, populate all text fields
    trace ("hello");
    }

    But I'm getting this error...

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at dictionary::CopyDictionary/start...
    at dictionary::CopyDictionary/onIni...
    at fl.core::UIComponent/callLaterDi...

    Is there something else I should be doing before I add the listener?

  • Boz0

    components already have their own events and methods defined.
    You have to look into help file for that component and see if it has onComplete or similar events available.

    You can overwrite class methods and events naturally in AS3 but components are already packaged classes so you have to rely on them.

    What's the component you dragged onto the stage?