FLASH Qn: If I have a FLA file, with many Actionscript files, I make a change to an Actionscript file. I only compile the FLA into a SWF, will the change be incorporated into the newly compiled SWF file? Thank you!!
That is... with a compilation of a FLA, will all the related Actionscript files be automatically compiled?
Where can I see the connection or call from the FLA to the different Actionscript files?
Yes, Actionscript files that are setup to be used by your FLA will be compiled into the SWF, and do not need to be deployed with your SWF.
I'm not sure what you mean by the second question, but to link Actionscript files to an FLA, you need to link Actionscript files to your MovieClips in your library by right-clicking the MovieClip > Properties and select the Export for Actionscript button. The Class field is a folder path relative to your FLA. If you have a MovieClip named "CoolClip" and you had an Actionscript file in the same folder as your FLA called CoolClip.as whose contents were:
package {
import flash.display.MovieClip;
public class CoolClip extends MovieClip {
public function CoolClip() {
// constructor code
}
}
}
Then you would enter "CoolClip" into the Class field of that properties field. Convention calls for the Actionscript file name to match the class name (in this case CoolClip).
To link to a "main" class for your FLA, enter the classname in the Class field of the main stage/document in the Properties panel of your main stage.
Related
I have a class named _AppColors. it contains all colors used in the application. I want to force developers to read colors from Theme that's why I made this class private. now I want to access this class from two files. but it can be only part of one file. how can I handle this?
app_colors.dart:
part of 'color_extention.dart';
class _AppColors {
...
app_theme.dart
import 'package:flutter/material.dart';
part 'app_colors.dart';
extension MultiThemeColorExtension on ThemeData {
...
color_extention.dart
import 'package:flutter/material.dart';
part 'app_colors.dart';
const TextTheme _textThemeLight = TextTheme(
...
but I have to add part of 'color_extention.dart'; in app_colors.dart which I can't. any solution?
Private symbols are private to the library. Normally a Dart library is a single .dart file, but part is used to specify that a library comprise multiple .dart files (and conversely, part of is used to specify that a .dart file is part of the specified library).
It doesn't make sense for a Dart file to be part of multiple libraries. If you want to share a private class with multiple .dart files, your typical options are:
Make all of those .dart files part of the same library.
Make your class public instead but discourage using them. Packages typically do this by placing internal implementation files in lib/src/ and exporting only the symbols intended for public consumption.
When I worked in Delphi, I had a special file with functions which were created by me. This file had a static way which was added to library path in Delphi settings and it could be used from anywere just by adding "lib" into "uses" block of .pas file.
Now I'm working in Swift and would like to make the same. I want to have a file which will have it's static way on PC and will be able to use itself from any ViewController just by adding "Import myLib"
How can I do it correctly?
Simple solution without an explicit static library:
Create a Swift file somewhere outside any product folder containing a class (or multiple classes) and class functions, for example
class GlobalFunctions {
class func function1()
{
println("function 1")
}
class func function2()
{
println("function 2")
}
}
In each project you need the file add the file (⌘⌥A)to the project but uncheck Copy items if needed in the dialog box.
Call a function with
GlobalFunctions.function1()
Any import statement or changing Build Settings is not needed
I have a rather large Dart application that uses part and part of so that I don't have to use relative imports. However, the application may have something like this at the entry point file:
part 'file1.dart';
part 'file2.dart';
part 'file3.dart';
part 'some_sub_dir/file1.dart';
part 'some_sub_dir/file2.dart';
part 'some_sub_dir/file3.dart';
part 'some_sub_dir/file4.dart';
part 'some_sub_dir/file5.dart';
part 'some_sub_dir/file6.dart';
...
As far as I know, my IDE (WebStorm) doesn't automatically add a part statement when I create a new class. Is there any way I can avoid having to use so many parts? If not, can the process of adding new parts each time be automated?
I understand your problem as I can and I'll try to answer from my experience in Dart.
As I got it you are trying to keep all (or a lot) project files as parts of one library. It's wrong conception. In Dart library is not big thing. Here is few advices how to organize your files.
Don't try to keep a lot of files as parts of one library. Rather keep each file as separated library.
You can keep few classes in one file. But be sure classes works together for one idea.
You can split one library in few part files only if it has a lot of classes or one class is too big. But be sure all this files should be together in one library.
If you don't know how to combine classes in libraries keep each class in separated library. After days you will get understanding which classes plays together.
If one class from one library has usages in not only library but in other libraries - make it separated library.
Place parts in same folder with main library file.
If library has parts put all library files into separated folder.
Use relative links to parts.
Always use absolute links to other libraries. It will help you to make refactoring in future.
For example, this is a project like TODO list application. So, we have view class:
// This is a view html component class. //
library todolist.list_viewer;
import 'package:todolist/task.dart'; // model class
class ListViewer extends HtmlElement {
// it showes list of tasks
}
class TodoRenderer extends HtmlElement {
// this is a renderer for one todo item
}
And this is a model class:
// This is a todo model task //
library todolist.task;
class TodoProvider {
List<TodoItem> todos;
String addItem(TodoItem new Todo) {
//...
}
}
class TodoItem {
String Author;
DateTime date;
}
It looks simple now, divided into separated libraries. But if we want to add RecId class to keep todo database id it becomes too complex. We should split it in two libraries: todo_provider and todo_model and put RecId class into last one. Now it's good again.
If we wanna add one more model: a User, so each todo item may have executor or author. We can't just put it todo_model. Now we should to combine TodoItem and User classes into model library. So we just rename todo_model class to model and add User class into it.
Or instead last action we can make user_model library to keep User class. And as User model has recId property too we should extract RecId class into separated library.
It's all depends on how our classes big and complex.
I understand that:
part/part of is used to break a library into several parts (scripts). You have visibility to public and private members.
import is to "call/use" another library from your library. You have only visibility to public members of the imported library.
WebStorm can't infer you want a script to be part of your library.
I am creating Class Files programmatically for UnitTests with NUnit.
I could already add them to TFS Source Control.
What I now need, is that I want to add them programmatically to the Project.
I have found several approaches, but I got none working... I don't want to edit the XMl-File manually.
Do you have some code snippets?
The naïve solution would be to edit the XML file manually. However, you don't have to do this.
You can use the Microsoft.Build.Evaluation.Project object model to manipulate Visual Studio project files. See this answer for more information on the differences between the Microsoft.Build.Evaluation and Microsoft.Build.Construction namespaces.
The following example opens YourProject.csproj and adds a new file called YourFile.cs as a Compile item type, then saves the project file back to disk.
using Microsoft.Build.Evaluation;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var project = new Project(#"YourProject.csproj");
project.AddItem("Compile", "YourFile.cs");
project.Save();
}
}
}
I have developed an order processing application for BlackBerry. When I look at the bin folder I see more than 100 .class files.
I have created a main screen class for adding new clients. The screen has 7 LabelField objects and 7 corresponding TextField objects. This screen also creates a VerticalFieldManager and adds all these fields to it and then adds the VerticalFieldManager to the screen.
For this screen, I have 14 .class files in the bin folder. It seems there is one class file for every field in the progam.
For example:
NewClient.class
NewClient$1.class
...
NewClient$14.class
How do I design the UI in order to reduce the number of compiled classes?
Building a Java-ME app for BlackBerry is a two step process. First the java source code is compiled to class files, then those class files are compiled again into a .cod file, which can be deployed onto a simulator or a device.
'rapc' is the RIM compiler that takes java programs and turns them into a cod or alx file for deployment. 'rapc' can take either java source code, or compiled java classes. Either way, it can produce output suitable for a device.
When starting with Java source files, you can explicitly compile them to class files and hand those class files to rapc or you can pass the Java source to rapc and it will compile the source directly. rapc just defers to the JDK javac compiler when presented with java source code. This means a standard java JDK compiler is always used as the first step of compiling a BlackBerry app, and we can look at standard java behavior to understand what is happening.
In Java, every class that is instantiated has exactly one .class file. For normal classes with a declared name, like this:
public class Foo extends Bar {
}
The .class file is assigned a name that matches the declared class name. However, Java also allows anonymous classes. These take the form of a new Foo() followed by a curly brace which turns this into an anonymous class. This presents a problem, as this anonymous class must be assigned a name at the VM level, despite having none at the Java source level. The solution is to use a character that is invalid in Java source, but valid in the VM, namely $. The anonymous classes are assigned a name based on the enclosing Java class, followed by $, then an integer index based on the number of anonymous classes ahead of this one. In your case, that is NewClient, followed by 14 distinct integers.
To see the behavior you describe, your fields must all actually be anonymous implementations of those classes you mention. To reduce the number of classes, try reusing explicit classes, instead of writing custom behavior with each instantiation.
Set your jdk bin folder path on the environment variable path on right clicking on the myComputer icon
Then Restart the pc
Other way is to don't use overwrite method on your code such as
btmSave.setChangeListner(new FieldChangeListner()
{
private void fieldChange()
{
}
}
);
Avoid This type of writing code it create your no of class Files on project bin folder