I'm new to flash . I have called this flash code in Flex using SWF loader .I got the following Error. Here I've attached flash coding for header_text_fla Kindly do the needful.
TypeError: Error #1009: Cannot access a property or method of a null object reference. at header_text_fla::MainTimeline/loaderComplete()
var myEvent:Event;
var myParams:LoaderInfo;
function loaderComplete(myEvent:Event)
{
if(this.loaderInfo.parameters.text1 != null)
{
Text1.text=this.loaderInfo.parameters.text1 as String;
}
if(this.loaderInfo.parameters.text2 != null)
{
Text2.text=this.loaderInfo.parameters.text2 as String;
}
if(this.loaderInfo.parameters.text3 != null)
{
Text3.text=this.loaderInfo.parameters.text3 as String;
}
}
function useParams()
{
}
var myLoaderInfo=new Object();
myLoaderInfo.myParamsLoaded=false;
myLoaderInfo.loaderComplete=loaderComplete;
myLoaderInfo.useParams=useParams;
this.loaderInfo.addEventListener(Event.COMPLETE, myLoaderInfo.loaderComplete );
I have solved by using try catch.Here is the code
try
{
Text1.text=this.loaderInfo.parameters.text1 as String;
Text2.text=this.loaderInfo.parameters.text2 as String;
Text3.text=this.loaderInfo.parameters.text3 as String;
}
catch(error:Error)
{
trace("Error");
}