How do I get the current filename of an AIR app? - actionscript-3

I'm building an AIR app where some functionality depends on renaming the app executable in the filesystem, and detecting whatever name the executable has when it's launched. I don't need to detect changes while the app is running, if that makes any difference, and I don't need the path or extension — just the name.
If the executable was the only item in its folder, I could get the Application Directory from the File class and go from there. But it would be ideal to have a solution where there may be more than one copy of this AIR executable in a folder, each renamed to something unique.
I've looked at the NativeApplication class, the System class, the File class, and any other class that seems related to this issue, to no avail. The closest I've come is getting the Filename from the Application Descriptor XML, but that only reflects the default name the application is given when published.
So, how I can get the exact current filename of an AIR app at launch?
EDIT: To be more specific, on a Mac this executable would be the .app file, and on Windows this would be the .exe file.
EDIT2: loaderInfo.url won't work — it gives the name of the SWF file running within the AIR app, not the name of the containing AIR app/exe. If you're on a Mac, you can see this SWF file by opening the package contents of the AIR app, and looking in the Resources folder.

Use the following process:
Use the class XSLTProcessor, with HTMLLoader if necessary
Create an XSLT stylesheet which applied to the <filename> element
Apply it to the application descriptor file

Related

Ship file with flatpak

I have a json file with some data that I want to ship with my application.
I want to include it on the folder /app/share/<app-name>/data/<file>.json.
I have researched, looked on the flatpak manifest documentation and the manifest of other applications, but I saw no mention to this option.
So, how would be the proper way of adding this file on the manifest?
You can do this by adding this file as part of the "sources" field in your module, and then installing it.
An example of this in the Flathub repo for Spotify. There, we definitely have a need for shipping separate files that make the integration into your DE seamless, as Spotify doesn't ship those. Concretely, let's look at the desktop launch file that is added:
The file can be found here: https://github.com/flathub/com.spotify.Client/blob/master/com.spotify.Client.desktop
You specify the relative path as a "file" source
Add the install command to the build-commands field of your module

Selenium ide to locate a file and store its path info from any computer

currently in my test scripts for automated file upload to browser, the paths are already defined in the value column
command type
target //input[#type='file']
value /Users/.../.../.../filename.extension
in such cases, this script is unable to run on other computers because the path would be different.
my question will be is
is there a way to locate the file in a general folder (for example file is downloaded and in the "download" folder), by using selenium ide can we get the path of the file (/Users/.../downloads/filename.extension)
store the path of the file with its extension into a notepad which i will be using it for multiple test of file uploads later on.
right now if my colleague needs to run the script from his computer, he have to manually change the value to his path.
You could use a suite file that contains a "setup" file to only change the file name in 1 place and the variable is shared across tests in the suite. You could also select an agreed up on place to store the files: c:\test_info\image.jpg.
Or you can make the file available by URL & not local, Unfortunately javascript prevents that for security: How to get the current file path in javascript
Unfortunately I can't think of any other good way unless you all have the same path in a home directory and could do something like ~/test_dir/photo.jpg

How to open a Flash project with some existing code?

I am a Java developer and have no experience in Flash, so sorry in advance if some of my questions will look stupid :)
I got some source code in this hierarchy and structure:
-sources flash builder
-com
-greensock
-deng
-fzip
-utils
-org
-flintparticles
ALAccessibility.as
ALEvent.as
ALImage.as
ALVideo.as
ALVideoOld.as
Project.as
Project-app.xml
Folders are marked with - sign. I didn't write in details what is inside of every folder (they have a lot of .as files)
How to open these files and folders as a Flash (I don't know exactly as an Action Script or Flex or something else) project? I also have project.swf file.
I have the Adobe Flash Builder 4.7.
I think you might be doing the import one folder too "high".
Usually the file structures you posted here are within a /src directory which is inside a project directory. There should be an Eclipse project file (.project) in the folder you're targeting for the import.
I don't think it works any differently from importing a Java project into Eclipse.
If that's not available, you'll have to create a new project and copy everything you have into that project structure - it's possible you've lost some project config (build path, compiler settings, etc) if the raw source is all you have...
In Flash Builder. File -> Import Flash Builder Project. Select "Project Folder" and Browse to the folder. Follow any instructions that may appear afterward.

Flash Builder 4.7: How to force the compiler output the resulting swf in particular folder

We're developing a game and the project is well separated and structured. There are projects for different kind of things, such as UI, main-logic, gameplay, etc. Just how it's supposed to be.
Now, the main app project (that runs with Flash Player), uses a folder that is called assets.
I want one of the other projects (the Logic project) to be able to output in "assets/logic".
To do so I first tried (in the Logic project) with including the parameter -output in the compiler settings, but FB rejected it.
Then I tried to set the Output folder from ActionScript Library Build Path menu. I managed to set it to that folder, but it just outputs a SWC file, called just like the project is, and I just cannot force it to generate a swf file with a name I specify. That sucks.
Furthermore, I'd like to force the Logic project to compile itself and generate into that folder before the main project does, so that it includes that latest from the Logic project.
So how do I achieve these things?

How does the Gaia Flash Framework access the scaffold.as file?

In the Gaia Flash Framework, a file called 'Scaffold.as' is used to make each page a scaffold page. This is accessed by the code,
new Scaffold(this);
But the class itself does not appear to be imported. Am I missing something about the way flash handles external classes? Or is there something else pulling it in?
Any help appreciated.
This all depends on how you are compiling. I'll assume you are using Flash IDE to compile. Flash has a source path lookup mechanism. This can be accesed through the fla (under File->Publish Settings->Flash (tab)->ActionScript). If the file Scaffold lives at the root level of a class path then there is no need to import it. The default class path includes the directory the Flash file resides in and some Adobe directories. There is a mechanism for managing class packages ... I think it was the old Macromedia Extension Manager. It would copy classes into the default class paths when the package was installed - so that could be the case. I have no familiarity with Gaia itself.
So there are 3 options. First the file Scaffold.as is in the same directory as your fla. Second the file Scaffold.as is in a default Adobe include directory. Finally the file is in a directory referenced in the fla's class path.