• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Separate AS3

New Here ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

Hi ... i'm trying to move AS3 to separate file

but i always got error

Line 13 1120: Access of undefined property loader.

Line 13 1120: Access of undefined property handle_loadComplete.

Line 14 1120: Access of undefined property loader.

 

this is my code

 

package 
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.TextField;// ini untuk dynamic text
	import se.svt.caspar.template.CasparTemplate;

	public class ParsingXML extends CasparTemplate
	{
		private var loader:URLLoader = new URLLoader();

		loader.addEventListener(Event.COMPLETE, handle_loadComplete);
		loader.load(new URLRequest("pembuktian.txt"));

		private function handle_loadComplete(e:Event):void
		{

			myTextField.text = e.target.data;

		}
	}
}

 

 

before i move to separate file i had test it inside .fla file and it work

 

var loader:URLLoader = new URLLoader();

loader.addEventListener(Event.COMPLETE, handle_loadComplete);
loader.load(new URLRequest("pembuktian.txt"));

function handle_loadComplete(e:Event):void
{

	myTextField.text = e.target.data;

}

 

is there anyone can point me into right direction

 

comment and help would be appreciate

 

Best Regard

 

Gilar Kadarsah | Indonesia

 

 

Note: i also upload the AS3 File and FLA File incase need to open it

Views

261

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2020 Apr 28, 2020

Copy link to clipboard

Copied

LATEST

Hi.

 

Your initialization code must be inside of the constructor method of the ParsingXML class.

 

ParsingXML.as

package
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import se.svt.caspar.template.CasparTemplate;

	public class ParsingXML extends CasparTemplate
	{
		private var loader:URLLoader = new URLLoader();

		public function ParsingXML()
		{
			loader.addEventListener(Event.COMPLETE, handle_loadComplete);
			loader.load(new URLRequest("pembuktian.txt"));
		}

		private function handle_loadComplete(e:Event):void
		{
			myTextField.text = e.target.data;
		}
	}
}

 

CasparTemplate.as

package se.svt.caspar.template
{
	import flash.display.MovieClip;

	public class CasparTemplate extends MovieClip
	{
		public function CasparTemplate()
		{
			
		}
	}
}

 

I hope this helps.

 

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines