my fla file setting
version: adobe air 1.0
actionscript 3.0
i able to compile without problem and when i load the swf file in browser, if my actionscript included this line "import flash.filesystem.File". My flash just show up "blank" . no error in flashlog. if i removed this line, my swf file able to run. what is wrong?
The flash.filesystem.File package is only available if you compile the fla to an AIR-file. You can not read and write files in browser applications.
Related
I already know the coding part of actionscript worker. Recently I switched my IDE to FlashDevelop. I can't figure out how to compile actionscript worker swf in FlashDevelop.
I try to use Tools - Flash Tools - Build current file. But it throws error saying
Error: Type was not found or was not a compile-time constant: File.
Maybe it is because my project is a AIR project and I use AIR API in my worker.
I also try to compile worker swf using amxmlc via command line. It compiles successfully. But AIR Debug Launcher crashes when executing worker swf part. The swf which I compiled manually is nearly half size of the former one that Flash Builder generated for me. I guess I compiled a release version swf so that ADL can't debug and then crashed.
So how do I compile a worker swf in FlashDevelop to debug or to publish a release of project?
Update:
I find that the "Build current file" command in menu is a feature in FlashDevelop called quick build. By default, it will compile current file output to project root directory without arguments. We can add compiler arguments using #mxmlc ASDoc tag (see the links below for detail) to make it compile a worker swf for us. But currently in FD 5.0.1 it seems to be a bug that #mxmlc +configname=air doesn't compile air swfs. I find a workaround using #mxmlc -noplay -library-path=[Flex_SDK]\frameworks\libs\air\airglobal.swc -library-path=[Flex_SDK]\frameworks\libs\air\airframework.swc, but the path can't be surrounded with quote otherwise FD will show an error. I may look into the source and try to fix it.
links:
AS3 Quick Build documentation
Quick Build
FlashDevelop: Compiling Multiple SWF In One Project
Compiling a worker is no different from compiling any swf, you will need a separate project to compile the worker, unless your main worker loads itself as a worker.
Since FlashDevelop does not manage dependencies beetween projects, you will have to compile it manually, then the main worker.
You may automate it with make or any build system outside FlashDevelop, or use Pre/Post build command lines
By the way amxmlc is just a shortcut for 'mxmlc +configname=air', -debug=true will compile debug version
I can assure you that File can be used in a worker, basically it's just some actionscript bytecode loading some other actionscript bytecode and having it run in a separate thread, so any swf can be used as a worker, except if it doesn't use flash.system.Worker class, it won't be able to communicate with other workers, or to stop itself.
To sum up, the limitations and issues are rather about communicating beetween threads and synchronizing them. For instance, being able to only copy complex objects through AMF3 serialization,pass only basic types/objects as parameters will makes it impossible to interact with the display list from non-main workers
Dont forget to update FlashDevelop /AIR SDK for best workers support
I have recently installed FlashDevelop 4.4.3 and Starling 1.3.0.
I followed the getting started tutorial of Starling.
I can run the tutorial when I put starling.swc into lib directory and after making "Add to Library".
But if I remove starling.swc from lib directory and instead copy source codes (com and starling directories inside starling\src) of starling framework into my project folder then I get the following error:
C:\projects\ch01_01\src\starling\display\BlendMode.as(42): col: 32 Error: Access of undefined property Context3DBlendFactor
The same error occurs also when I set the classpath to <starling-installation>\starling\src
You don't need to copy anything. Just use the folder with your starling source.
Your classpath should always point to src directory. It won't work if you point to starling directory.
You most likely target wrong flash player version.
set it to 11.5 or something higher.
I am loading external swf that contain checkbox on the stage.
but when I try to load that swf I get an error "Class fl.controls::CheckBox could not be found."
I build the application with pure as3 in flash builder 4
and the external swf made by flash pro cs4
Thanks,
fl.controls namespace is a part of Flash Pro.
To integrate with Flash Builder, you can either add the package by SWC or via code:
Adding Flash Components to Flash Builder:
Adding by SWC:
Right-click on your project in Flash Builder, and go to Properties.
Select "ActionScript Build Path" from the left.
Go to the "Libary path" tab now available on the right.
Click "Add SWC..."
Add libs from Flash such as flash.swc or IK, depending on what version of the Flash IDE you have and where you installed it.
Windows:
C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\ActionScript 3.0\libs\flash.swc
Mac OS X:
/Applications/Adobe Flash CS5/Common/Configuration/ActionScript 3.0/libs/flash.swc
Adding by source folder:
Right-click on your project in Flash Builder, and go to Properties.
Select "ActionScript Build Path" from the left.
Go to the "Source path" tab now available on the right.
Click "Add Folder..."
The Flash components should be in a location with a path similar to the following, depending on what version of the Flash IDE you have and where you installed it.
Windows:
C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface
Mac OS X:
/Applications/Adobe Flash CS5.5/Common/Configuration/Component Source/ActionScript 3.0/User Interface
I'm using ActionScript 3. Developing in FlashDevelop. I get the following error when I try to do import fl.controls.Label;
Definition fl.controls:Label could not be found.
I'm pretty new to Flash. I had this project working without a glitch. I must have changed something for it to stop recognizing the import. Even Intellisense gives me an option to add fl.controls.Label
Controls in the fl.controls namespace are native to Flash Professional.
Although I don't use Flash Develop, this is similar to Flash Builder.
If you had Flash Pro you could create a library of components, then export a SWC library for use in your Flash Develop project. Or, reference Flash Pro's controls.
If this previously worked in your project, perhaps your compiler settings no longer link a required SWC dependency?
Not sure if this will help, but I would follow this in Flash Builder:
Flash Components:
Adding by SWC:
Right-click on your project in Flash Builder, and go to Properties.
Select "ActionScript Build Path" from the left.
Go to the "Libary path" tab now available on the right.
Click "Add SWC..."
Add libs from Flash such as flash.swc or IK, depending on what version of the Flash IDE you have and where you installed it.
C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\ActionScript 3.0\libs\flash.swc
Adding by source folder:
Right-click on your project in Flash Builder, and go to Properties.
Select "ActionScript Build Path" from the left.
Go to the "Source path" tab now available on the right.
Click "Add Folder..."
The Flash components should be in a location with a path similar to the following, depending on what version of the Flash IDE you have and where you installed it.
C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Common\Configuration\Component Source\ActionScript 3.0\User Interface
...or...
C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface
Default playerglobal namespace.
Default package / playerglobal.swc reference often is incorrect when editing from Flash in Flash Builder.
In .actionScriptProperties, add:
<libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/FP10.2/playerglobal.swc" useDefaultLinkType="false"/>
If you need general fl.* libraries, copy this swc:
/Applications/Adobe Flash CS6/Common/Configuration/ActionScript 3.0/libs/flash.swc
Into your Flash Builder project using these steps:
My game works with no error when i control+enter my fla file in air 2.6 player. my problem occurs when i open my swf file.
My swf file keeps iterating through timeline. i have used stop(); function in every timeframe. this problem is not seen when i control+enter my fla.
I'm sorry if my question sounds stupid, but I'm really new to as3.
This is because you have opened the swf file, and not the .exe file genereated after you publish the air app. Publish the application, and then install it. After this you should be able to run it by opening the .exe file.
When you debug an air application, the swf file is not run in the flash player, rather it is run in the Air Debug Launcher. This program also reads the other files associated with your application, namely the ...-app.xml file.