proto
02-06-2005, 08:53 PM
Hi:
I am new to flash, and I have encountered my first "brick wall". I am working with a forms-based application, and I am writing all my code for each form in an associated class file, similar to the following. The follwing code works, UNLESS I un-comment the "this.addEventListener" line in the constructor. If I uncomment that line, then the contentPath is not set (or, more accurately, the content is not loaded at runtime. If I trace the contentPath property after setting it, the correct value is returned). I have tried setting the contentPath in the "searchLoad" handler (and commenting out the "init" handler), but this does not work either.
Does this make any sense? Have I provided enough information that you can tell me what I am doing wrong?
class MyForm extends mx.screens.Form
{
function MyForm ()
{
//this.addEventListener("load",this);
}
private function handleEvent(evtObj:Object):Void
{
if(evtObj.type=="load")
{
searchLoad();
}
}
public function init():Void{
super.init();
this.contentPath="searchHouses.swf";
trace("init");
}
private function searchLoad():Void
{
trace("searchLoad");
}
}
I am new to flash, and I have encountered my first "brick wall". I am working with a forms-based application, and I am writing all my code for each form in an associated class file, similar to the following. The follwing code works, UNLESS I un-comment the "this.addEventListener" line in the constructor. If I uncomment that line, then the contentPath is not set (or, more accurately, the content is not loaded at runtime. If I trace the contentPath property after setting it, the correct value is returned). I have tried setting the contentPath in the "searchLoad" handler (and commenting out the "init" handler), but this does not work either.
Does this make any sense? Have I provided enough information that you can tell me what I am doing wrong?
class MyForm extends mx.screens.Form
{
function MyForm ()
{
//this.addEventListener("load",this);
}
private function handleEvent(evtObj:Object):Void
{
if(evtObj.type=="load")
{
searchLoad();
}
}
public function init():Void{
super.init();
this.contentPath="searchHouses.swf";
trace("init");
}
private function searchLoad():Void
{
trace("searchLoad");
}
}