Summary of the invention
To sum up, the technical problem to be solved in the present invention is how to realize the information extraction of Flash source document, realizes the complete extraction of the information such as the inner scene of Flash source document, figure layer and element.For realizing that the test and appraisal of Flash cartoon making area of computer aided provide a kind of feasible technical solution.
According to an aspect of the present invention, provide a kind of method of Flash source file element extraction, it is characterized in that:
Use FLfile object accesses Flash source document, and resolve the element information of described Flash source document.
Preferably, described method specifically realizes by following steps:
The read method of S0, use FLFile object is obtained the complete trails information that needs the Flash of information extraction source document and is assigned to a FilePath string variable from the text of assigned address; Use the fl.openDocument method of Flash object to open the Flash source document of appointment, if method runs succeeded, return to the Document object of opening document;
S1, use the base attribute of Document object acquisition Flash source document, obtain the animation essential information of Flash source file, generate Document root node and correlation attribute information;
S2, by the Library subobject of traversal Document object, obtain all kinds of materials and component information in Flash source document storehouse; Obtain the interior various object information of figure layer, key frame and key frame of element, and generate corresponding object node and attribute information;
S3, by the Timeline object of traversal Document object, obtain each scene information of Flash source document; Obtain the interior various object information of figure layer, key frame and key frame of each scene, and generate corresponding Object node and attribute information;
S4, the Flash source document information exchange of extraction is crossed to the FLfile.write method generate XML document, use the fl.closeDocument method to close the F1ash source document in the mode of not preserving.
Preferably, by the form of XML, organize and mean the Flash source document element information extracted, with reference to Flash DOM Document Object Model hierarchical structure, the Flash Object table being shown as to the Object node of naming with the Flash object oriented in XML document; The attribute of Flash object and attribute value table are shown to attribute and the property value of corresponding XML Object node; The subobject of Flash object is expressed as to the child node of Object node.
According to a further aspect in the invention, provide a kind of device of Flash source file element extraction, it is characterized in that comprising:
For using FLfile object accesses Flash source document, and resolve the device of the element information of described Flash source document.
Preferably, described device specifically comprises:
For using the read method of FLFile object to obtain the complete trails information that needs the Flash of information extraction source document and be assigned to a FilePath string variable from the text of assigned address; Use the fl.openDocument method of Flash object to open the Flash source document of appointment, if method runs succeeded, return to the device of the Document object of opening document;
For using the base attribute of Document object acquisition Flash source document, obtain the animation essential information of Flash source file, generate the device of Document root node and correlation attribute information;
Library subobject for by traversal Document object, obtain all kinds of materials and component information in Flash source document storehouse; Obtain the interior various object information of figure layer, key frame and key frame of element, and generate the device of corresponding object node and attribute information;
For the Timeline object by traversal Document object, obtain each scene information of Flash source document; Obtain the interior various object information of figure layer, key frame and key frame of each scene, and generate the device of corresponding Object node and attribute information;
Generate XML document for the Flash source document information exchange of extraction being crossed to the FLfile.write method, use the fl.closeDocument method to close the device of F1ash source document in the mode of not preserving.
Preferably, by the form of XML, organize and mean the Flash source document element information extracted, with reference to Flash DOM Document Object Model hierarchical structure, the Flash Object table being shown as to the Object node of naming with the Flash object oriented in XML document; The attribute of Flash object and attribute value table are shown to attribute and the property value of corresponding XML Object node; The subobject of Flash object is expressed as to the child node of Object node.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage are become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
In order successfully to obtain the internal information of Flash source document, must solve two problems: the one, the induced representation problem of the importing of external information and obtaining information; The 2nd, how to realize obtaining of Flash internal information.The FLfile object allows to write the Flash expansion shell script that can conduct interviews, revise and delete the file in local file system and file.FLfileAPI provides with the form of JavaScriptAPI expansion.Utilize it can solve the problem that external information imports and obtaining information is derived.The Flash object provides the DOM Document Object Model based on Flash JavaScript API (DOM), allow design to realize the access of Flash source document with reference to the JavaScript script application programe of this model, and access one by one and obtain object information by the Object hierarchical structure of DOM Document Object Model, obtaining information is organized and means by the form of XML.The principle that tissue means is with reference to Flash DOM Document Object Model hierarchical structure, the Flash Object table to be shown as to the Object node of naming with the Flash object oriented in XML document; The attribute of Flash object and attribute value table are shown to attribute and the property value of corresponding XML Object node; The subobject of Flash object is expressed as to the child node of Object node.
According to the foregoing invention design, the method flow diagram by Fig. 1 exemplified with a kind of Flash source file of embodiment of the present invention element extraction, as shown in Figure 1, described method comprises step:
The read method of S0, use FLFile object is obtained the complete trails information that needs the Flash of information extraction source document and is assigned to a FilePath string variable from the text of assigned address; Use the fl.openDocument method of Flash object to open the Flash source document of appointment, if method runs succeeded, return to the Document object of opening document;
S1, use the base attribute of Document object acquisition Flash source document, obtain the animation essential information of Flash source file, generate Document root node and correlation attribute information;
S2, by the Library subobject of traversal Document object, obtain all kinds of materials and component information in Flash source document storehouse; Obtain the interior various object information of figure layer, key frame and key frame of element, and generate corresponding object node and attribute information;
S3, by the Timeline object of traversal Document object, obtain each scene information of Flash source document; Obtain the interior various object information of figure layer, key frame and key frame of each scene, and generate corresponding Object node and attribute information;
S4, the Flash source document information exchange of extraction is crossed to the FLfile.write method generate XML document, use the fl.closeDocument method to close the F1ash source document in the mode of not preserving.
More than introduced the embodiment of the inventive method, in addition, the present invention also comprises corresponding device.Because device of the present invention can be take computer program fully and realized as basic mode, so its apparatus structure can, according to realizing with the corresponding consistent apparatus module mode of method step, for example be realized according to the described mode of guidelines for examination chapter 9.Because its module setting can change according to the various combination of method step, here no longer to method step corresponding module setting repeat to repeat, those skilled in the art with reference to before the method embodiment can learn this apparatus structure fully.
It is more than the detailed description that the preferred embodiments of the present invention are carried out, but those of ordinary skill in the art is to be appreciated that, within the scope of the present invention, and guided by the spirit, various improvement, interpolation and replacement are all possible, such as using the algorithm can realize functional purpose of the same race, use that different programming language (as C, C++, Java etc.) is realized etc.In these protection domains that all limit in claim of the present invention.