Developing flash for Android

Source: Internet
Author: User

The project has finally reached the target entity Performance Test and preparation stage. The selected entity is the Android tablet. This tablet uses the turbo 2 chip and 1 GB memory. It supports 4-touch and meets our requirements.

The first step of performance testing is Benchmark Testing, which is to timing the creation of 3000 empty Sprite and then rendering 1000 faces in away3d.

It takes 2300 milliseconds to create an empty category on my e5300 + 2g pc, and 12000 milliseconds on the tablet, 6 times worse.

Area rendering counts FPS. It runs up to 144fps on a computer and up to 20 on a tablet. This has nothing to do with whether to select GPU acceleration for flash export. It may be that the related driver is not ready. The result is almost six times. Think of the two core frequencies of the e5300 to add up to about 5 GHz, while the flat CPU frequency is 1 GHz, the gap may be here.

The next step is to test the support for multi-touch in flash in Android. Although the relevant classes are officially provided, it is actually another thing.

Previously, we saw that the flash multi-touch was tested on the iPad after jailbreak. As a result, the iPad supports 11-point touch, and tou4's supports 5-point touch. However, gestures are not supported.

So I wrote a similar test.Code:

 
Textfield. Text = "Max points:" + multitouch. maxtouchpoints + "\ n" + "support gesture:" + multitouch. supportedgestures;

The running result is unexpected. the maximum number of points is 1, and the gesture is not supported.

It must be noted that android does not support directly opening the SWF file, so all tests are carried out in the browser. Later, I knew that some software could open the local SWF and test again, with the same results.

I suspect that the Flash Player Plug-in of Android cannot fully use the features and performance of the entire system (for example, GPU acceleration is not supported), so I turned to air and released the Code with air, then package it into an APK and install it on the tablet.

It took a long time to allow flash to export the APK directly. Previously, flash was used in the green version and the official air for Android plug-in could not be installed. Therefore, flash was reinstalled and the exit code was encountered during the re-installation: 7 error. Java runtime error occurs again after installation.

Of course, the APK was successfully released, and the running result was slightly surprising: it is indeed different from the browser version. The maximum touch point is 2, supporting all gestures.

Although the four touch points of the tablet are still not fully utilized, the two points are enough for gestures.

Then, the previous two benchmark projects were tested in the same way. The result remains unchanged. This is indeed a performance limit, there is no way.

The following is the away3d + touch code:

Package {import away3d. cameras. camera3d; import away3d. containers. scene3d; import away3d. containers. view3d; import away3d. debug. awaystats; import away3d. materials. wirecolormaterial; import away3d. primitives. sphere; import flash. display. sprite; import flash. UI. multitouch; import flash. UI. multitouchinputmode; import flash. events. *; public class test extends sprite {private var scene: scene3d; private var camera: camera3d; private var view: view3d; private var SP: sphere; Public Function Test () {scene = new scene3d (); camera = new camera3d (); camera. z =-800; view = new view3d (); view. scene = scene; view. camera = camera; view. X = stage. stagewidth/2; view. y = stage. stageheight/2; addchild (New awaystats (View); addchild (View); SP = new sphere (); SP. radius = 100; SP. segmentsh = 15; SP. segmentsw = 15; SP. material = new wirecolormaterial (0xff0000); scene. addchild (SP); multitouch. inputmode = multitouchinputmode. gesture; multitouch. supportedgesturesstage. addeventlistener (event. enter_frame, onenter); stage. addeventlistener (transformgestureevent. gesture_zoom, onzoom);} private function onzoom (E: transformgestureevent): void {Camera. Z + = 10;} private function onenter (E: Event): void {view. render ();}}}

The Code contains multitouch. inputmode = multitouchinputmode. gesture; this line tells flash Why touch is explained. Here it is interpreted as gesture. There are two options: touch_point, which is interpreted as a single touch point and none, it is interpreted as a mouse click event.

Only one of the three States can be selected. In fact, both gestures and single points are required, which leads to conflicts. The solution is to use multiple points of gestures to continue using mouse events.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.