MXMLC compiler missing filesystem library - actionscript-3

I've had not trouble until this point directly from MXMLC command line. While compiling Actionscript 3 code I ran into a dependency problem.
import flash.filesystem;
and I get
Error: Definition flash:filesystem could not be found
There are another or two file-related libraries such as filestream. Where can I find these standard libraries and how might I add them to my MXMLC library PATH?

What are the specific classes you are trying to use? If you want to import all of the classes in the flash.filesystem package you need a * at the end of that import statement. Otherwise you need to append the class name(s). Something like one of these:
import flash.filesystem.*;
or
import flash.filesystem.File;
The other thing that might be an issue is the values in your flex-config.XML (or air-config.xml) file that is part of the SDK. You might need to configure this to include the classes in the AIR sdk, etc.

Related

Plone/SQLAlchemy(?) - How can I import a python package (i.e. sqlalchemy) in a module in a subpackage?

I am trying to import sqlalchemy in a module in a subpackage.
Here is my folder layout
PloneInstance
my.package
my
package
subpackage
In the buildout.cfg file of the root folder, I add "sqlalchemy" to the eggs.
In my.package, in configure.zcml, I add:
In the subpackage, I have a blank __init__.py file, a configure.zcml file, and a file called mymodule.py
In mymodule.py I have a line for importing sqlalchemy
import sqlalchemy
Unfortunately, I am getting an error when I try to run an instance:
ImportError: No module named sqlalchemy
I'm assuming I am missing a step. How do I properly import python packages?
Thank you in advance. I apologize if my terminology is off.
Edit:
The module in question I am importing from turned out to be zope.sqlalchemy.
I accidentally overlooked this because prior to moving files to a subpackage, the import statement for zope.sqlalchemy was working without adding zope.sqlalchemy to the eggs section of the buildout.
Look in the setup.py file at the top directory of your package. You'll find a section like:
install_requires=['setuptools',
# -*- Extra requirements: -*-
],
In place of the "Extra requirements' comment, put a comma-separated list of strings specifying your package's requirements. You may even specify versions.
Do not add standard Plone packages to the list. They're taken for granted.
Re-run buildout after specifying your requirements. The result is that the new install requires will be added to your Python environment when you start Plone.

import interface built outside of flash

Trying to learn from a game on github which is backgammon and the fla stage is empty with class files external so when you test the swf it cannot find the interface that is attempting to load :
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import multiflame.game.IGame;
import multiflame.game.IContainer;
import multiflame.game.Constants;
Would the interface be something created in flash builder which I use along with flash CS6 or could those AS3 files be just as easily created in flash? I am new to flash builder and trying to figure out if it is used primarily for networking builds in which case the interface would be best executed there or doesn't it matter?
For very basic explanation - in your case interfaces are very similar to classes - external files with code in it. They are nothing special created with different programs - they are just plain text files named .as
You should provide the error you're getting, but if it says that the interface cannot be loaded, it means that Flash cannot find the file. In your case, if the interface error is about IGame, it means that in your folder where the .swf file is, you must have subfolder multiflame with game folder inside it, and a IGame.as file there.
This is of course if you don't know how to manage source paths - there's a property inside Flash AS options which you can set to target specific directory (for example D:\ can be mapped as root of your classes and so multiflame directory should be inside D:\, no matter where your swf is).
p.s.
Further you can read about interfaces and what they do: http://code.tutsplus.com/tutorials/as3-101-oop-introduction-to-interfaces--active-8199
I haven't read the whole tutorial but it seems large enough to cover the idea.

How to import own packages in Flash Builder?

I am new to Flash Builder so this is an easy question for anybody who has some experience with flash builder and actionscript 3.0.
So basically I have a folder with .as files. The directory of it is -
...\src\assets\Stadium\MyClass
Now I want to use it in my Flash Builder Project, but when I import like this -
import assets.Stadium.MyClass.PrefabProject;
There are warnings ... look in the image below.
How can I possibly use the contents of the folder in my as3 code.
How can I use the folder as a package?
EDIT: I went ahead and tried to use the stuff from the package in the code - This is the error I got -
A file found in a source-path must have the same package structure 'assets.Stadium.MyClass', as the definition's package, ''. MyClass.as /proj_away_alpha_new/src/assets/Stadium/MyClass Unknown Flex Problem
The error you have posted in your edit seems to imply that your package statement in MyClass is empty. The package statement should contain the same path that your class is in.
Since MyClass.as resides at the path (relative to your project): assets/Stadium/MyClass
The package statement (at the top of MyClass.as) should be the same:
package assets.Stadium.MyClass
I may have interpreted that error incorrectly. Just make sure that the package statement in MyClass.as is the same as the location of the class file on disk (relative to the project's src directory).
PS: The only time you use an empty package statement is when your class resides in that special "default package" (where your main app is).

AS3 Libraries: Am I missing FileStream?

I think I'm missing some classes in my library.
If I type in 'import fil', FD4 autocompletes to only this:
import flash.net.FileFilter
import flash.net.FileReference
import flash.net.FileReferenceList
I saw people using FileStream and wondered why I don't have this class available.
Do you guys know why this happens and how I can obtain the library?
FileStream is only available when targeting AIR 1.0+.

Using "Import" AS3

I´d like to know.
What exactly does 'import'?
I´m thinking about to use a flash component with this 'import':
//import the required data class
import fl.data.DataProvider;
//import the AutoComplete class
import com.yahoo.astra.fl.controls.AutoComplete;
I mean, I don´t have those folders in my app main folder.
Is it importing from web?
If yes, is it safe? If server is shut down, will the app, that uses those classes, crash?
Thanks.
I am almost completely certain that import does not get anything from the web. I use imports for a complex game core I wrote. Imports can either import from a component of the Flash platform, or from your own classes. When the .swf is compiled, those classes are pulled in and compiled as part of the project.
In order to import something other than from the Flash platform, you WILL need to have the folders in your project. For example, I have gradua.as at trailcrest/gradua/gradua.as, and that trailcrest folder is located in the same directory as my Flash project (.fla). At the top of my gradua.as class, I have the following:
package trailcrest.gradua
{
public class gradua
Then, I can import gradua for use in my main .fla's document class (named osr.as, btw)...
import trailcrest.gradua.gradua;
public static var Gradua:gradua = new gradua();
And I can access its functions (such as my Score function) from anywhere in my project...
osr.Gradua.Score(true);
Again, to restate...to the best of my knowledge, you CANNOT import from the web this way. Flash is going to look for the file path com/yahoo/astra/fl/controls/AutoComplete.as in your project directory...and in a couple other places on your computer, tho I'm not sure where atm...
With the import statement you can include certain ActionScript classes in your application, which then will be compiled in your SWF file. If you use strict syntax and you try to use a Class member that is not imported, the compiler will tell you about it. Otherwise your app will still work.
The imported AS classes must be added to your library path, or src path when working on an ActionScript project. You can't import online files.
Rob