ich hab ein Problem undzwar...
wie kann ich in ein Textfeld den Text aus einer Datei dort reinladen und gleichzeitig mit einem CSS Style versehen ?
Also das reinladen hab ich jetzt schonmal hinbekommen. Und was zu dem CSS hab ich auch gefunden, aber es funktioniert noch nicht beides auf einmal.
Diesen Code hab ich für den CSS Style gefunden....
Quellcode
- //Create a new style sheet object
- var myCSS = new TextField.StyleSheet();
- //Specify the location of the CSS file that you created earlier
- var cssURL = "example.css";
- //Hard code some HTML text to display (for example purposes)
- exampleText = "<p class='headline'>Tutorial Takes Forever To Write</p>";
- exampleText += "<p><span class='byline'>Bath, UK</span>";
- exampleText += "--Flash developer NWebb seemed to take ";
- exampleText += "forever to finish his CSS-Flash tutorial, ";
- exampleText += "but it is finished now and you can find it ";
- exampleText += "<a href='http://www.nwebb.co.uk'>here</a> ";
- exampleText += "along with a few others.</p>";
- //Load CSS file
- myCSS.load(cssURL);
- //define onLoad handler
- myCSS.onLoad = function(success) {
- if (success) {
- /* If the style sheet loaded without error,
- assign it to the text object, and assign the HTML text to the
- text field*/
- myText.styleSheet = myCSS;
- myText.text = exampleText; //this should be ".htmlText",
- // but Flash seems to recognise that the textbox needs to display html anyway
- }
- };
Aber wie man sieht, steht der Text in dem Code und nicht in einer Datei.
Und den Code hab ich für die externe Textdatei gefunden ...
Ich hab jetzt schon versucht den Code irgendwie zusammen zu bekommen hat aber bis jetzt nicht geklappt.
Vielleicht habt ihr ne Idee wie ich das machen kann ?!
Danke schon mal !