|
|
|||||
Оптимизирование проекта
И так, в чем проблема.Есть проект...много много ассетов(куча пнгешок), есть классы этих ассетов что то вроде этого юзается
[Embed(source='../../Assets/Icons/Button/Bolt.png')] private static var _BOLT:Class; Нужно эти все ассеты как-то засунуть в swc. Ни разу этого не делал.Может кто конкретно описать по шагам, с чего начать и как кончить Чтобы проект быстрее компилился для тестов и т.д. |
|
|||||
стервочка (я мужик)
|
создать отдельный SWC проект и прописать в нём все ассеты.
|
|
|||||
Et cetera
Регистрация: Sep 2002
Сообщений: 30,784
|
А где ж ещё?
|
|
|||||
Регистрация: Dec 2002
Адрес: Сочи
Сообщений: 2,819
|
Цитата:
Человек спрашивает - как сделать?, я ему - нет проблем - сделай swc проект /отдельный/, ну и конечно во Флексе..... СмирноФ, надо было Муку написать, он бы тебе ответил: Creating a .swc-Based Class Library in Flex Builder 2 To demonstrate the process of creating a .swc file containing a class library in Flex Builder 2, we’ll return to the Beaver Code example from the preceding section. Our class library will be called “beavercore,” and have a main package of com.beavercore. The package name matches a fictional web site, http://www.beavercore.com, that the developers at Beaver Code have created to host the beavercore class library. The following steps describe how to create a .swc file, beavercore.swc, containing the beavercore class library. For the sake of simplicity, the library contains a single class only, com.beavercore.effects.TextAnimation. 1. In Flex Builder, select File ➝ New ➝ Flex Library Project. 2. In the New FlexLibrary Project dialog, for Project name, enter beavercore, then click Next. 3. For Main source folder, enter src, then click Finish. 4. With the src folder in the beavercore project selected, choose File - New - Folder. For Folder name, enter com. Repeat this process to create the folder structure src/com/beavercore/effects. 5. With the effects folder in the beavercore project selected, choose File - New - ActionScript Class. 6. On the New ActionScript Class dialog, for name, enter TextAnimation, then click Finish. 7. In TextAnimation.as, enter the following code: package com.beavercore.effects { public class TextAnimation { public function TextAnimation ( ) { trace("Imagine a text effect with great majesty."); } public function start ( ):void { trace("Effect now starting."); } } } Build Project. (Note that the Build Project command is available only if Project - Build Automatically is not selected. When Build Automatically is selected, skip Step 8.) In response to the preceding steps, FlexBuilder 2 generates the file beavercore.swc and places it in the folder /bin/. The file beavercore.swc contains the project’s classes in compiled form. In our simple example, Flex Builder adds all classes from the beavercore project to beavercore.swc. In a more complexsituation, we could explicitly indicate which classes to include or exclude via Project - Properties - Flex Library Build Path - Classes. Using a .swc-Based Class Library in Flex Builder 2 Now that we’ve created a .swc-based class library (beavercore.swc), let’s see how to use it in a project. Suppose we’re creating a Flash-based web site for Barky’s Pet Supplies in Flex Builder 2. We want to use the TextAnimation class from the beavercore.swc class library in the web site. The following steps describe the process: 1. In Flex Builder, select File - New - ActionScript Project. 2. On the New ActionScript Project dialog, for Project name, enter beaver_barkys, then click Next. 3. For Main source folder, enter src. 4. For Main application file, enter Barkys. 5. On the Library path tab, click Add SWC. 6. Browse to and select the file beavercore.swc from the preceding section, then click Finish. 7. In Barkys.as (which opens automatically), enter the following code: package { import flash.display.Sprite; import com.beavercore.effects.TextAnimation; public class Barkys extends Sprite { public function Barkys ( ) { var textAni:TextAnimation = new TextAnimation( ); textAni.start( ); } } } In response to the preceding steps, the compiler generates a .swf file (Barkys.swf) including the TextAnimation class, and runs that .swf file. The following messages appear in the Console: Imagine a text effect with great majesty. Effect now starting. Notice that the Barkys class makes direct reference to the TextAnimation class as though it were actually part of the beaver_barkys project. Now that we’ve seen how to create and distribute a class library as a .swc file in Flex Builder 2, let’s examine how to do the same thing in the Flash authoring tool. ....... |
|
|||||
Оптимизируем дальше...swc конечно это хорошо, но его надо вкомпиливать каждый раз в проект, при создании новых ассетов, мне кажется лучше создать отдельную флешку и назвать ее аssets.swf и грузить ее в проект.Добавил ассет, перекомпилил пошустряку аssets.swf и готово.
Как лучше грузить эту swf и какими методами или способами брать нужные нам ассетные методы из этой ассетной флешки? |
|
|||||
Et cetera
Регистрация: Sep 2002
Сообщений: 30,784
|
getDefinition
Впрочем, не уверен, что имя того, чего нужно достать, будет известно. |
|
|||||
Et cetera
Регистрация: Sep 2002
Сообщений: 30,784
|
Методов? Может все-таки свойств? describeType в руки.
|
Часовой пояс GMT +4, время: 22:21. |
|
« Предыдущая тема | Следующая тема » |
|
|