tailieunhanh - Flash XML Applications Use AS2 and AS3 to Create Photo Galleries, Menus, and Databases phần 3

Chúng tôi cũng có thêm các nhà xây dựng có tất cả mọi thứ hoàn toàn, ngay cả khi các nhà xây dựng sẽ ở lại trống rỗng. nhập khẩu, lớp học mở rộng ; công var cssUrl: String; var chủ proxy công cộng: Boolean; công var nering; tư nhân var ; | Chapter 6 Tutorial Creating a Universal XHTML Parser we need it most of the time. We do not need the Delegate class within the parsing function since it was included already in the XML loading class. Now we can write the first code starting with the import statements. We also add the constructor to have everything complete even if the constructor will stay empty. import import import class extends MovieClip private var myText TextArea public var cssUrl String public var proxy Boolean public var newXml String private var iniXml private var defaultXML XML public function Decodehtm_simple Except for variables which will be called from the movie we make all var iables pr ivate to prevent them from being accessed from the movie or from other classes. The Main Function xmlLoad Now after finishing what I would call the head part of a class script we will write some functions. The first function is the one that we call from the movie. We name it xmlLoad and it will have three parameters cssUrl to load the style sheet newXml to load the XML file and proxy in case we want to load external files from a different server. Before we do anything further we set HTML true for the TextArea component instant true Then we load the style sheet since we have to apply the style sheet onto the text field or text area before the text is loaded and displayed. We have already learned a lot about loading XML files in a previous chapter so loading a style sheet is similar. We create an instance of the StyleSheet class by creating a local variable xmlCss var xmlCss newTextField. StyleSheet Now the Delegate class becomes handy since we can extend the scope of the onLoad event function and access objects outside of the function using the this word this loadCss Flash XML Applications The onLoad event is executed only when the file is .

TỪ KHÓA LIÊN QUAN