ActionScript 3.0 :: Retrieving File From ApplicationStorageDirectory
Jan 11, 2011
I have this Load Manager Package class file now for a while and I would like to make changes to it e.g. 1st step.How to read the Xml/Text file. The first part is the original code.[code]The second part is in a way how I would like to do the same as above, but loading/reading it from the 'applicationStorageDirectory'. I have left two lines in there which are not used just for testing things. The App works as is eliminating all Errors, but of course with nothing showing of the text file.[code]
Edit: By value i mean a number that is in my xml file.This is probably a very simple problem, but i've been working with this problem a few days now. I really suck at Actionscript, thats probably why.Well, I want to retrieve a value from a xml file and put it into a variable outside the onLoad function. Somehow i can trace movieIds inside the onLoad function but not outside it.Here is the code:
var playlist_xml = new XML(); playlist_xml.ignoreWhite = true; playlist_xml.onLoad = function(success) {
I am making flash mp3 player. I am using FileReference to browse for files. I won't get the file path and later realized that it is a security concern. But I tried using HTML.
I used ExternalInterface to trigger flash function from HTML which opens file selection box using FileReference.browse() option.So, as the flash file is in the HTML form, can i track the file path in HTML and send it to flash.
I was trying to save an imagefile to a directory in applicationStorageDirectory of my air project. Created the directory first.[code]Is there a way that i can store the image in my "vispics" directory?
When it initially runs,I want it to copy an xml preferences type file from the applicationDirectory to the applicationStorageDirectory,so that the file can be written to as the user changes prefs.The following code works fine - nameStyle.xml gets written to the Local Store folder on my Windows machine.However, a folder called 'applicationStorageDirectory' also gets created on my desktop, and is populated with the file nameStyle.xml...
var nameStyleFileSrc:File = File.applicationDirectory.resolvePath("nameStyle.xml"); var nameStyleFileCopy:File = File.applicationStorageDirectory.resolvePath("nameStyle.xml"); nameStyleFileSrc.copyTo(nameStyleFileCopy, true);
So I have two questions: 1.how do I stop the folder being created on my desktop?
2. is there a way to have files placed in the Local Store folder (or whatever folder depending on the platform) during installation, rather than copying files from the app directory when it first runs?
I have an Air application that lets users import jpg, png and swf files and use them as the source to an Image which they can drag around a Canvas.he import function copies the selected file to an images directory inside ApplicationStorageDirectory.When I click on an Image that has an swf as its source, I get a Security Sandbox Violation (eg. SecurityDomain 'app-storage:/Project1/images/menuBarBkgd.swf' tried to access incompatible context 'app:/Main.swf'). My mouseDown handler doesn't get called so I can't select it and allow it to be dragged.
I have the following code on the main timeline. I have soundLoad_mc assigned to the SoundChgUrl class.soundLoad_mc.mp3URL = "climbing.mp3";soundLoad_mc.swfName = "journey.swf";The code below is from SoundChgUrl. The import to mp3URL works. The one to swfName does not - it throws "1119: Access of possibly undefined property swfName through a reference with static type classes:SoundChgUrl." This doesn't make sense to me.
I'm trying to read date variables from an external text file. I'm using the LoadVars method and it is working fine for regular string variables. I'm running into trouble trying to convert some of those strings into date variables so I can compare the current date to the targetDateX variable from the text file. I'm working on a countdown timer for a list of different times/dates. It will display the time left until the first event, then after that event the time left until the second event. I'm running the code in a for loop and everything is working except being able to convert the string with format (yyyy,mm,dd,hh,mm) into a date variable- I've attached a sample of where I'm having trouble.
What I'd like it to do is find out what key was last pressed and then based on which key it was, go to a specific frame of guy_mc. So basically if the left key was the last key press I want it to go to frame "Left", if right key was the last, go to frame "Right," etc. I'm completely lost on this one and every tutorial I come across is based in AS2 which has much simpler methods than AS3.
Code:
//listen for guy_mc to see if all keys are up guy_mc.addEventListener(Event.ENTER_FRAME, allKeys); //if all keys are up...
I have an array variable called ball[#], which value starts at 0 and is incremented up to 8. I also have a corresponding array variable called _ballPlaced which returns true or false if a ball is placed in a target zone. What I would like to do is retrieve the array value variable from the ball[#] at any time. For instance, the ball[#] variable can be clicked and dragged, so when it's selected it becomes the event.target. E.g. How can I put the array value of the ball[0] in the ball _ballPlaced array.
ActionScript Code:event.target._ballPlaced[/* retrieve vale of ball[0] array i.e. 0 and put it in here */]
So basically, I need to find a way to retrieve the image url that is stored in a database, and I need to do it through asp.net if possible (I want to avoid XML if I can). I'm an actionscript 3 newbie so I don't know what calls I might use to connect to the .net page, but I am able to retrieve the data through SQL to the .net page.
I'm using multiple timers in a script, but I would like to use the same function with a Switch to define the appropriate action corresponding to the event.target. I've tried e.target.name but it says that name isn't a property of the Timer class... how can I retrieve the names (timer or timer2) within the onTimer function?
Code: var timer:Timer = new Timer(3000); var timer2:Timer = new Timer(3500); timer.addEventListener(TimerEvent.TIMER, onTimer);
I have a input box in which what is typed is returned in a text field on the same page.I've created the variable inputTxt to hold the typed text and added the following code to the submit button, which works fine.
Is there a way of finding out the color of a graphic? For example if i have an array of rectangles, each with a different color set using graphics.beginFill(), can I then do something like:
I have created a datagrid with 2 columns. The first one is the normal text data and the second column contains buttons for each cell. What I want to do is retrieve the text information when the corresponding button on the same row is clicked. How do I get this information? I am unable to use selectedItem because I do not want to select the correct row before pressing the button.
I have a game, in which the player can open maps to edit them. The maps each have their own colour. The player assigns a colour to the map by using sliders (R, G, B) This all works fine.
However, I also need a way to put those sliders back in place when re-opening an existing map. This means that I need to know what the percentages of R, G and B are in a colour. I made flash trace a few of those colours, this is the output:
16646398 0 16646144 65024 58878
I need to know the amounts of R, G and B in any colour.
Have xml that looks something like the following: <level1>ARTWORKS <level2>ARCHIVE <level3>COLOR</level3> </level2> </level1>
I am trying to retrive the ARCHIVE String, but can't seem to do that, without also getting the <level3>COLOR</level3> node. I am doing this like this: _ xmlData.navigation.level1.level2[0], which returns this: ARCHIVE <level3>COLOR</level3> How do I get it to where it only returns the ARCHIVE?
I want to get the variable-value name pairs from an object. Anyone has got an idea how to do it? The name-value pairs are always different, not even the same lenght. I need an universal loader
I'm trying to retrieve the value of an array element in a trace statement...how do I go about this? I've had a look through the AS reference manual but can't work out what should follow the dot '.'?
ActionScript Code: trace(currentBall.name + " is in " + zone[i]./* something here to retrieve array element value */);
In my Javascript I am adding a variable ('videoToPlay') in order for it to be passed to the Flash object with the purpose of using it to specify which video among a list of scrolling videos is to be played.
I am completely new to Flash and Actionscript and am finding it difficult working out how/where to retrieve my variable.
I'm working on the pinball game. I need to come up with a way of retreiving the right angle from an curved line. The idea is to have the ball follow a curve around the upper border of the game field. The ball itself is going to be a point, which the ball follows, so that I can use the shape of the object when doing hit detection. I'm not sure if that's relivant to the subject or not.
I have a set interval working fine, however when they press the button I use clear interval. When they then press the other button to start the interval again it wont do anything?
I've just started out working with cookies in flash and looked at the poms tutorials [URL]Is there a list of commands that could get the users browser software etc for example?