While working with Starling, I am encountering this problem. It's important to use the flash Event sometimes.
import starling.events.Event;
import flash.events.Event ;
var _myFile_Fr:FileReference = new FileReference();
_myFile_Fr.addEventListener(Event.COMPLETE, onFileLoaded);
_myFile_Fr.load();
function onFileLoaded(event:Event ):void
{
trace( event.target.data ) // <<<< compiler error:
}
Access of possibly undefined property data through a reference with static type starling.events:EventDispatcher
I tried to use the full specification
function someEventHandler(event:flash.events.Event ):void
{
....
}
Also this way :
_myFile_Fr.addEventListener(flash.events.Event.COMPLETE, onFileLoaded);
_myFile_Fr.load();
function onFileLoaded(e:Event ):void
{
trace( e.target.data );
}
But the above doesnot work, and shows compile time error.
access of undefined property Flash
Then what's the way out ?
Access of possibly undefined property data through a reference with static type starling.events:EventDispatcher. With flash.events.Event, it works fine.
from starlling Doc
this class do all that
flash.events.Eventdid before with its additional options. what would be the advantage of using import flash.events.Event in your case?however
does not cause any error in regular way.
Also from starlling Doc