[go: up one dir, main page]

CN104915199B - A kind of method and apparatus that Flash projects are converted to Html5 projects - Google Patents

A kind of method and apparatus that Flash projects are converted to Html5 projects Download PDF

Info

Publication number
CN104915199B
CN104915199B CN201510275422.4A CN201510275422A CN104915199B CN 104915199 B CN104915199 B CN 104915199B CN 201510275422 A CN201510275422 A CN 201510275422A CN 104915199 B CN104915199 B CN 104915199B
Authority
CN
China
Prior art keywords
flash
html5
environment
item
project
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510275422.4A
Other languages
Chinese (zh)
Other versions
CN104915199A (en
Inventor
谢成鸿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lanya Box Technology Co ltd
Original Assignee
Search Trip Network Technology (beijing) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Search Trip Network Technology (beijing) Co Ltd filed Critical Search Trip Network Technology (beijing) Co Ltd
Priority to CN201510275422.4A priority Critical patent/CN104915199B/en
Publication of CN104915199A publication Critical patent/CN104915199A/en
Application granted granted Critical
Publication of CN104915199B publication Critical patent/CN104915199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The application embodiment provides the method and apparatus that Flash projects are converted to Html5 projects.This method includes:Flash foundation class in Flash environment is written as in Html5 environment the function of Html5 to be called to realize the target foundation class of its function, the primary Runtime Library that Flash projects are related to is written as being capable of in Html5 environment the object run storehouse of normal operation, Flash projects are compiled according to preset configuration to realize conversion of the Flash projects to Html5 projects, there are adduction relationships with Flash foundation class for the primary Runtime Library that the Flash projects are related to.The application embodiment can improve the efficiency that Flash projects are converted to Html5 projects.

Description

Method and device for converting Flash item into Html5 item
Technical Field
The embodiment of the application relates to the technical field of information processing, in particular to a method and a device for converting a Flash project into an Html5 project.
Background
In the traditional internet era, Flash projects are largely applied based on various needs (such as advertisements, animation demonstration and the like), and the Flash technology supporting the Flash projects is taken as rendering and interaction technology and is fully valued. However, after the era of mobile internet, the mobile internet mainly uses Html5 as the mainstream technology, and the Html5 technology is incompatible with the Flash technology, so that a large number of Flash items cannot be smoothly transplanted to a mobile terminal, and the original Flash items which spend a large amount of time and energy to be developed are forced to be idle, and in order to avoid the resource waste, people urgently need a technology capable of converting the Flash items into the Html5 items.
In the prior art, there is a method for converting a Flash item into an Html5 item: the logic of the whole Flash project is analyzed, then the Html5 language is used for rewriting according to the analyzed logic, and the newly rewritten project adopts the Html5 language and can be directly used in the mobile internet environment with the Html5 as the mainstream technology. However, directly rewriting the Flash project in the Html5 language requires that technicians developing the Flash project know syntax rules of the Html5 language, which results in a significant increase in cost, and even if the technicians can use the Html5 language skillfully, converting the Flash project in the above manner is equivalent to developing a completely new project, which takes a long time, and some projects may reach half a year or even a year, which has low conversion efficiency and cannot meet the requirements of the era of the mobile internet.
Disclosure of Invention
In order to solve the above problem, the embodiments of the present application provide a method and a corresponding apparatus for converting a Flash item into an Html5 item, so as to improve the conversion efficiency from the Flash item to the Html5 item.
The method for converting the Flash project into the Html5 project, provided by the embodiment of the application, comprises the following steps:
writing a Flash basic class in a Flash environment into a target basic class which calls a function of Html5 in an Html5 environment to realize the function of the Flash basic class, writing a native runtime library related to a Flash project into a target runtime library which can normally run in an Html5 environment, and compiling the Flash project according to preset configuration to realize the conversion from the Flash project to the Html5 project, wherein the runtime library related to the Flash project has a reference relation with the Flash basic class.
Preferably, the method further comprises:
before compiling the Flash project, introducing a file generated based on the target base class and the target runtime library into the Flash project so as to perform support check by using the file when compiling the Flash project and determine whether variables and methods using the native runtime library in the Flash project are supported by the target runtime library and the target base class.
Preferably, writing the Flash base class in the Flash environment as a target base class for calling a function of Html5 in the Html5 environment to realize the function thereof includes:
analyzing a Flash API technical document in a Flash environment, obtaining interface function description of a Flash basic class in the Flash environment, and writing a target basic class compatible with the Html5 environment according to the interface function description.
Preferably, writing the runtime library related to the Flash project as a target runtime library capable of normally running in the Html5 environment includes:
analyzing a Flash API technical document in a Flash environment, obtaining a function implementation logic description of an operation library related to a Flash project, and writing a target operation library compatible with an Html5 environment according to the function implementation logic description.
Preferably, the Flash project further includes SWF resources, and the method further includes:
the SWF resources involved in the Flash project are written as display objects that can be normally displayed in the Html5 environment.
Preferably, the writing of the SWF resource related to the Flash project into the display object capable of being normally displayed in the Html5 environment includes:
analyzing the SWF resources according to a Flash API technical document corresponding to the SWF resources related to the Flash project, obtaining label information corresponding to the SWF resources, obtaining display information of a display object according to the label information, associating the display information with the class of a target operation library, and constructing the display object compatible with the Html5 environment according to the associated data.
Preferably, the method further comprises: and extracting the SWF resources in the Flash project from the Flash project for independent storage, and writing the SWF resources related to the Flash project into display objects capable of being normally displayed in the Html5 environment aiming at the independently stored SWF resources.
Preferably, the writing of the Flash base class in the Flash environment into a target base class which calls a function of Html5 in the Html5 environment to realize the function thereof, the writing of the runtime library related to the Flash item into a target runtime library which can normally run in the Html5 environment, and the compiling of the Flash item according to a preset configuration to realize the conversion from the Flash item to the Html5 item specifically include:
analyzing a Flash API technical document in a Flash environment, obtaining interface function description of a Flash basic class in the Flash environment, and compiling a target basic class according to the interface function description through AS3 language;
analyzing a Flash API technical document in a Flash environment, obtaining a function realization logic description of an operation library related to a Flash project, and compiling a target operation library code according to the function realization logic description through AS3 language;
target runtime library code written in the AS3 language and AS3 language file code of the Flash item are compiled AS Javascript code.
The embodiment of the application also provides another method for converting the Flash project into the Html5 project, which comprises the following steps:
receiving a Flash item, compiling the Flash item according to preset configuration to realize conversion from the Flash item to an Html5 item, wherein a Flash basic class of the Flash item in the Flash environment is compiled into a target basic class which calls a function of Html5 in an Html5 environment to realize functions of the Flash item, a native runtime library related to the Flash item is compiled into a target runtime library which can normally run in an Html5 environment, and reference relations exist between the native runtime library related to the Flash item and the Flash basic class.
The embodiment of the application also provides a device for converting the Flash item into the Html5 item. The device includes: a first authoring unit, a second authoring unit, and a compiling unit, wherein:
the first writing unit is used for writing the Flash basic classes in the Flash environment into target basic classes which call functions of the Html5 in the Html5 environment to realize functions of the Flash basic classes;
the second compiling unit is used for compiling the native runtime library related to the Flash project into a target runtime library which can normally run in the environment of Html 5;
the compiling unit is used for compiling the Flash item according to preset configuration so as to realize the conversion from the Flash item to the Html5 item, and the native runtime library related to the Flash item has a reference relation with the Flash basic class.
Preferably, the device further comprises a file introducing unit, configured to introduce a file generated based on the target base class and the target runtime library into the Flash project before compiling the Flash project;
and the compiling unit is also used for carrying out support check by using the file when compiling the Flash project and determining whether the variables and the methods using the native runtime library in the Flash project are supported by the target runtime library and the target basic class.
Preferably, the first programming unit includes a first analyzing subunit and a first programming subunit, wherein:
the first analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the interface function description of the Flash basic class in the Flash environment;
the first writing subunit is used for writing a target basic class compatible with the Html5 environment according to the interface function description.
Preferably, the second programming unit includes a second analysis subunit and a second programming subunit, wherein:
the second analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the function realization logic description of the runtime library related to the Flash project;
and the second writing subunit is used for writing a target runtime compatible with the Html5 environment according to the functional implementation logic description.
Preferably, the Flash item further includes SWF resources, and the apparatus further includes a third writing unit for writing the SWF resources related to the Flash item into display objects that can be normally displayed in the Html5 environment.
Preferably, the third writing unit includes a parsing subunit, an associating subunit and a constructing subunit, wherein:
the analysis subunit is used for analyzing the SWF resources according to the Flash API technical documents corresponding to the SWF resources related to the Flash items to obtain the label information corresponding to the SWF resources;
the association subunit is configured to obtain display information of a display object according to the tag information, and associate the display information with a class of a target runtime library;
and the construction subunit is used for constructing a display object compatible with the Html5 environment according to the associated data.
Preferably, the first programming unit includes a first analyzing subunit and a first programming subunit, and the second programming unit includes a second analyzing subunit and a second programming subunit, wherein:
the first analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the interface function description of the Flash basic class in the Flash environment;
the first writing subunit is used for writing a target basic class compatible with the Html5 environment according to the interface function description through an AS3 language;
the second analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the function realization logic description of the runtime library related to the Flash project;
the second writing subunit is used for writing a target runtime library compatible with the Html5 environment according to the function implementation logic description through the AS3 language;
and the compiling unit is used for compiling the target operation library code written by the AS3 language and the AS3 language file code of the Flash item into Javascript code.
According to the implementation mode of the application, the Flash basic classes in the Flash environment and the native runtime libraries related to the Flash items and having reference relations with the basic classes are rewritten and respectively written into the target basic classes calling the function of the Html5 in the Html5 environment to realize the functions of the target basic classes and the target runtime libraries capable of normally running in the Html5 environment, so that the conversion from the Flash items to the Html5 items is realized. Compared with the prior art, the implementation mode of the application is based on the existing Flash project, and the corresponding codes are rewritten in accordance with the Html5 environment instead of directly writing the whole Flash project by using the Html5 language, so that the time for converting the Flash project into the Html5 project is saved, and the conversion efficiency is improved.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 is a flow diagram illustrating one embodiment of a method for converting a Flash item to an Html5 item according to the present application;
FIG. 2 is a schematic flow chart diagram illustrating another embodiment of a method for converting a Flash item into an Html5 item according to the present application;
FIG. 3 is a schematic flow chart diagram illustrating a further embodiment of a method for converting a Flash item into an Html5 item according to the present application;
FIG. 4 is a block diagram illustrating components of an embodiment of an apparatus for converting a Flash item into an Html5 item according to the present application.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
To facilitate understanding of the technical solutions of the present application, several important terms are first described herein. In the embodiments of the present application to be described later, the term "item" will be referred to, and the term "item" can be understood as an operation object currently operating, that is, an object which needs to be converted from one environment to another environment, and in terms of the two environments discussed in the present application (that is, the Flash environment and the Html5 environment), before the conversion, the object is referred to as a Flash item, and after the conversion is completed, the converted object is referred to as a Html5 item, and the Flash item can be embodied as a Flash animation, a Flash application, or a Flash game which can normally run in the Flash environment. The Flash item can be hierarchically a complete application (game) or a part of a complete application (game), in other words, if the object currently operated is a complete application, the complete application can be referred to as a Flash item, and if the object currently operated is a part of an application, the part can also be referred to as a Flash item.
In the embodiment of the present application, a "native runtime library" and a "target runtime library" may also be mentioned, where the two are relative concepts and are used to implement mutual distinction, the native runtime library is a runtime library of Flash in a Flash environment, for example, Flash.
On the basis of introducing some important terms, the technical scheme of the application is explained below. Referring to fig. 1, in the present application, a Flash base class in a Flash environment is written as a target base class which calls a function of Html5 in an Html5 environment to realize a function thereof (step S11), a native runtime library related to a Flash item is written as a target runtime library which can normally run in an Html5 environment (step S12), and then the Flash item is compiled according to a preset configuration (step S13), so that the Flash item can be converted into an Html5 item. Through these several main steps, Flash items that were not directly executable in the Html5 environment are transformed into corresponding Html5 items that are executable in the Html5 environment. On one hand, the conversion process is to rewrite codes aiming at the basic classes of the Flash project such as the runtime library, the bottom rendering, the sound and the like on the basis of the original Flash project, and does not directly utilize the grammar rule of the Html5 language to develop a brand-new project, so that technicians for developing the original Flash project do not need to be forced to master new grammar rules, and further the overall human input is saved. On the other hand, because the existing project is not developed, the whole development progress can be greatly reduced, so that the Flash project which can only be operated on the traditional Internet originally can be operated on the mobile Internet (the environment of the Html 5) almost without great cost, and the efficiency of generating the Html5 project is improved. On the other hand, the time for generating the Html5 project can be greatly shortened according to the mode of the application, and the generated Html5 project has the same or similar function (or effect) as the Flash project of the traditional internet, so that the production of the Html5 product content is greatly accelerated and enriched, and the development of the mobile internet adopting the Html5 as the solution is further promoted. The implementation mode can form a conversion tool for converting the Flash item into the Html5 item, and when the environment conversion is needed, the Flash item to be converted is used as the 'input' of the conversion tool, so that the corresponding Html5 item can be automatically output, and the operation under the Html5 environment can be smoothly carried out.
The above embodiment may also be described from the perspective of a user performing Flash item conversion, so that a method of converting a Flash item into an Html5 item may include the steps of: receiving a Flash item, compiling the Flash item according to preset configuration to realize conversion from the Flash item to an Html5 item, wherein a Flash basic class of the Flash item in the Flash environment is compiled into a target basic class which calls a function of Html5 in an Html5 environment to realize functions of the Flash item, a native runtime library related to the Flash item is compiled into a target runtime library which can normally run in an Html5 environment, and reference relations exist between the native runtime library related to the Flash item and the Flash basic class.
Embodiments of the present application are described in further detail below with reference to the accompanying drawings. Referring to FIG. 2, a flow diagram of yet another embodiment of a method of converting a Flash item to an Html5 item of the present application is shown, the flow diagram including:
step S21: analyzing a Flash API technical document in a Flash environment to obtain interface function description of a Flash basic class in the Flash environment;
in order to change the current situation, the implementation mode analyzes the Flash API technical document in the Flash environment to obtain the interface function description of the Flash basic class in the Flash environment, and guides the subsequent code re-writing process through the interface function description so as to write the interface compatible with the Html 5.
Step S22: writing a target basic class compatible with the Html5 environment according to the interface function description;
target base classes compatible with the Html5 environment can be embodied in the fact that the rewritten target base classes can be normally used in the Html5 environment, and the target base classes can call functions of the Html5 to achieve functions of the target base classes. "compatibility" may also be understood from other aspects, for example, if the Javascript language can be supported in the Html5 environment, then the Flash base class may be written as a Javascript file, so that the target base class may be normally used in the Html5 environment.
Step S23: analyzing a Flash API technical document in a Flash environment to obtain function implementation logic description of an operation library related to a Flash project;
because the native runtime of Flash cannot be directly called in the Html5 environment, in order to realize the conversion from the Flash project to the Html5 project, the native runtime of Flash should be modified, so that the modified runtime (target runtime) is compatible with the Html5 environment. Here, the runtime (native runtime) used by a current Flash item may be all or only a part of the runtime of Flash, and in the process of converting a Flash item into an Html5 item, only the native runtime involved by the current Flash item may be used as an object of information processing. Specifically, during processing, a Flash API document corresponding to the runtime library provided by an Adode official is analyzed for each native runtime library, and a 'function implementation logic description' of the runtime library is obtained by analyzing the document, so that the description can be used for guiding a subsequent code rewriting process. The 'function implementation logic' is the intrinsic logic of the runtime that can implement its function, and analyzing the logic and using the logic to guide the code to rewrite, it can ensure that the function of the project will not change (too much) after the project is converted into the Html5 project.
Step S24: writing out a target runtime compatible with the Html5 environment according to the function implementation logic description;
step S25: and compiling the Flash item according to the preset configuration to realize the conversion from the Flash item to the Html5 item.
After the work of the steps, compiling is carried out on the Flash project, and the compiling can be carried out according to the actual requirement, so that the compiling can be realized based on the compiling configuration requirement. For example, an HTML wrapper file does not need to be generated in the compiling process of some items, and then the item may not be set in the compiling configuration, or for example, an argument may be set in the compiling configuration. Specifically, when the preset configuration is performed, the configuration can be completed in the configuration interface, that is, after the configuration request is triggered, the system presents the configuration interface to the configurator, each configuration item can be listed in the configuration interface usually in the form of check boxes, the configurator performs simple check, and then the system generates a configuration file according to the determined configuration items, thereby implementing the configuration. After this configuration is done, the conversion of the current Flash item to Html5 and the subsequent need to do similar conversions all use the configuration directly.
During the compiling process, the compiling work is completed according to the preset compiling configuration (such as a configuration file). In general, the compiling work can be smoothly performed. However, in some cases, various problems will occur in the compiling of the Flash project, and the whole compiling work can be smoothly completed after debugging and correcting the errors. For example, the following error cues may occur during compilation: "The name of The class name and package name conflicts" indicates that The error is caused by The same class name and package name in The code at The same level, and The class name is modified during debugging. As another example, such errors may occur in compilation: "for each", err, must add { }, suggesting this error because part of the browser in javascript does not support for each. In order to ensure compatibility, the converted javascript code adopts for loop simulation to realize for each, and braces are added in the AS3 code to wrap the for each scope.
Another common situation in compilation is that there may be some attributes or methods (also referred to as function methods, so as to be distinguished from the "methods" mentioned in the patent application) in the Flash item that are not supported by the target runtime library, thereby causing the compilation to be blocked, and for this reason, before compiling the Flash item, a file that can perform checking support can be introduced to determine whether variables and methods using the native runtime library in the Flash item are supported by the target runtime library and the target base class, so that the screening of the support of some attributes or function methods is automatically realized in the compilation process, and a support report (checking result) is formed, so that a debugger can perform debugging accordingly. In some embodiments of the present application, the file introduced in the Flash project may be a laya.
In the above embodiment, two important elements of the runtime and the base class of Flash are mentioned, although in general, after the runtime and the base class of Flash are modified to adapt to the Html5 runtime environment, the Flash project can be smoothly converted into the Html5 project (in some cases, some non-important codes in the Flash project, such as codes outside the runtime and the base class, can be easily converted into the Html5 environment). However, some Flash items also include SWF resources, and in this case, in order to smoothly realize the conversion from the Flash item to the Html5 item, the SWF resources also need to be processed. In the application, the SWF resource related to the Flash project is written into the display object which can be normally displayed in the Html5 environment, and specifically, the SWF resource may be analyzed according to the Flash API technical document corresponding to the SWF resource related to the Flash project, tag information corresponding to the SWF resource is obtained, display information of the display object is obtained according to the tag information, the display information is associated with the class of the target runtime library, and a display object, such as a picture and a character, which is compatible with the Html5 environment is constructed according to the associated data. By these processes, the SWF resources can also adapt to the Html5 environment, and can function normally in the Html5 environment. In some cases, based on specific needs, some preprocessing may be performed on the SWF resources, for example, the format of the SWF resource file is converted into an SWF resource file format that can be supported by the Html5 environment, multimedia data information such as pictures in the SWF resource file is extracted into an independent folder (independent storage), and subsequent operations may be performed on the independently stored SWF resources. For pictures, a large thumbnail set can also be generated from all the extracted pictures.
The two embodiments described above mention code re-writing of runtime libraries, base classes and SWF resources, and these three types of re-written code processes are performed in a particular order, it is particularly emphasized here, the order of execution of the three can be arranged based on practical application needs and the technical principles themselves, in the actual application process, in order to complete the conversion of the Flash item to the Html5 item, the choice of which aspect of code rewriting is performed first may be made according to actual needs, for example, in other embodiments of the present application, target base classes and target runways compatible with the Html5 environment may be written first for the base classes and runways involved in the Flash project, then, the processing is done for SWF resources (of course, this is the case when the Flash item has SWF resources), or, in other embodiments, other execution orders are taken.
In the above embodiment, it is mentioned that the basic class, the runtime library or the SWF resource related to the Flash project needs to be re-written with code, and the original code of the basic class, the runtime library or the SWF resource is written into the Html5 compatible target basic class, target runtime library or SWF resource accordingly. In actual practice, there are many ways to make the written base class, runtime library, or SWF resource compatible with Html 5. In the application, the AS3 language is adopted to realize code re-writing, and then the code written by the AS3 language is compiled into Javascript code (JS code), and the Javascript code can be directly used by the Html5, so that the aim of smoothly converting the Flash project into the Html5 project is fulfilled. Referring to fig. 3, a flow chart for implementing the technical solution of the present application by using AS3 language is shown. The process comprises the following steps:
step S31: analyzing a Flash API technical document in a Flash environment to obtain interface function description of a Flash basic class in the Flash environment;
step S32: writing a target basic class according to the interface function description through an AS3 language;
the AS3 language (ActionScript 3 language) is a scripting language provided by Adobe corporation for operating Flash, and by using the language, runtime libraries, interfaces and the like related to writing Flash projects are described according to functional implementation logic, so that coding tasks can be realized relatively quickly without increasing labor cost (in this sense, the Flash projects can also be called AS3 projects).
Step S33: analyzing a Flash API technical document in a Flash environment to obtain function implementation logic description of an operation library related to a Flash project;
step S34: writing target runtime library codes according to the function implementation logic description through AS3 language;
step S35: target runtime library codes written through AS3 language and AS3 language file codes of Flash items are compiled into Javascript codes, so that conversion from Flash items to Html5 items is realized.
The file converted into the Javascript code may be a unique JS file or a plurality of JS files, as long as the JS file can be used in the Html5 environment.
The above description is mainly a full-flow description from the perspective of implementing the conversion from the Flash project to the Html5 project, however, in the actual application process, some work may have been completed in advance, and the completed content is embedded into a software tool, and the user can implement the conversion from the Flash project to the Html5 project by using the software tool. For example, from the perspective of a user using a software tool, it is first necessary to install an executable integrated packaging tool on a terminal device, which can install a compiler tool, a runtime library, a resource handling tool, etc. on a computer. Then, in a development tool (e.g., Flash Builder), one AS3 project (Flash project) is created (opened) and the Html5 compilation configuration is set for publishing the Html5 project. Subsequently, a laya.swc file generated by compiling the rewrite runtime is introduced into the AS3 project, and the laya.swc file is used to detect which classes of variables and methods in the AS3 project are supported by the rewritten runtime. Next, the installed integrated packaging tool is opened, and the SWF resource files used in the AS project are converted into a data format supported by the application through the resource tool function. Then, the rewritten runtime (target runtime) and AS3 project files are compiled into JavaScript (JS) files supported by the Html5 by a compiling configuration call compiler, so that the conversion of the whole Flash project into the Html5 project is completed.
The foregoing details various embodiments of methods of how to convert a Flash item to an Html5 item, and in correspondence with these method embodiments, the present application also provides embodiments of an apparatus of how to convert a Flash item to an Html5 item. Referring to FIG. 4, a block diagram of a component structure of an embodiment of the apparatus for converting a Flash item into an Html5 item of the present application is shown. The device includes: a first authoring unit U41, a second authoring unit U42, and a compilation unit U43, wherein:
the first writing unit U41 is used for writing the Flash basic classes in the Flash environment into target basic classes which call functions of the Html5 in the Html5 environment to realize the functions of the Flash basic classes;
the second compiling unit U42 is used for compiling the native runtime library related to the Flash project into a target runtime library which can normally run in the environment of the Html 5;
and the compiling unit U43 is used for compiling the Flash item according to preset configuration so as to realize the conversion from the Flash item to the Html5 item, wherein the native runtime library related to the Flash item has a reference relation with the Flash basic class.
The working process of the embodiment of the device is as follows: the first compiling unit U41 compiles the Flash basic class in the Flash environment into a target basic class which calls a function of the Html5 in the Html5 environment to realize the function of the Flash basic class, the second compiling unit U42 compiles the native runtime library related to the Flash item into a target runtime library which can normally run in the Html5 environment, and the compiling unit U43 compiles the Flash item according to preset configuration to realize the conversion from the Flash item to the Html5 item. This embodiment of the apparatus is capable of achieving the same or similar technical effects as the above-described embodiment of the method, and it is not further elaborated here to avoid repetition. It should be noted here that the first writing unit and the second writing unit may perform their respective functions simultaneously, or may execute them "in tandem", depending on the information processing capability currently available, and may perform them simultaneously if the information processing capability is strong.
In the above device embodiment, the compiling unit is provided, some errors may occur in the compiling process in some cases, and the debugging should be performed according to these errors, so that the compiling operation is performed smoothly. In order to achieve the purpose, the apparatus embodiment may further include a file importing unit, configured to import, before compiling the Flash item, a file generated based on the target base class and the target runtime library into the Flash item. In this way, the compiling unit is further configured to perform a support check using the file when compiling the Flash project, and determine whether variables and methods using the native runtime in the Flash project are supported by the target runtime and the base class.
The constituent elements of the above-described device embodiments may have different implementations when implementing their functions. Different implementations of the functional units may result in different internal structures of the functional units. For example, in the above apparatus embodiment, the second writing unit U42 may seek a corresponding function implementation logic description by analyzing a Flash API document corresponding to the runtime library, and then write the runtime library compatible with the Html5 environment according to the function implementation logic description, in this case, the second writing unit U42 may include a second analyzing subunit U421 and a second writing subunit U422, where:
the second analysis subunit U421 is configured to analyze a Flash API technical document in a Flash environment, and obtain a function implementation logic description of an runtime library related to a Flash project;
and the second writing subunit U422 is used for writing out a target runtime compatible with the environment of the Html5 according to the function implementation logic description.
Based on the same reasoning as above, the first writing unit U41 may include a first analyzing subunit U411 and a first writing subunit U412, wherein:
the first analysis subunit U411 is used for analyzing a Flash API technical document in a Flash environment and obtaining interface function description of a Flash basic class in the Flash environment;
and the first writing subunit U412 is used for writing a target basic class compatible with the Html5 environment according to the interface function description. Besides, the technical effect can be enhanced or the adaptability to the actual needs can be improved by specifying the internal structure of the functional unit, and the device embodiment can be improved and optimized by adding a new functional unit according to needs. In practical applications, there may be cases where: in the case that the Flash item includes the SWF resource, the above apparatus embodiment may further include a third writing unit U43 for writing the SWF resource related to the Flash item as a display object that can be normally displayed in the Html5 environment. Specifically, the third writing unit U44 may include a parsing subunit U441, an association subunit U442, and a construction subunit U443, where:
the analysis subunit U441 is configured to analyze the SWF resource according to the Flash API technical document corresponding to the SWF resource related to the Flash project, and obtain tag information corresponding to the SWF resource;
the association subunit U442 is configured to obtain display information of a display object according to the tag information, and associate the display information with a class of a target runtime library;
and a constructing subunit U443, configured to construct a display object compatible with the Html5 environment according to the tag information and the target runtime library.
In the above-described embodiment of the apparatus, the first authoring unit U41 and the second authoring unit U42 and the authoring unit U43 may be coupled together in a closer relationship or may be presented in a loose relationship. For example, the first writing unit and the second writing unit respectively implement the task of writing code compatible with Html5 in different ways, and the two functional units are relatively independent and show a loose relationship. In some cases, it may be more desirable to have the relationship between the two, for example, the two codes are rewritten in the same language, which can save development cost and improve the flow of each functional unit of the whole device to implement its function. In the present application, an apparatus embodiment is provided in which the first writing unit and the second writing unit implement their respective functions in the same language (AS3 language), and their relationship is relatively tight. Specifically, the first programming unit in the above apparatus embodiment may include a first analyzing subunit and a first programming subunit, where:
the first analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the interface function description of the Flash basic class in the Flash environment;
the first writing subunit is used for writing a target basic class compatible with the Html5 environment according to the interface function description through an AS3 language;
the second programming unit may include a second analysis subunit and a second programming subunit, wherein:
the second analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the function realization logic description of the runtime library related to the Flash project;
the second writing subunit is used for writing a target runtime library compatible with the Html5 environment according to the function implementation logic description through the AS3 language;
in such an apparatus embodiment, the compiling unit is further configured to compile target runtime code written in the AS3 language and AS3 language file code of the Flash item into Javascript code. The compiling unit may also have a different structure depending on the way it implements transcoding.
In fact, the above-mentioned embodiments of the apparatus of the present application may be modified according to actual needs to achieve better technical effects, in addition to the above-mentioned various modifications. It should also be noted here that although in the above detailed description several units (sub-units) of the means of converting the Flash item into the Html5 item are mentioned, this division is not mandatory. In practice, the features and functions of two or more units described above may be embodied in one apparatus or in different apparatuses according to embodiments of the invention. And conversely, features and functions of a unit described above may be further divided into embodiments by sub-units.
Further, while the operations of the method of converting Flash items to Html5 items of the present invention are depicted in the drawings in a particular order, as previously mentioned, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (12)

1. A method of converting a Flash item to an Html5 item, the method comprising:
writing a Flash basic class in a Flash environment into a target basic class which calls a function of Html5 in an Html5 environment to realize the function of the Flash basic class, writing a native runtime library related to a Flash project into a target runtime library which can normally run in an Html5 environment, and compiling the Flash project according to preset configuration to realize the conversion from the Flash project to the Html5 project, wherein the native runtime library related to the Flash project has a reference relation with the Flash basic class; wherein,
the writing of the Flash basic class in the Flash environment into the target basic class which calls the function of the Html5 in the Html5 environment to realize the function of the Flash basic class comprises the following steps:
analyzing a Flash API technical document in a Flash environment, obtaining interface function description of a Flash basic class in the Flash environment, and compiling a target basic class compatible with the Html5 environment according to the interface function description;
the writing of the runtime library related to the Flash project into a target runtime library capable of normally running in the Html5 environment includes:
analyzing a Flash API technical document in a Flash environment, obtaining a function implementation logic description of an operation library related to a Flash project, and writing a target operation library compatible with an Html5 environment according to the function implementation logic description.
2. The method of claim 1, further comprising: before compiling the Flash project, introducing a file generated based on the target base class and the target runtime library into the Flash project so as to perform support check by using the file when compiling the Flash project and determine whether variables and methods using the native runtime library in the Flash project are supported by the target runtime library and the target base class.
3. The method of claim 1, wherein the Flash item further comprises SWF resources, the method further comprising:
the SWF resources involved in the Flash project are written as display objects that can be normally displayed in the Html5 environment.
4. The method according to claim 3, wherein the writing of the SWF resource related to the Flash item as the display object which can be normally displayed in the Html5 environment specifically comprises:
analyzing the SWF resources according to a Flash API technical document corresponding to the SWF resources related to the Flash project, obtaining label information corresponding to the SWF resources, obtaining display information of a display object according to the label information, associating the display information with the class of a target operation library, and constructing the display object compatible with the Html5 environment according to the associated data.
5. The method of claim 3, further comprising:
and extracting the SWF resources in the Flash project from the Flash project for independent storage, and writing the SWF resources related to the Flash project into display objects capable of being normally displayed in the Html5 environment aiming at the independently stored SWF resources.
6. The method according to any one of claims 1 to 5, wherein writing the Flash base class in the Flash environment as a target base class calling a function of the Html5 in the Html5 environment to realize the function thereof, writing the runtime library related to the Flash item as a target runtime library capable of normally running in the Html5 environment, and compiling the Flash item according to a preset configuration to realize the conversion of the Flash item to the Html5 item specifically comprises:
analyzing a Flash API technical document in a Flash environment, obtaining interface function description of a Flash basic class in the Flash environment, and compiling a target basic class according to the interface function description through AS3 language;
analyzing a Flash API technical document in a Flash environment, obtaining a function realization logic description of an operation library related to a Flash project, and compiling a target operation library code according to the function realization logic description through AS3 language;
target runtime library code written in the AS3 language and AS3 language file code of the Flash item are compiled AS Javascript code.
7. A method of converting a Flash item to an Html5 item, the method comprising:
receiving a Flash item, compiling the Flash item according to preset configuration to realize conversion from the Flash item to an Html5 item, wherein a Flash basic class of the Flash item in the Flash environment is compiled into a target basic class which calls a function of Html5 in an Html5 environment to realize functions of the Flash item, a native runtime library related to the Flash item is compiled into a target runtime library which can normally run in the Html5 environment, and the native runtime library related to the Flash item has a reference relation with the Flash basic class; wherein,
the writing of the Flash basic class in the Flash environment into the target basic class which calls the function of the Html5 in the Html5 environment to realize the function of the Flash basic class comprises the following steps:
analyzing a Flash API technical document in a Flash environment, obtaining interface function description of a Flash basic class in the Flash environment, and compiling a target basic class compatible with the Html5 environment according to the interface function description;
the writing of the runtime library related to the Flash project into a target runtime library capable of normally running in the Html5 environment includes:
analyzing a Flash API technical document in a Flash environment, obtaining a function implementation logic description of an operation library related to a Flash project, and writing a target operation library compatible with an Html5 environment according to the function implementation logic description.
8. An apparatus for converting a Flash item into an Html5 item, the apparatus comprising: a first authoring unit, a second authoring unit, and a compiling unit, wherein:
the first writing unit is used for writing the Flash basic classes in the Flash environment into target basic classes which call functions of the Html5 in the Html5 environment to realize functions of the Flash basic classes;
the second compiling unit is used for compiling the native runtime library related to the Flash project into a target runtime library which can normally run in the environment of Html 5;
the compiling unit is used for compiling the Flash item according to preset configuration so as to realize the conversion from the Flash item to the Html5 item, and a reference relation exists between a native runtime library related to the Flash item and a Flash basic class; wherein,
the first programming unit comprises a first analysis subunit and a first programming subunit, wherein:
the first analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the interface function description of the Flash basic class in the Flash environment;
the first writing subunit is used for writing a target basic class compatible with the Html5 environment according to the interface function description;
the second programming unit comprises a second analysis subunit and a second programming subunit, wherein:
the second analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the function realization logic description of the runtime library related to the Flash project;
and the second writing subunit is used for writing a target runtime compatible with the Html5 environment according to the functional implementation logic description.
9. The apparatus according to claim 8, further comprising a file importing unit, configured to import a file generated based on the target base class and the target runtime library into the Flash project before compiling the Flash project;
and the compiling unit is also used for carrying out support check by using the file when compiling the Flash project and determining whether the variables and the methods using the native runtime library in the Flash project are supported by the target runtime library and the basic class.
10. The apparatus of claim 8, wherein the Flash item further comprises SWF resources, and the apparatus further comprises a third authoring unit for authoring the SWF resources related to the Flash item as display objects that can be normally displayed in an Html5 environment.
11. The apparatus of claim 10, wherein the third composition unit comprises a parsing subunit, an association subunit, and a construction subunit, wherein:
the analysis subunit is used for analyzing the SWF resources according to the FlashAPI technical document corresponding to the SWF resources related to the Flash project and acquiring label information corresponding to the SWF resources;
the association subunit is configured to obtain display information of a display object according to the tag information, and associate the display information with a class of a target runtime library;
and the construction subunit is used for constructing a display object compatible with the Html5 environment according to the associated data.
12. The apparatus of claim 8, wherein the first composition unit comprises a first analysis subunit and a first composition subunit, and wherein the second composition unit comprises a second analysis subunit and a second composition subunit, wherein:
the first analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the interface function description of the Flash basic class in the Flash environment;
the first writing subunit is used for writing a target basic class compatible with the Html5 environment according to the interface function description through an AS3 language;
the second analysis subunit is used for analyzing the Flash API technical document in the Flash environment and obtaining the function realization logic description of the runtime library related to the Flash project;
the second writing subunit is used for writing a target runtime library compatible with the Html5 environment according to the function implementation logic description through the AS3 language;
and the compiling unit is used for compiling the target operation library code written by the AS3 language and the AS3 language file code of the Flash item into Javascript code.
CN201510275422.4A 2015-05-26 2015-05-26 A kind of method and apparatus that Flash projects are converted to Html5 projects Active CN104915199B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510275422.4A CN104915199B (en) 2015-05-26 2015-05-26 A kind of method and apparatus that Flash projects are converted to Html5 projects

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510275422.4A CN104915199B (en) 2015-05-26 2015-05-26 A kind of method and apparatus that Flash projects are converted to Html5 projects

Publications (2)

Publication Number Publication Date
CN104915199A CN104915199A (en) 2015-09-16
CN104915199B true CN104915199B (en) 2018-05-22

Family

ID=54084283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510275422.4A Active CN104915199B (en) 2015-05-26 2015-05-26 A kind of method and apparatus that Flash projects are converted to Html5 projects

Country Status (1)

Country Link
CN (1) CN104915199B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656947B (en) * 2016-10-24 2022-06-07 腾讯科技(北京)有限公司 Multimedia information playing method and device
US11062497B2 (en) 2017-07-17 2021-07-13 At&T Intellectual Property I, L.P. Structuralized creation and transmission of personalized audiovisual data
CN107632833A (en) * 2017-07-31 2018-01-26 广州神马移动信息科技有限公司 Generation method, equipment and the electronic equipment gently applied
CN116009959B (en) * 2023-01-17 2024-02-27 广州创盒信息科技有限公司 Flash item transplanting method, device and system and storage medium
CN118072796B (en) * 2024-03-12 2025-02-11 北京中科昊芯科技有限公司 A device and method for programming and managing Flash memory

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469065A (en) * 2010-11-02 2012-05-23 腾讯科技(深圳)有限公司 Method and system for communicating data with HTML5 browser
CN103176986A (en) * 2011-12-20 2013-06-26 上海博泰悦臻电子设备制造有限公司 Method for converting flash animation data into hypertext markup language (HTML) 5 data

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102469065A (en) * 2010-11-02 2012-05-23 腾讯科技(深圳)有限公司 Method and system for communicating data with HTML5 browser
CN103176986A (en) * 2011-12-20 2013-06-26 上海博泰悦臻电子设备制造有限公司 Method for converting flash animation data into hypertext markup language (HTML) 5 data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
The design and implementation of Google Swiffy: a Flash to HTML5 converter;Pieter Albertus Mathijs Senster;《https://repository.tudelft.nl/islandora/object/uuid:cab4b862-d662-432a-afa4-45ccb725177f/?collection=research》;20121231;第17-21,25,41-42页 *

Also Published As

Publication number Publication date
CN104915199A (en) 2015-09-16

Similar Documents

Publication Publication Date Title
JP5415557B2 (en) User script code conversion for debugging
US7478366B2 (en) Debugger and method for debugging computer programs across multiple programming languages
US10540262B2 (en) Using edit and continue to dynamically set and unset optimizations in source code while debugging
JP6122493B2 (en) Adaptively portable library
CN104915199B (en) A kind of method and apparatus that Flash projects are converted to Html5 projects
Wu et al. Grammar‐driven generation of domain‐specific language debuggers
US20130167128A1 (en) Application Compiling
CN111090433A (en) Data processing method, device and storage medium
CN110673837B (en) Code repairing method and device, electronic equipment and computer readable storage medium
CN110737589A (en) automatic point burying method, device, medium and electronic equipment
US8930925B2 (en) Method for enabling compilation of a Cobol source program utilizing a two-stage compilation process, the Cobol source program including a mix of Cobol, C++ or JAVA statements, and optional OpenMP directives
US20160299831A1 (en) Target Typing-dependent Combinatorial Code Analysis
CN109901841A (en) A method of display methods call graph when checking java bytecode
Dévai et al. Textual, Executable, Translatable UML.
JP6845429B2 (en) Compiler program, information processing device and compilation method
US20110072371A1 (en) Application programming interface for user interface creation
Bouraqadi et al. Test-driven development for generated portable Javascript apps
Jansen et al. TypeScript: Modern JavaScript Development
US11714609B2 (en) Automatic generation of source code implementing a regular expression
US11573787B1 (en) Hot reloading a running application with an unsaved source code change
CN104657191A (en) Method and device for converting Flash item to Html5 item
Blunk et al. Efficient development of domain-specific simulation modelling languages and tools
Antebi et al. Cross-compiling android applications to windows phone 7
Wąsowski et al. Building Modeling Languages
Stephens C# 5.0 Programmer's reference

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Xie Chenghong

Inventor after: Wang Yawei

Inventor after: Hu Gao

Inventor after: Ma Yukai

Inventor before: Xie Chenghong

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 100094 1301, building 4, area 4, courtyard 81, Beiqing Road, Haidian District, Beijing

Patentee after: Beijing LANYA Box Technology Co.,Ltd.

Address before: 100142 Room 305, 3rd floor, building 1, No.158, North West Fourth Ring Road, Haidian District, Beijing

Patentee before: Soyou network technology (Beijing) Co.,Ltd.