PDA

View Full Version : Loading external text with button. Error #1009



acharlesmobile
July 28th, 2009, 04:20 AM
Hi everyone, I am designing a website in flash now and I've run into a snag as I am a noob.


I have a button (LOW_btn), located in one movieclip, and is set to play the next frame of another movie clip "bodybox_mc" and at the same time load an external .txt file into a dynamic text box "musictext_txt", which is deeper within the "bodybox_mc". (There is an update to "musictext_txt"'s scrollbar as well). However at runtime i receive the error 1009 (output is after the code).

Here is the code (sorry if the variables and stuff are a bit long):


function loadLOW(event:MouseEvent):void
{
MovieClip(this.root).bodybox_mc.gotoAndPlay(2);

var myMusicLOWTextLoader:URLLoader = new URLLoader();
myMusicLOWTextLoader.load(new URLRequest("musicLOWtext.txt"));
myMusicLOWTextLoader.addEventListener(Event.COMPLE TE, LOWLoaded);
function LOWLoaded(e:Event)
{
MovieClip(this.root).bodybox_mc.bodyboxbox_mc.musi ctext_txt.htmlText = e.target.data
MovieClip(this.root).bodybox_mc.bodyboxbox_mc.sb.u pdate();
}
}
menuboxbox_mc.LOW_btn.addEventListener(MouseEvent. CLICK, loadLOW);

With debugging permitted, the output is this:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at music2EXPERIMENT_fla:menubox_2/loadLOW/music2EXPERIMENT_fla:LOWLoaded()[music2EXPERIMENT_fla.menubox_2::frame1:9]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


So the problem seems to be on the line with


"MovieClip(this.root).bodybox_mc.bodyboxbox_mc.musi ctext_txt.htmlText = e.target.data"As in probably the "e.target.data" part. What does this mean and how can i fix this?


Thank you so much for your time.

acharlesmobile
July 28th, 2009, 02:41 PM
More specifically, if e.target.data indicates the data of the object we are referencing, is that the URLLoader "myMusicLOWTextLoader"?