ActionScript 3.0 :: SWF Knows Its Own Filename Or URL Somehow?
Jan 28, 2010How can one access the name of the file or URL which loaded the file?
View 1 RepliesHow can one access the name of the file or URL which loaded the file?
View 1 RepliesI am trying to retrieve my SWF's referring document filename. For example, if index.html is calling mymovie.swf, I want to return index.html. I know this can be done through a combination of scripting and flashVars, but I would like to avoid that for security purposes. The flashVars variables can be seen by anyone who knows how to view source. Is there a way to accomplish this solely in Actionscript? or Flex?
View 10 RepliesDoes anyone here knows how to get the path or the filename of an object inserted to the stage?
Here's the scenario:I'm developing a flash app, that enables the user to insert background to the stage by using the Browse and select using the FileReference in flash. I have successfully inserted whatever image the user choose, but what i'm trying to do is that if the user clicks save, the background image that he/she has selected will be copied to another folder on the web (uploads folder). Thus i need to know the path and filename of the background image.
[Code]...
I need to get a random filename from a directory in AS3, and open it. (This will be online, so no AIR)
I'm thinking of just using a text/xml file with all the filenames listed, and just traverse through it getting the filename. But is there a more "direct" way to just look at the directory so I don't have to edit the text/xml file all the time?
I am trying to save images to the disk in an AIR app for smartphones. I need a method, that can convert safely Web URLs to valid filenames on Android & iOS (if it would retain Windows/Mac compatibility it'd be good.), and i can get back the original full URL from the filename. For example:[URL]..Encoded format is something like (this is just some example i found out now):http%d%s%swww.google.com%tsearch%rclient%z
And i'd need a method to convert it back. I've looked into BASE64 - but this allows the "/" character, and im afraid to use HEX encoding, because this will generate super long filenames, and URLs can be lengthy.
According to another question, in iOS the max length pathname is 1024 bytes: max length of file name
Anyone has a solution for AIR? Basically this is the same question as Convert between URL and windows filename (Java)? - just for AIR, iOS, Android.should i simply modify a BASE64 encoder, and do some hacks for long filenames?
how to get the actual filename of an external .swf when loaded into another movie clip.
Code:
var toTrace:String = getChildAt(0).name;
trace(toTrace);
That is what I have. It gives me the instance name, which does me no good, because it is a relative instance name. My situation is that I have a few buttons, when clicked they load external .swf into the stage at index 0. how to reference the currently loaded external file.
I'm trying to save an XML file on a remote server via an php file, and so far this works fine by following the tutorial on this site - exept one thing...I would like to define the filename of my XML file to be saved via php in flash dynamically, eg. so I can create several XML's from flash. But how is this possible ?- can an entry in the passed XML file be read in an easy way in PHP4 - or can I send a variable along with the XML object with some wrapping (maybee an advanced object).
View 1 Repliesit's possible to have AS take the filename of itself and make it a variable. I need it to be done by AS only. I know it's possible in PHP, but I'm not sure about AS. I'm guessing if it's possible it's one line of code. I'm using Flash 8 but publishing at Flash 6, AS 2.
View 2 RepliesI'm using Flash CS5, and Dreamweaver CS5 to build a site. I'm essentially just using DW as a placeholder for my flash file, which really is the site and all its content. The issue is a minor one, and I'd bet it's a trivial detail I'm overlooking. I saved the .fla file, exported it into my DW .html file, and then previewed it in IE. It looks great, but, when I mouse my cursor over any part of the .fla (basically anywhere in the site), a little box comes up that states what the name of the flash file is.
View 6 RepliesHow would I add the name of an item in an array to a text box? I want to add the name of each item in an array to the text box depending which picture is being displayed.
[Code]...
To load 3 files locally into the Flash Player, one might using something like this manage the sequence after the user has chosen the files...
private function uploadList(evt:Event):void{
var arr:Array = fileReferenceList.fileList;
for each(var item:FileReference in arr){
item.addEventListener(Event.COMPLETE, onFileLoadComplete);
item.load();
[Code]...
I am building a flash media player for an live audio stream. The server is set up to stream from a url that looks like so: [URL]. The instructions I have found say to first set the directory:
nc.connect("rtmp://ourwowzaserver.net:80/ourfiledirectory");
And then later play it:
nc.play(mp3:thefilename)
This works when we have discrete filenames on the server (thefilename), but the live stream is not a file - rtmp://ourwowzaserver.net:80/shoutcast. How in the heck do I get .play to play it?
How to convert AS3 ByteArray into wchar_t const* filename?So in my C code I have a function waiting for a file with void fun (wchar_t const* filename) how to send to that function my ByteArray? (Or, how should I re-write my function?)
View 1 RepliesHere's what I am trying to accomplish. I have a BitmapData that I am sending to a PHP function as ByteArray on the server by using URLRequest. The PHP function then saves the ByteArray as a jpg. All is well, so far and I am able to save the image on the server. Where I am stuck is that the PHP function generates the image file name randomly and I have no clue on how to get the name of the file I have just saved on the server. I am using the below code to send byteArray to the PHP function. How to modify/add this so I can get the filename of the image once it's saved on the server?
var myHeader:URLRequestHeader = new URLRequestHeader("Content-type","application/octet-stream");
var myReqst:URLRequest = new URLRequest(path);
[Code]....
I am trying Flash Builder for the first time and I'm stuck in a simple task. How can I change the output filename?
By default, Flash Builder gives the SWF the same name of the entry point class and I couldn't find anywhere to change it.
I have the following code which traverses an XMLList of nodes:
[Code]...
If the current node's text is true, then I need to load an Image with the same name as the node (plus the extension) and position it.
How can I tell the filename of the SWF within which the current script is running?
View 1 RepliesI have a some Flash CS4 file with some AS3 with under one file name say file1.fla. And it just plays correctly. But as soon as I change the filename to different name such as file2.fla, then it no longer plays. I have to generate many file name with identical content say file3.fla, file4.fla etc. Now simply renaming the fla file name just make it non-playable, as soon as I hit CTRL+ENTER, nothing but white background shows up. It is fcking driving me crazy, WTF is wrong with this software?
View 2 RepliesI am building a page, like a table of contents (TOC) showing a list of videos the user can select from. It's written in PHP and populated by a MySQL database. There's a thumbnail and descriptive text which are linked to a new page with Strobe Media Playback. Videos will be delivered via RTMP stream from Flash Media Interactive Server 3.5.
What I want to do: Pass the filename of the video that was selected on the TOC page into the actionscript for the Strobe player on the player page. I have found a couple of posts here that related to similar issues, but I'm new to AS3 and was not certain if the other folks wanted to accomplish the same thing I do.
[Code]..
I am trying to figure out how to get the actual filename of an external .swf when loaded into another movie clip.
Code: var toTrace:String = getChildAt(0).name; trace(toTrace); That is what I have. It gives me the instance name, which does me no good, because it is a relative instance name. My situation is that I have a few buttons, when clicked they load external .swf into the stage at index 0. I need to know how to reference the currently loaded external file.
Here is what I'm trying to do. I have a sunroom product that is available with several different options. I have created images of every possible combination of options, and named the files like this:
DeckFurniture_NoVisor_ClearGlass_View1.jpg
Hot Tub_Visor_TintedGlass_View3.jpg
I want users to be able to choose their options, and have the appropriate picture be displayed. So to get the above image, they'd have to choose "Deck Furniture" "No Visor" "Clear Glass" and "View 1". Or to get the other one they'd choose "Hot Tub" "Yes Visor" "Tinted Glass" and "View 3"
It's not necessary to have it auto-update the image, so I was thinking they could choose their options and then click "Update", and that would in a sense pull up the correct filename from the options they've chosen. I'm not exactly sure how to tell Flash to change this master variable (the filename) whenever one of the sub-variables (pieces in the filename) change. Would I have to put a script on each option button telling it when it gets selected to change the master variable?
As part of my authorization plugin I have a content URL tokenization system. When user requests some content to play, it sends a tokenized name. e.g. 06e3b733c1140573f105a83462471df8. Then it transforms through a request into 3rd system to a full path of the requested content. To handle this I ought to catch E_FILENAME_TRANFORM and change a content path there. It is odd that is impossible to do it during E_PLAY event.
Everything is fine while the content transformation is successful and I authorize E_FILENAME_TRANSFORM event. But when the transformation failed and I blocked E_FILENAME_TRANSFORM and even close!!! the connection with a user, I still get a few E_FILENAME_TRANSFORM events after the blocked first!
I understand the nature of those events, but I would like to find a way to prevent the generation. Simple solutions like 'just ignore it' or 'remeber somewhere that it was already handled and blocked' do not work in my case. The whole system is complex, have a async pool of threads to handle requests into 3rd systems and completely stateless!
I try to embed images in a mx:tree:
<mx:Tree labelField="name" id="tree"
folderOpenIcon="@Embed(source='assets/images/test.png')"
folderClosedIcon="@Embed(source='assets/images/test.png')"
defaultLeafIcon="@Embed(source='assets/images/test.png')">
</mx:Tree>
This works fine, but I will embed the images with a String variable.
[Code]...
I'm currently working on a flash app, that enables the user to select a background image and later save that layout.
Things i have done so far[code]...
My Problem is:
1. How can i get the path and filename of the inserted image?
2. how can i copy the selected background image to the folder where the user saves it's layout?
Ive just noticed that my Adobe Image Ready only allows me to save files names of 27characters in length or less.
Is there a general character length rule in working with filenames. I know windows doesnt have a problem what about other OS? Apple etc.?
Im just trying to put really descriptive names in some of my files wokring with flash and photoshop/imageready etc.
I keep getting an error I cannot seem to solve. Although it does not seem to influence the behavior of my file, I don't know if it will in the future.
ArgumentError: Error #1063: Argument count mismatch on "filename"::MainTimeline/"thisfunction"(). Expected 0, got 1.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.transitions::Tween/set time()
at fl.transitions::Tween/nextFrame()
at fl.transitions::Tween/onEnterFrame()
I've already looked up the error, and it's true, there is no argument assigned within the "()" of my function, but I don't know what to put since it's a function that applies to multiple buttons and is called upon in another function. A similar function doesn't return this error. When I put "e:Event" within the "()" it returns "error 1136: Incorrect number of arguments. Expected 1.
I would like to select a specific xml file to load from a local directory. The file name is composed of "Title" + "number sequence". I know the Title (in this case its XLink07), but I need to select the latest number sequence or the latest by date stamp.
For example, the local directory has the following files:
XLink01[36735298100].xml
XLink02[36735298100].xml
XLink02[36735298101].xml
XLink07[36735298100].xml
XLink07[36735298101].xml
In this example I need to select file XLink07[XXXXXXXXXXX].xml where XXXXXXXXXXX is the highest number within the XLink07[XXXXXXXXXXX].xml files. Title is Xlink07 and function should return Number sequence [36735298101]. Files with higher number sequence have later date stamps than files with lower number sequences. I need to select the highest number or the latest date stamp for the file that begins with XLink07.
My action script to load the local .xml file without any function to select the correct file is:
Security.allowDomain("*", "*")
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("XLink07[36735298101].xml"));
xmlLoader.addEventListener(Event.COMPLETE, showXML);
function showXML(e:Event):void {
[Code] .....
I am trying to paste hyerlink in body of mail in outlook by flex application using navigateToUrl method with mailTo protocol.
but outlook breaks hyperlink after first space in hyperlink.
I tried with < ,> before am after link but it doesnot help out me.
Is there any other way to paste link in body mail containing space.
I am in the process of writing a custom script for our internal SharePoint system that will allow for multiple file uploads on list items. In order for this to happen, I was wanting to use a flash file input (to select multiple files at the same time) and then pass an array of file paths (local to the user) into my ASP page to do the actual uploading.Does anyone know of a SWF multiple upload plugin that allows this? I've looked at Uploadify and cannot find what I need there.
View 2 RepliesI would like to pass a value from a text box on stage as the URL or filename to the NetStream.play() argument. example:
var url:String = url_text.text;
var conn:NetConnection = new NetConnection();
conn.connect(null);
[Code].....
The point of the matter is that I'm pulling the values from JavaScript/HTML using the ExternalInterface which changes as the user selects next on a HTML page. The page name (URL) is being parsed and passed back as the video filename. I'm using the text boxes currently just to test/view the values being received and sent to JavaScript. The value send and receive fine, I just can not seem to pass the value into the NetStream.play(JavaScriptValue).
function getTextFromJavaScript(str:String):void {
sending_ti.text = str;
var jsArgument:String = sending_ti.text;
[Code].....