36937
504
Zoom out
Zoom in
Vorherige Seite
1/527
Nächste Seite
FLASH CS3
User Guide
498
Optimizing ActionScript for Flash Lite content on mobile devices
Because of the processing speed and memory limitations on most mobile devices, follow these guidelines when
developing ActionScript for Flash Lite content used on mobile devices:
Keep the file and its code as simple as possible. Remove unused movie clips, delete unnecessary frame and code
loops, and avoid too many frames or extraneous frames.
Using FOR loops can be expensive because of the overhead incurred while the condition is checked with each
iteration. When the costs of the iteration and the loop overhead are comparable, execute multiple operations
individually instead of using a loop. The code may be longer, but performance will improve.
Stop frame-based looping as soon as it is no longer needed.
When possible, avoid string and array processing because it can be CPU-intensive.
Always try to access properties directly rather than using ActionScript getter and setter methods, which have more
overhead than other method calls.
Manage events wisely. Keep event listener arrays compact by using conditions to check whether a listener exists
(is not
null) before calling it. Clear any active intervals by calling clearInterval, and remove any active
listeners by calling
removeListener before removing content using unloadapplication or removeapplica-
tionClip. Flash does not re-collect SWF data memory (for example, from intervals and listeners) if any Action-
Script functions are still referring to the SWF data when a movie clip is unloaded.
When variables are no longer needed, delete them or set them to null,whichmarksthemforgarbagecollection.
Deleting variables helps optimize memory use during run time, because unneeded assets are removed from the
SWF file. It is better to delete variables than to set them to
null.
Explicitly remove listeners from objects by calling removeListener before garbage collection.
If a function is being called dynamically and passing a fixed set of parameters, use call instead of apply.
Make namespaces (such as paths) more compact to reduce startup time. Every level in the package is compiled to
an
IF statement and causes a new Object call,sohavingfewerlevelsinthepathsavestime.Forexample,apath
with the levels
com.xxx.yyy.aaa.bbb.ccc.funtionName causes an object to be instantiated for
com.xxx.yyy.aaa.bbb.ccc. Some Flash developers use preprocessor software to reduce the path to a unique
identifier, such as
58923409876.functionName, before compiling the SWF code.
IfafileconsistsofmultipleSWFfilesthatusethesameActionScriptclasses,excludethoseclassesfromselectSWF
files during compilation. This can help reduce file download time and run-time memory requirements.
Avoid using Object.watch and Object.unwatch, because every change to an object property requires the player
to determine whether a change notification must be sent.
If ActionScript code that executes on a keyframe in the timeline requires more than 1 second to complete, consider
splitting up that code to execute over multiple keyframes.
Remove trace statements from the code when publishing the SWF file. To do this, select the Omit Trace Actions
check box on the Flash tab in the Publish Settings dialog box.
Inheritance increases the number of method calls and uses more memory: a class that includes all the functionality
it needs is more efficient at run time than a class that inherits some of its functionality from a superclass.
Therefore, you may need to make a design trade-off between extensibility of classes and efficiency of code.
When one SWF file loads another SWF file that contains a custom ActionScript class (for example,
foo.bar.CustomClass) and then unloads the SWF file, the class definition remains in memory. To save memory,
explicitly delete any custom classes in unloaded SWF files. Use the
delete statement and specify the fully
qualified class name, such as:
delete foo.bar.CustomClass.
504

Brauchen Sie Hilfe? Stellen Sie Ihre Frage.

Forenregeln

Missbrauch melden von Frage und/oder Antwort

Libble nimmt den Missbrauch seiner Dienste sehr ernst. Wir setzen uns dafür ein, derartige Missbrauchsfälle gemäß den Gesetzen Ihres Heimatlandes zu behandeln. Wenn Sie eine Meldung übermitteln, überprüfen wir Ihre Informationen und ergreifen entsprechende Maßnahmen. Wir melden uns nur dann wieder bei Ihnen, wenn wir weitere Einzelheiten wissen müssen oder weitere Informationen für Sie haben.

Art des Missbrauchs:

Zum Beispiel antisemitische Inhalte, rassistische Inhalte oder Material, das zu einer Gewalttat führen könnte.

Beispielsweise eine Kreditkartennummer, persönliche Identifikationsnummer oder unveröffentlichte Privatadresse. Beachten Sie, dass E-Mail-Adressen und der vollständige Name nicht als private Informationen angesehen werden.

Forenregeln

Um zu sinnvolle Fragen zu kommen halten Sie sich bitte an folgende Spielregeln:

Neu registrieren

Registrieren auf E - Mails für Adobe Flash CS3 wenn:


Sie erhalten eine E-Mail, um sich für eine oder beide Optionen anzumelden.


Das Handbuch wird per E-Mail gesendet. Überprüfen Sie ihre E-Mail.

Wenn Sie innerhalb von 15 Minuten keine E-Mail mit dem Handbuch erhalten haben, kann es sein, dass Sie eine falsche E-Mail-Adresse eingegeben haben oder dass Ihr ISP eine maximale Größe eingestellt hat, um E-Mails zu erhalten, die kleiner als die Größe des Handbuchs sind.

Ihre Frage wurde zu diesem Forum hinzugefügt

Möchten Sie eine E-Mail erhalten, wenn neue Antworten und Fragen veröffentlicht werden? Geben Sie bitte Ihre Email-Adresse ein.



Info