Hi, I have put my main code for the fla in a class that I call Main. The
class loads fine, but I can't get a reference to it! It's undefined.
This is the code on the first layer of the fla:
var main:Object = new Main();
..and this is the class' code:
import mx.utils.Delegate;
import gs.dataTransfer.XMLParser;
class Main {
private var myCSS:TextField.StyleSheet;
private var cssURL:String = "main.css";
private var xml:XML;
private var xmlURL:String;
private var tournaments:Object;
private var updates:Object;
public function Main() {
tournaments = new Object();
updates = new Object();
_root.flap1_mc.activate();
loadCSS();
}
private function loadCSS():Void {
myCSS = new TextField.StyleSheet();
myCSS.load(cssURL);
myCSS.onLoad = Delegate.create(this, onLoadCSS);
}
private function onLoadCSS(success:Boolean):Void {
if (success) {
var txt:String =
'<h2>joha</h2>'+
'<h3>zona pellicia accinctis </h3>'+
'<p>haec at illi <a
href="http://www.google.com">dixerunt</a> </p>';
_root.report_txt.styleSheet = myCSS;
_root.foldOut_mc.menu_txt.styleSheet = myCSS;
_root.report_txt.htmlText = txt;
//_root.foldOut_mc.menu_txt.htmlText = txt;
XMLParser.load("tournaments.xml", Delegate.create(this,
onLoadTournamentsXML), tournaments);
XMLParser.load("updates.xml", Delegate.create(this,
onLoadUpdatesXML), updates);
}
}
private function onLoadTournamentsXML(success:Boolean,
results_obj:Object, xml:XML):Void {
if (success) {
var menu:TextField = _root.foldOut_mc.menu_txt;
menu.htmlText = '';
for(var i:Number=0; i < tournaments.liveTournament.length;
i++) {
var node:Array = tournaments.liveTournament[i];
menu.htmlText += '<h4><a
href="asfunction:_root.loadEvent,'+ node.id +'">'+ node.name[0].value
+'</a></h4>'+
'<p>'+ node.startDate[0].value
+'</p>\n\n<p></p>';
}
} else {
trace("XML Problem " + success);
}
}
public function loadEvent2(_arg:String):Void {
trace("hej");
}
private function onLoadUpdatesXML(success:Boolean,
results_obj:Object, xml:XML):Void {
if (success) {
//trace(updates.liveUpdate[1].title[0].value);
} else {
trace("XML Problem " + success);
}
}
}
--
Johan Nyberg
Web Guide Partner
Sergels Torg 12, 8 tr
111 57 Stockholm
070 - 407 83 00
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com