ActionScript 3.0 :: Loading Object From File Directory?
Nov 24, 2009
C:UsersPublicMusicSample MusicKalimba.mp3
A preferred solution would be with actionscript alone (I know some things like this are possible with php etc.) and without prior knowledge of where the SWF file is saved at author time. And the finished product will not be in a browser because I know that there is no way around it like that, maybe an AIR application or something
I've tried some stuff such as
Code:
var loader:URLLoader = new URLLoader(new URLRequest("C:UsersPublicMusicSample MusicKalimba.mp3"));
etc, but the problem is obviously that it cannot find this directory in the folder where it was saved
The web designer on a project is using Flash Gallery which loads a images.xml file. The SWF expects it to be in the same directory as the .html file. So if I am at the action /Public/Home/Gallery, it would expect the images.xml to be in at Public/Home.
How do I allow the Flash SWF to load the file? I have no access to the source code, so I cannot change the behaviour of the SWF.
When I have a class linked to a MovieClip in my library and that class takes an argument in its constructor method. That class will compile properly ONLY when it's located in my top-level directory (same dir as the .fla and Document.as files). If I move that class to a deeper directory, say com.place, and update the package statement and symbol link appropriately, the compiler will generate error "1136: Incorrect number of arguments. Expected 0."Create flash project and put a rectangle on the stage. Covert it to symbol and assign it to class TestPanel - or whatever you choose. Also configure the fla so that is uses a Document (Main) class.Create Main.as and TestPanel.as in the same folder. In the Main class, instantiate a instance of TestPanel and add it to the stage. Flash will, predictably, add the rectangle symbol and everything is fine.Now modify TestPanel so that its constructor method takes a Number and have Main.as pass some number to TestPanel.[code]You now get the error: 1136: Incorrect number of arguments.Expected 0.When I move the TestPanel.as into a deeper directory, Flash somehow is looking elsewhere for the base class for Symbol, even though I'm mapping that Symbol to com.place.TestPanel.
I have a main swf file and config.xml located in the same directory. My .swf file uses config.xml to fetch config variable which it does with success.The problem appears when I put those files into Flex directory. I embed .swf file like this.
I am doing some testing with various methods of deep linking in a flash site and have created a test site with the following structure: /index.html /simple.swf /two/index.html three/index.html
The index.html file located at the root of the site loads the simple.swf file using an absolute reference to the file (view the source of [URL]). The index.html file located in directories "two" and "three" are exactly the same as the index.html file in the root directory with the exception that I have added a defined a "base" parameter pointing to "../". [Right now, I am passing the same "flashvars" parameter in each of these files, however, once I resolve this issue, I will change the flashvars value.]
For some reason, the simple.swf file loads in the root level index.html file but not in the index.html file located in directories "two" or "three". I am confused why this is not working since I am using an absolute reference to the file. The only possible meaningful difference I can see is that the simple.swf file is only located in the root directory.
i'm trying to make a Top Score history for a flash game, which i load from an XML file. The problem comes to when i want to update the XML file. how do i do that automatically without prompting the user (ofcourse). I want it to be saved automatically to the same directory as the flash file.
here's my code right now, but it prompts the user where it wants to be saved, which i don't want to happen:
var xml:XML = <XML> <topScoreList> </topScoreList>
How should I change the following code if I want to put my flash object into a directory named "flash/", I tried changing the value to "flash/photo.swf" but it didn't work.
without having to hardcode a username / password in my .swf file (very easy to decompile!), is it possible to send a URLRequest for some file (perhaps .php?) to a loader object which can load assets that reside in password protected directories?my PHP skills are weak at best, so if calling a .php script is the solution.
I am trying to load up a xml file from an external source... I search the error code (#2044) and apparently xml can't be loaded unless its in the same directory...
I think this is silly and there must be away around it?
My insuffiecient knowledge about AS2 craves some teaching: I want to know how to add an action to a button within my scene to make it download a file, which is located in the same folder as the .fla and exported .swf. In this case its going to be a .pdf, but I guess my main point is that I just want it to download the file. It should work in both Firefox and Internet Explorer (I don't know if the script has to be different or not?).
Trying to fix other peoples bad coding and I can not change the file structure but I would like to add a class directory and be able to reference it for buttons and variables. The problem is that the directory needs to be up 1 directory so that it can work with all the other files.
Also I need to be able to set it as the symbol property "linkage" class file so I can apply the class to all the buttons.
File folder structure:
Main folder New class files FLA files Folder holding more FLA files More FLA files
If you have an .as file in the global include directory do you have to upload it to your server with the flash file or does it compile the flash file with the included info?
The powers that be have decided a project I'm working on shouldn't go on a website after all, but needs to be on a CD for Windows users instead and of course I only have a couple of days to made the "relevant tweaks" as they call them.It needs to run directly from the CD so I presume AIR isn't a good option.I've got all of it working by publishing to a Windows Projector executable. The bit I'm stuck with is allowing users to click buttons to open various directories which will be on the CD. These are source files for following tutorials from the main part of the CD. I've tried playing around with the various options in the FileReference class (namely browse() and download()), but they seem to be set up for use online only.
while im installing FMS,it goes wrong,i pasted the sceen below.My Os:FC14_X86.
Proceed with the installation? (y/n/q): y /opt/adobe/fms ~/FMS_4_0_0_r1121 Server:fms command:stop sed: -e expression #1, char 6: unknown option to `s'
We are writing log files to File.applicationDirectory and want to clean out old log files. The question is how do you delete files out of that directory? When I try and delete old log files out of this directory it gives a security exception. Is there anyway around this? I know you are not supposed to write to File.applicationDirectory, but we are writting are logs there anyways.
I have trouble getting it to copy file from src to destination.
var asMsg_path:String = fileRef.nativePath; var origFileLoc:File = File.applicationDirectory.resolvePath(asMsg_path); var newFileLoc:File = File.applicationDirectory.resolvePath("/java/"+asMsg);
I have this function that loads an specific .log file:
function loadTracks():void { tracksLoader.load(new URLRequest("/Users/Me/127.0.0.1,"+_logNum+".log")); }
The logNum variable gets its value, writing it by hand in a separate text file, avoiding to open and editing the .fla each time the new .log has a different name:
Some application creates in each session a new .log file with this file name pattern: 127.0.0.1,NUMBER.log // Being NUMBER the 5 digit changing part of the name, each time a new .log file is created. The newer the file, the higher this value is. how to make this script to autoload the last .log file, as it has the highest value in its name.
What methods could I use to save a xml generated in flash into the same directory as the swf file?
I know I can use "FileReference.save()" for flash player 10. But this has prompt window that appears and lets the user choose where to save. I just want it to automatically save in the directory of the flash file.
i have made one aplication in flash and i want to add a button to open one doc file that is in the same dir. this will not to publish for web is for a aplication on a cd rom.
I am writing to an XML file which is placed in the src directory of my Flex project. But when I run my application, the changes I make to that XML file actually reflects in the copy of that XML file in my [code]Is there a way to reflect those changes to the actual xml file i.e. the one in the src directory?Server Side: PHP.PHP file is in the same src folder. Here is the related snippet of code:[code]
Am I blindly missing a method for creating a hidden file or directory in an AIR / AS3 desktop app? Re-combing the docs, all I see is the File.isHidden read-only property. I know I could do this via NativeProcess and native code, but I'm hoping to avoid creating native code.
iam using a template, i designed everything alright but need to know how to click a thumbnail to open a file in the root directory.The XML file for the thumbnails looks like this currently and everything in the flash movie work and the explorer window opens to he link:
but instead of a URL I want a file to be opened (a mp3 or wmv or swf or exe) in its own window or default player...What is the code i would use? A similar flash template would be this http:[url]....but when you click each of the thumbnails, i want 1 to open a mp3, one ar flash movie etc
Just wondering if there is a faster way of obtaining a file name list of a directory's contents than getDirectoryListing? It seems to take FOREVER to load a dir list into an array. My end objective is to populate a .txt file with the names of files in a directory.
I'm using StageWebView to load mp4 & pdf files in my iPhone app (Adobe air 3.2 for iOS, in Flash CS5.5)
Below is the code I'm using to load the pdf file (same code to load an mp4 file).
I need to save the file on the iPhone, so the next time the user opens the app, i'll check if the file exist I'll load it using FileStream.open(filePath, FileMode.READ);Is there a way to save a file loaded using the StageWebView? [code]...
I have a bit of code that I want to change to make it save to the application directory. (the directory the application is installed at). While currently the bit of code I have works it just brings up a browse window for me to pick where to save the file. I want it to default to the application directory though.