A kind of method of editing rich text and showing by the FLASH reduction
Technical field
The present invention relates to software technology field, more particularly, relate to a kind of method of editing rich text and showing by the FLASH reduction.
Background technology
FLASH is a kind of 2 D animation design software.SWF (shock wave flash) is the professional format of the animation software FLASH of Macromedia company, it is a kind of animation file form of supporting vector and dot pattern, be widely used in webpage design, fields such as cartoon making, the SWF file is also referred to as the FLASH file usually.
Yet when FLASH software showed graph-text content at the assemblies such as TextField by itself, the picture demonstration misplaced the effect that presents in the time of can't obtaining editing easily.Therefore, be necessary to provide a kind of method that can edit and show by FLASH in the mode that both pictures and texts are excellent.
Summary of the invention
The technical problem to be solved in the present invention is, can not show the defective that graph-text content misplaces easily at existing FLASH software, and a kind of method of editing rich text and showing by the FLASH reduction is provided.
The technical solution adopted for the present invention to solve the technical problems is: construct a kind of method of editing rich text and showing by the FLASH reduction, may further comprise the steps:
S1, graph text information is carried out visual edit, and save as the RTF document by editing machine;
S2, the RTF document is changed into similar XHTML code and data resource;
S3, the above-mentioned similar XHTML code of use and data resource reduce in FLASH and show graph text information.
In method of the present invention, described step S2 further comprises:
S21, obtain in the RTF document that all ole object elements change into picture and attribute information is saved in the sequential chained list;
S22, obtain all the character object element property information of paragraph in the RTF document, merge with above-mentioned ole object attribute of an element information and be saved in the described sequential chained list;
The element node attribute information of S23, the above-mentioned sequential chained list of analysis resolves into text filed and the hyperlink zone;
S24, the text filed element node attribute information of analysis generate corresponding code;
S25, analysis hyperlink zone element node attribute information generate corresponding code.
In method of the present invention, described step S24 further comprises:
S241, the text filed element node attribute information of analysis, the text or the ole object zone of resolving into like attribute;
The text element node attribute information of S242, analysis like attribute generates corresponding code;
The element node attribute information in S243, analysis ole object zone generates corresponding code.
In method of the present invention, described step S25 further comprises:
S251, analysis hyperlink zone element node attribute information obtain hyperlink part and videotex part;
S252, obtain the URL of hyperlink;
S253, described videotex is partly changed, generated corresponding code;
The URL and the videotex code of S254, the above-mentioned hyperlink of assembling.
In method of the present invention, described step S3 further comprises:
S31, in Flash with the text mode loading classes like the XHTML code file, and it changed into XML class data structure preserve;
S32, analyzing XML class data are distinguished resource data and resource organizations's data;
S33, according to the picture resource address and the ID that write down among the XML, the resource that Loads Image is also preserved, and carries out ID simultaneously and judges, the resource that loaded is shared;
S34, resolving resource are organized data, it are resolved into textual portions and picture partly is the array of first primitive unit cell, resolve segment data simultaneously;
S35, parse the sign of each text element in the pairing picture and text array;
S36, hide sample text and show test;
S37, circulation shows the element in the picture and text array one by one, and carries out segmentation according to segment data, until having shown all elements;
S38, the element after showing is carried out an arrangement optimization finish picture and text and show.
In method of the present invention, described step S35 is specially: the restriction according to width comes videotex and picture, with the hidden text frame text is shown in advance, adjusts width and line feed; Determine whether being connected on according to the width of remaining width and picture and show behind the text or line feed shows.
The method of implementing editor's rich text of the present invention and showing by the FLASH reduction, have following beneficial effect: the present invention can carry out visual edit to graph text information simply and easily by editing machine, and can in FLASH, reduce the effect that when video text editing, presents, solved the FLASH software problem that picture misplaces fully when picture and text show.
Description of drawings
The invention will be further described below in conjunction with drawings and Examples, in the accompanying drawing:
Fig. 1 is the method flow diagram in the preferred embodiment of the present invention;
Fig. 2 is the particular flow sheet that in the preferred embodiment of the present invention RTF document is changed into similar XHTML code and data resource;
Fig. 3 is a particular flow sheet of analyzing the corresponding code of text filed generation in the preferred embodiment of the present invention;
Fig. 4 analyzes the particular flow sheet that the hyperlink zone generates corresponding code in the preferred embodiment of the present invention;
Fig. 5 be in the preferred embodiment of the present invention in FLASH reduction show the process flow diagram of graph text information.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.
The present invention mainly provides a kind of method of editing rich text and showing by the FLASH reduction, it mainly is to provide a video text editing device in client, allow user's content of edit, and content saved as the rich text format file, when needs issue this document content, can convert the RTF document that both pictures and texts are excellent to associated data files and resource file, and in FLASH loading data reduction graph-text content.By this technology, make the user can be when content of edit as in using board, What You See Is What You Get editor graph-text content generates the FLASH format file at last.The RTF that adopts in this process is a kind of rich text format file, and Chinese translation claims rich text format or rich text form etc. again.It also is the WordPad accepted standard form of Microsoft simultaneously.The RTF file is a kind of file of similar DOC form, and good compatibility is arranged, and uses " board " among the Windows " annex " just can open the edlin of going forward side by side.The RTF document can be used for carrying out the transmission of formatted text document between different application.
Below specific implementation process of the present invention is described.
See also Fig. 1, be the method flow diagram in the preferred embodiment of the present invention.As shown in Figure 1, method provided by the invention mainly may further comprise the steps:
At first in step S1, graph text information is carried out visual edit, and save as the RTF document by editing machine.For example at RichEdit control inediting graph text information, and save as the RTF file.
In step S2, the RTF document is changed into similar XHTML code and data resource subsequently.
At last, in step S3, use above-mentioned similar XHTML code and data resource in FLASH, to reduce and show graph text information.
Seeing also Fig. 2, is the particular flow sheet that in the preferred embodiment of the present invention RTF document is changed into similar XHTML code and data resource for the present invention.As shown in Figure 2, above-mentioned steps S2 further realizes by following scheme:
In step S21, obtain in the RTF document that all ole object elements change into picture and attribute information is saved in the sequential chained list.For example, analyze the ole object element among the MSFTEdit.dll, it is changed into corresponding picture and attribute information, be saved in and form OLEObjects in the sequential chained list.In this step, can also carry out CRC32 to the pictorial information resource and calculate, optimize identical resource and only preserve portion, to reduce the overall data amount.
In step S22, obtain all character object element property information of paragraph in the RTF document, merge to be saved in the described sequential chained list with above-mentioned ole object attribute of an element information and form MSFTObjects.
In step S23, analyze the element node attribute information of above-mentioned sequential chained list, resolve into text filed (Txt2Html) and hyperlink zone (HyperLink2Html).
In step S24, analyze text filed element node attribute information, generate corresponding code.
In step S25, analyze hyperlink zone element node attribute information, generate corresponding code.
See also Fig. 3, for analyzing the particular flow sheet of the corresponding code of text filed generation in the preferred embodiment of the present invention.As shown in Figure 3, among the above-mentioned steps S2, step S24 can further realize by the following method: in step S241, analyze text filed element node attribute information, resolve into the text or the ole object zone of like attribute.In step S242, analyze the text fragments element node attribute information of like attribute, generate corresponding code (as Words2Html).In step S243, analyze the element node attribute information in ole object zone, generate corresponding code (as OLE2Html).
See also Fig. 4, for analyzing the particular flow sheet that the hyperlink zone generates corresponding code in the preferred embodiment of the present invention.As shown in Figure 4, in above-mentioned steps S2, step S25 can further realize by the following method: in step S251, analyze hyperlink zone element node attribute information, obtain hyperlink part and videotex part.In step S252, obtain the URL of hyperlink.In step S253, described videotex is partly changed, generate corresponding code (as Txt2Html).In step S254, assemble the URL and the videotex code of above-mentioned hyperlink.Step S25 can carry out simultaneously with step S24.
See also Fig. 5, in FLASH, reducing the process flow diagram that shows graph text information in the preferred embodiment of the present invention.As shown in Figure 5, in said method of the present invention, step S3 further can realize by following steps:
In step S31, in Flash with the text mode loading classes like the XHTML code file, and it changed into XML class data structure preserve.
In step S32, analyzing XML class data are distinguished resource data and resource organizations's data.
In step S33, according to the picture resource address and the ID that write down among the XML, the resource that Loads Image is also preserved, and carries out ID simultaneously and judges, the resource that loaded is shared.
In step S34, resolving resource is organized data, it is resolved into textual portions and picture partly is the array of first primitive unit cell, resolves segment data simultaneously.
In step S35, parse the sign of each text element in the pairing picture and text array, so that follow-up demonstration one by one.
In step S36, hide sample text and show test.Mainly the restriction according to width comes videotex and picture, with the hidden text frame text is shown in advance, adjusts width and line feed; Determine whether being connected on according to the width of remaining width and picture and show behind the text or line feed shows.
In step S37, circulation shows the element in the picture and text array one by one, and carries out segmentation according to segment data, until having shown all elements.
In step S38, the element after showing is carried out arrangement optimization one time, and calculate the width and the height of viewing area, show all reduction work of finishing thereby finish picture and text.
In sum, the present invention can carry out visual edit to graph text information simply and easily by editing machine, and can reduce the effect that presents when video text editing in FLASH, has solved the FLASH software problem that picture misplaces fully when picture and text show.
The present invention is described according to specific embodiment, but it will be understood by those skilled in the art that when not breaking away from the scope of the invention, can carry out various variations and be equal to replacement.In addition, for adapting to the specific occasion or the material of the technology of the present invention, can carry out many modifications and not break away from its protection domain the present invention.Therefore, the present invention is not limited to specific embodiment disclosed herein, and comprises that all drop into the embodiment of claim protection domain.