Wczytywanie tekstu do kolejnej klatki AS3
: sob lis 01, 2008 3:20 pm
Witam.
Jestem początkujący we fleszu i AS3, dlatego proszę się nie śmiać. Przeszukałem internet w rozwiązaniu tego problemu, ale znalazłem tylko do AS2 lub inne (nie dla mnie) rozwiązania.
Problem polega na tym, że wczytuje mi dane tekstowe, ale do pierwszej klatki. Moje natomiast dynamic text (Instance name=tf) zaczyna sie w 10 klatce i w tym momencie mam już tylko błąd.
Proszę poradźcie jak wczytać do dynamic text do właściwej sceny i klatki.
KOD:
package {
import flash.display.MovieClip;
import flash.display.Scene;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.StyleSheet;
public class Bbb extends MovieClip {
private var textLoader:URLLoader;
private var cssLoader:URLLoader;
private var css:StyleSheet;
public function Bbb():void {
textLoader=new URLLoader;
textLoader.addEventListener(Event.COMPLETE,textLoaded);
textLoader.load(new URLRequest("welcom.txt"));
cssLoader=new URLLoader;
cssLoader.addEventListener(Event.COMPLETE,cssLoaded);
css=new StyleSheet;
}
private function cssLoaded(event:Event):void {
css.parseCSS(URLLoader(event.target).data);
tf.styleSheet=css;
tf.gotoAndStop(5).htmlText=textLoader.data;
}
private function textLoaded(event:Event):void {
cssLoader.load(new URLRequest("myCSS.css"));
}
}
}
Jestem początkujący we fleszu i AS3, dlatego proszę się nie śmiać. Przeszukałem internet w rozwiązaniu tego problemu, ale znalazłem tylko do AS2 lub inne (nie dla mnie) rozwiązania.
Problem polega na tym, że wczytuje mi dane tekstowe, ale do pierwszej klatki. Moje natomiast dynamic text (Instance name=tf) zaczyna sie w 10 klatce i w tym momencie mam już tylko błąd.
Proszę poradźcie jak wczytać do dynamic text do właściwej sceny i klatki.
KOD:
package {
import flash.display.MovieClip;
import flash.display.Scene;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.StyleSheet;
public class Bbb extends MovieClip {
private var textLoader:URLLoader;
private var cssLoader:URLLoader;
private var css:StyleSheet;
public function Bbb():void {
textLoader=new URLLoader;
textLoader.addEventListener(Event.COMPLETE,textLoaded);
textLoader.load(new URLRequest("welcom.txt"));
cssLoader=new URLLoader;
cssLoader.addEventListener(Event.COMPLETE,cssLoaded);
css=new StyleSheet;
}
private function cssLoaded(event:Event):void {
css.parseCSS(URLLoader(event.target).data);
tf.styleSheet=css;
tf.gotoAndStop(5).htmlText=textLoader.data;
}
private function textLoaded(event:Event):void {
cssLoader.load(new URLRequest("myCSS.css"));
}
}
}