Opening external exe file via fscommand - actionscript-3

I have problem opening external exe file by clicking a button in Flash projector. I have seen that the external file must be under the folder fscommand. And this is the code;
private function Fnc(e:MouseEvent):void
{
fscommand("exec", ".\\fscommand\\externalfile.exe");
trace("***button pressed***");
}
However I found that answer and now I am not sure I can open a flash exe by another flash exe.
Addition:
I can succesfully open other exes like Windows Media Player. So the answer might be the case but I don't know.

I don't know why a flash projector can not open another one !! Of course it can, it's just an exe like any other exe file !
You have just a little mistake in the path of the opened exe, so you should write :
private function Fnc(e:MouseEvent):void
{
// flash knows that the exe is in the fscommand dir
fscommand("exec", "externalfile.exe");
trace("***button pressed***");
}
Take a look on this very simple example :
Hope that can help.

Related

Opening an External SWF file using fscommand

i'm trying to "open" an external SWF file (not load it), if a button is clicked. I want to open it like a windows user would click on it and open it, i tried to use fscommand for that:
import flash.system.fscommand;
openSwfFileButton.addEventListener(MouseEvent.CLICK, openFile);
function openFile(e:MouseEvent){
fscommand("exec", "file.swf");
}
but it doesn't work, it doesn't throw an error either, any idea why?
In Air projects, you can use below code to run targeted file in your OS default application:
File.applicationDirectory.resolvePath("file.swf").openWithDefaultApplication();
about https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html

Can you debug swc in flash builder

Can you debug and step through the code of a swc files in flash builder?
Let's say you even have access to source code (coming from flex library project or flash professional project)! If how?
Thanks
Yes you can, though there are some limitations (as FlashBuilder will tell you when you do it), but simple stepping is no problem.
If you have the source code in a project in FlashBuilder, FB should find the associated code automatically. If you don't you can associate the source code to the swc manually. Go to the Flex Build Path window; click on the arrow next to the swc; double click the row that says "Source attachment" and enter the path to the source code.

flash cs5: compiling fla with huge internal library takes YEARS !

by using flash cs5 with a huge internal image library (over 300+ small png-files) i need more than 90seconds for each compiling action! the as code is pretty well, also my computer (quad core, 4gigs of ram). i've found out, that by exporting the files to "stage 1" (bild 1 in my screenshot) flash starts to hang around, but i don't know why...
.
how to speed this process up ?
__________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________
my solution did not work:
so i've played around and ended up creating *.as-files for each single bitmap, but the speed-result is the same (maybe 10% - 15% faster than before)...
package
{
import flash.display.*;
dynamic public class MY_BITMAP_NAME extends BitmapData
{
public function MY_BITMAP_NAME(width:int = 500, height:int = 135)
{
super(width, height);
return;
}
}
}
i can not work fast enough to debug my project files :-(
The solution would be to move your assets inside a precompiled SWC library that you will only recompile when they change.
Building the library:
create a new FLA and move in your Bitmaps,
each image needs to have a linkage class name and be exported in first frame; you don't have to create an AS class, Flash will generate them,
in the publish settings, "Flash" tab, check "Export SWC",
this SWC library will be published in the same location as the SWF; in CS4-5 you can't prevent the SWF creation.
Using the library
in your main FLA publish settings, "Flash" tab, open the Advanced Actionscript 3 settings dialog,
in the "Library path" tab you can add the assets library SWC; make sure the "Link Type" is "Merged into code",
SWC content will be available in your main FLA as if they were in the library.
It is worth noting that:
you must instantiate these assets by code (ie. new AssetName): they will not appear in your main FLA's Library panel and you can not drop them on the timeline,
only assets you explicitly reference in your code will be available at run time; if you are using getDefinitionByName() you must still import the assets somewhere in your code. For instance you can declare an Array containing all your assets classes (ex: var assets:Array = [AssetClass1, AssetClass2,...]).
if these 300+ images don't change too often, you could create a second .fla, where you only put the images in the library. Then you publish that .fla as a swc file (You can set this in the publish settings).
And you use that swc in your original .fla (that now has no images anymore), where you have your code (using the swc means, in the publish settings -> actionscript settings, you set the swc as a library reference).
This way, Flash only has to compile your code and simply takes the already compiled images from the swc. It then should compile much faster.
ctrl+enter, that will compile all things in library and the AS code.
most situation that use just change little things, and then compile it.
it would waste much time that no need to waste.
you can export some thing that would not always be changed to SWC file, and to to publish setting,
add SWC file into your Fla. or move you Fla project to Flash build, compile use less time more than in flash ide.

Drawing on screen from a non-sprite object in Actionscript3

I'm trying to debug AS3 code on production. I have no access to trace(), can't write to disk or open a socket. What I want is to display something on screen.
With AS2 I could just access _root and create a text field with my trace data.
Any ideas how I can pull this off with AS3? My class extends Object, it is not a sprite and is never added to a parent display object.
Thanks! :)
Why can you not use trace?
You could download the Flex SDK ( http://opensource.adobe.com/wiki/display/flexsdk/Downloads ) and in the "bin/" folder is a program called "fdb" (Flex DeBugger) which is a command line tool for debugging .swfs.
Once downloaded, open up a terminal/cli, navigate to the "bin/" folder, and issue the command fdb http://example.com/index.html (./fdb http://example.com/index.html on a Mac) and the debugger will connect, assuming it's a debug .swf you've uploaded.
Fdb will also allow you insert break-points, watch/print/change variables etc. It's a very handy tool.

FLVPlayback skin modification problem in Adobe Flash CS5 with AS3

I have been working on modifying an existing FLVPlayback skin. Ideally I would like to have one that uses a counter.
The problem is, all the fla's provided for the skins with counters fail to publish/compile correctly. Fla's are here: C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\FLVPlayback Skins\FLA\ActionScript 3.0
I do end up with a swf, but it doesnt' work when applied to my FLVPlayback instance on the stage. (All skin fla's beggining with 'Minima' do not work, even the skins without the counters)
I get the following warning when publishing: Warning: unable to load SWC FLVPlaybackAS2.swc
If I go to 'File -> Publish Settings -> Flash -> Settings', FLVPlaybackAS2.swc is not in my Library Path. So, I added it... (C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\Components\Video\FLVPlaybackAS2.swc) But I get the exact same warning.
It seems strange to me that it would throw a warning about FLVPlaybackAS2.swc... this is an AS3 fla provided by Adobe. I also tried adding FLVPlaybackAS2.swc, FLVPlaybackAS3.swc, FLVPlaybackAS3_2.5.swc etc, with no change.
Another developer here has tried also and come up with the same problem. We are both on PC's and have all Adobe updates.
Anyone have any ideas?!
Thanks,
James.
Guys... I found answer ! Just remove all from your source paths in the publish settings when you look to ActionScript 3.0 setting for your Skin FLA ! ( as default you can see here some path to video folder where is SWC files)
it's look like a bug but i did it and now my skin working.. now in this lines are empty field in my FLA..
if you want ask me and i will answer how it works.. good luck with this strange bug !