I have 3 textfields in 3 different frames. Each text field is for a different section of my website. I want to keep all the code that works for 1 textfield and just change the URL that is loaded. I tried so many different ways. I don’t get a error so I believe the URL is being cached somewhere. When I trace it It shows that the other text doc has loaded but the text field doesn’t show any change. Is there away to reload/stop cache/delete a variable?
stop();
var newsURL:String = "text/news.txt"
//Below is other variables if you wanted to swap out the actual variable versus the url.
/*bioURL:String = "text/bio.txt"
tourURL:String = "text/tour.txt"*/
//var newsURL:String = "text/news.txt"
var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest = new URLRequest(newsURL);
var style:StyleSheet = new StyleSheet();
//style defined below
style.setStyle("a" , {color:"#CC0000"});
style.setStyle("a:hover", {textDecoration:"underline"});
function textLoaded(event:Event):void
{
text_mc.text_txt.styleSheet = style;
text_mc.text_txt.htmlText = textLoader.data;
}
textLoader.load(textReq);
text_mc.text_txt.autoSize = TextFieldAutoSize.LEFT;
textLoader.addEventListener(Event.COMPLETE, textLoaded);
function onClickNews(event:MouseEvent):void
{
newsURL = "text/news.txt";
// I tried including this in the button textLoader.load(textReq);
// also this
gotoAndStop(1);
}
news_btn.addEventListener(MouseEvent.CLICK,onClickNews);
function onClickBio(event:MouseEvent):void
{
newsURL = "text/bio.txt";
gotoAndStop(2);
}
bio_btn.addEventListener(MouseEvent.CLICK,onClickBio);
function onClickTour(event:MouseEvent):void
{
newsURL = "text/tour.txt"
//var newsURL:String = "text/tour.txt"
gotoAndStop(3);
}
tour_btn.addEventListener(MouseEvent.CLICK,onClickTour);
Please help Thanks
http://www.theofficialvip.com/testURLSwitcher/testURLSwitcher.zip