Import a Sound into Flash CS5 with a relative path - audio

I'm looking to import an mp3 into Flash CS5, but Flash is only letting me import the file with an absolute path. Is there a way I can import the mp3 into Flash with a path of "../sounds/file.mp3" so that the Update feature still works if I move the outside directory around?

on my Mac version of cs5, paths are absolute when the sounds are first imported, but then change to relative once the file is saved. The containing folder can then be moved around and the link between asset and sound file remains intact.

Related

*.import and *.tres files in godotengine

I'm new to godotengine and want to make a project and upload it on github. I just get confused that those *.import files which are created automatically on adding a new assets and *.tres files which we make to save our tileset maps or something else are needed to be uploaded?
thanks.
Keep them. Include them in your version control system. They are text based (basically INI files) and fairly small, and so play well with version control.
*.tres files
The *.tres files can - and often exist - without a file that was imported. If an *.tres file is missing… You are screwed.
and *.tres files which we make to save our tileset
It is not mandatory to use the "save" option on your TileSet. If you add a TileMap, give it a new TileSet and save the Scene, the TileSet is saved in as part of the scene file.
Saving it to a *.tres file will allow you reuse it (on different TileMaps, potentially on different scenes). And it also means it can be modified independently (which is good for version control).
Once you saved it to a *.tres file, that file IS your TileSet, it describes what sections of what textures is what tile. As I said, if the file is missing, you are screwed. You would have to do that again.
What tile is placed where is part of the TileMap data, part of the scene.
*.import files
There a partial here: Godot: what are .import files, and should you commit them to git?. I'll elaborate further.
The *.import files include import configuration (what you set in the Import panel). Know that they must exist along side the imported file. If an .import file is missing Godot will re-import with the default settings (which is not good if you changed them) and recreate the *.import file.
It is also worth mentioning that the *.import files reference files in the .import folder (.godot/imported in Godot 4.0). But there is no need to include that folder. It is a read only cache, it contains duplicates of the resources in a binary format convenient for Godot (and thus not good for version control). With the original file and the *.import file, Godot reconstructs it.
See Files generated on the import process:
Importing will add an extra .import file, containing the import configuration. Make sure to commit these to your version control system!

Use an imported font on PyGame

I want to add a font imported from google to Pygame.
I used that code but when I run script, the window immediately closes :
pygame.init()
pygame.font.init()
myfont = pygame.font.Font("resources/fonts/Mansalva.zip", 30)
The path to my .zip font is also good.
.zip is an archive. You've to unzip it and to load a single (e.g. .ttf) file from the archive. The filename which is passed to pygame.font.Font is assumed to be a font file. A zip-archive file can't be processed an causes an exception.

Music not playing from file, but works fine in IDLE

I have tried to make a sound file work, and from the IDLE 3.6, it works fine.
However when I try to run it from the actual file it breaks and crashes.
The error only says:
'Couldn't open 'Sounds/music.ogg'
This code has the same effect (runs fine from IDLE, breaks from file):
try:
import pygame
pygame.init()
pygame.mixer.pre_init(44100, 16, 2, 4096)
screen = pygame.display.set_mode((600, 300))
pygame.mixer.music.load("Sounds/music.ogg")
pygame.mixer.music.play(loops = -1)
except Exception as E:
print(E)
input()
I've tried other file formats, .mp3 and .wav, and they have the same outcome.
So basically, how can I make the music work fine from the file?
Most likely, the problem is that the sound file is not in the right place. You should have a folder "Sounds" in the same location as you .py file. And of course, the Sounds folder should contain a file "music.ogg".
Another option is to use absolute file paths. This means doing something like this: pygame.mixer.music.load("C:/SomeFolder/MainFolder/Sounds/music.ogg"). This tells the program to look at that exact location instead of relative to its position.
Interestingly enough relative paths doesn't seem to work when running outside of Idle. When changing to use the full path to the file everyhing works fine.

How can I get a file or directory name from a file open dialog in PyQt4?

I am writing a PyQt4 application and one of the file types I wish to open is an Esri Grid format which, rather unusually, is a directory. I also wish to open other GIS filetypes that are just files (e.g. geotiffs). I can open these filetypes OK with the GDAL library by passing either a file or directory name and GDAL figures it out.
The problem I have is making the GUI. I want to open a file open dialog and get either a file name, or directory name. The problem is that the file dialog won't let me choose a directory - only files. I need the dialog to return a path to either. I've tried it on Mac and Linux.
I know PySide has a method called getExistingDirectory
http://pyside.github.io/docs/pyside/PySide/QtGui/QFileDialog.html
PyQt is basically the same, so it should have a similar method. http://pyqt.sourceforge.net/Docs/PyQt4/qfiledialog.html It is in the static methods section.
I think I've cracked it. This snippet tests the functionality I need:
dlg=QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile);
e=dlg.exec_()
print dlg.selectedFiles()[0]
The solution was to set the file mode to 'AnyFile'. This allows the file dialog to return both directory and file names.

Winrar Sfx get Icon from executable

i don't know if it is right to ask here but I have a really quick question.
I have an executable file which already has an icon and I plan to use winrar sfx to create a mini installer for it.
My question is: is there a way for Winrar sfx to copy the icon of my exe?
like what you do with autorun.inf, where you simple code "ICON=setup.exe" or something like that.
I know I can manually specify it on creation, but the project is still on going and it would really really save me more time.
Also I have accidentally deleted the icon for my executable. (that's the reason why I'm asking this to save me time researching how to re extract the icon.)
thanks! :D
It is not possible to use a *.exe or *.dll file containing icon resources as source for the SFX icon. The source file must be a real *.ico file with at least 1 icon. The icon file can include also several icons in various sizes like 16x16, 24x24, 32x32, 48x48, ... The functions of Windows load and display automatically the most suitable size of the icon.
There are lots of free applications which can extract icons from *.exe or *.dll files like multimedia viewer IrfanView or Resource Hacker.

Resources