Actionscript 3 :: Returning An XML Object After Loading Its Data?
Mar 23, 2012I have created a class which loads the data from an xml file.
[Code]...
I have created a class which loads the data from an xml file.
[Code]...
in AS3 I'm trying to load a URL (a Yahoo address) into the application so I can process the source code and pull things out of it.However, when I load it, or any other page, I get 0 bytes back.Here's my current code.
private function doSearch():void {
var req:URLRequest = new URLRequest("http://yahoo.com");
var loader:URLLoader = new URLLoader();
[code].....
I've been trying to figure out what I'm doing wrong here. I the below code works, but I want another function to be able to use the data stored in the 'sectionPathes' array.
How can I 'return' this data, so that other functions/etc can use it.
[Code]...
I have a problem with connecting as3 with php. I get the data return from php is wrong.
This is my code
AS3:
var file:String="test.php";
// Define global variable
function GetXMLfile(){
var loaderphp:URLLoader=new URLLoader();
var urlRequest1:URLRequest = new URLRequest(file);
loaderphp.addEventListener(Event.COMPLETE, GetCharInfo);
[Code] .....
I'm currently working as part of team of developers and we've run into an issue with our FMS project.In our site the user is able to record video of themselves which is turned into flvs and stored by the FMS. These videos are played back at a later time. The site works fine but intermittently stops recording new videos or streaming previously recorded videos.The only solution at this point is to restart the server. The server logs show that the onDisconnect event handler is running when users terminate their sessions and we can see that the number of active connections does not appear to be exceeding the limit on the server. There are no runtime errors to indicate that anything has gone wrong.From looking at output from the app it just seems like the publish and unpublish event handlers stop running but nothing actually breaks.The user doesn't realize anything is wrong until they try to watch their videos only to get a blank screen.
We're wondering if perhaps it is a garbage collection issue? Either the garbage collector in the FMS is running and taking a really long time to reload the app or perhaps it isn't running at all and somewhere some memory is overloading.
I'm trying to construct a "getter" function in which a movieclip obtains it's childs current frame label, but for some reason I cannot get it to work.
Part of Block.as :
ActionScript Code:
public function getStatus(acs:String):String {
return (MovieClip(this.getChildByName(acs)).currentFrameLabel);[code]........
There are 12 color variables, and each answer adds a number to each variable.At the end of the quiz, all the variables are put into an array, and sorted. Then the 3 highest variables are displayed. I have gotten this far. My problem is that I need to link the variable name (color) with the number it returns.[code]
View 2 RepliesI've created a function to send Post data to my server, and this then outputs xml to the page. What I can't find any information on how to get this data from the page back into flash.
View 2 RepliesI am new to AS3 and need to gather data from an XML file, parse it and then return all the vars to be used globally. How do I return an object like in the code below?
Code:
var dSession:Object = new Object();
function parseXMLData(incomingData:XML):Object
[code].....
i am trying to return an XML object, but having issues. The object is only created via an Event.complete function. I need to return the XML created from my loadXML function via my grabXMLfromFile function.
Code:
function grabXMLFromFile(attrPathToXML:String):XML {
var fileUrl:String = attrPathToXML;
var myUrlRequest:URLRequest = new URLRequest(fileUrl);
[Code].....
I'm trying to get the value of a JSON object in ActionScript 2 but it keeps returning undefined or [object Object].Here is my code:
for (var i:Number = 0; i < oProduct.prosAndCons.pros.length; i++) {
if (i == oProduct.prosAndCons.pros.length) {
break;[code]....
I'm able to return django models that have only CharFields/Dates/Integers, but now I'm trying to return models that have ForeignKey properties and I'm getting this error in Flex in my NetStatusEvent.NET_STATUS onError event handler:
m_info Object (@16491fe9)
code "NetConnection.Call.Failed"
description "HTTP: Status 500"
details "[URL]"
level "error"
Here are the models that matter in models.py:
class RewardActBase(models.Model):
user = models.ForeignKey(User)
start_date = models.DateTimeField(blank=True, null=True)
progress_value = models.IntegerField(default=0)
[Code] .....
Then when I want to get retrieve these object via pyamf, this is the method I'm using, which is giving me the error I listed above.:
@login_required
def get_challenge_act(http_request, location_id):
user = http_request.user
c = ChallengeAct();
[Code] .....
The interesting thing is that if I change my get_challenge_act method to return a property of the ChallengeAct object, I don't get the error. So I can return properties or objects that belong to the ChallengeAct, but not the ChallengeAct itself. For example, the following code returns a Challenge object with no errors:
return c.challenge
So it appears that there is some problem returning a Django model with foreginkey models as properties?
I have built a XML decoder that places any supplied XML data into a object and spits it back to the callee.Everything is working so fine, the XML is being parsed, data going into its proper locations... however, when the script does its return, nothing is passed... just a object with no contents...
function getXML ( tXMLData ) : Object
{
// init Counters
[code]......
I have, among many objects, a SimpleButton called nextBtn on the stage on the second frame. There's a function on that frame that does various things, one of which is adding a MouseEvent to that button. After moving to the next frame programatically and returning to the first frame the button is now gone from the stage. Because it seems to be gone, there's a null object reference error where the listener is added.
I've verified that:
- There are no other objects on the stage that share the same instance name
- This happens to MovieClips as well
- If I avoid adding the listener the second time via wrapping it in a if nextBtn != null statement, moving back another frame causes a button on that frame to disappear
However, on a bright note its coming!!!! So far, everything is going well and I am now seeing the light with AS3I do have a question on returning a variable from a function that loads an external CSS. This particular function is located inside a LoadStyleSheet.as class along with another public function that sets text properties to fields when accessed. What I am looking for is accessing the stylesheet after its been loaded in another class. I know in AS2 I could use the Delegate method for something similar to this situation. Not sure what the next step is for AS3. Anyhow, function script is below.
ActionScript Code:
public function loadStyleSheetItem(loadStyleSheet_str:String):void {
var styleSheet_css = new StyleSheet;
[code]......
I seem to have an issue with a flash I have written. The person who I made it for is telling me that first time he loads the page with the Flash in it, it loads fine. However, at this point if he navigates to another portion of the site, then goes back to the Flash page, he says it freezes on the loading bar. Consistently everytime, but only on his work computer, not home computer or lap-top. I think it might be a caching issue in IE, but I am kind of stumped, anyone ever experience this?
View 9 RepliesI'm using the native Flash StyleSheet Object to hold externally loaded CSS styles, and when I run the the getStyle("myStyle") function of the StyleSheet Object, it returns an Object in all cases, even when the style doesn't exist!
In cases where no style is found on the StyleSheet, the ASDocs say that the getStyle() function should return null. So if "notAStyle" is not a style on the StyleSheet, and I test[code]...
Everytime a clip is being started the line var so = SharedObject.getLocal('mysharedobject', '/'); creates new mysharedobject instead of returning the reference to the existing one. What might be the reason for this?
View 2 RepliesI'm creating a small app to run from CD-Rom/local installation that will use multiple shared objects for data storage. To ensure proper saving without surprising the user with a permissions dialog unexpectedly, I'd like to request unlimited data storage on first time app launch - Joey Lott shows how to do this in the Actionscript Cookbook... request=mySO.flush(1024 * 500);
My question is,Can I perform this permissions request with the user a single time with a generic app SO in global fashion, so that the permissions would be set for any SOs created during the use of the product (all written to same SO directory),or do I have to request
permissions for each and every SO created? Since the latter would be unacceptable from a UE standpoint, that means stuffing all app data into a single SO which doesn't seem so great from a data config perspective...
Loading data from the test.php into the startLoading();
How do I load the data from test.php "echo $photo_out;" into the startLoading();
loadVariables("test.php", this, "POST");
infoField._visible = true;
startLoading(test.jpg);
[Code]....
I have read through Shared Objects but i couldn't get it work...
I just have to save my data, maybe array into .txt file and later on
retrieve from the same .txt file...
Anyone here have an example or some source code so i can have reference on it?
is there a way to clear an XML object of its data to allow it to load new data from the same URL?
View 1 RepliesI'm using a loader for people to use to upload their own images for a background, and I want it to remember the image the next time they come to the page, so is there any way to save the loader data in a shared object? I haven't tried just using something like
Code:
sharedObject.data.dataName=loader
because I assume it doesn't work that way.
I am attempting to get data from an xml file load in flash. I followed a tutorial in a new fla and it seemed to work fine, I then tried to adapt it to my own needs which worked fine. But then when trying to implement this into my news section it doesn't seem to work. I am trying to make a news section, that displays the date and news article. This is in within a movie clip, I even tried putting it in the timeline of the scene but still nothing.
- I have 2 dynamic text boxes, date_txt and news_txt
- The xml file is named news.xml,
- both the fla and the xml are in the same folder
This is the actionscript I am using:
function loadXML(loaded) {
if (loaded) {
_root.thedate =
[Code]....
I created an array in the var declarations with Code: var private eDrag:Array In a function that adds imported mcs to the stage, I also added code to push each to the array. Here is an example of a block of code loading the object with the part pushing the object to the array at the end:
[Code]....
I'm loading a .jpg into an object, and what I'm trying to do is load that same .jpg into another object later on in the script without requesting it to be downloaded (since it should already be in memory). Here is an example of what I'm using:
Code:
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("photo1.jpg"));
[code]......
I have the following code:
[Code]....
In another function I have the following:
myText.htmlText = pageDetails.text;
Now, if I uncomment the above (and pull out the previous definition of pageDetails), everything works just fine. However, if I leave the comment, it throws the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at DeltaMain/Text() at DeltaMain()
Now, the file pageDetails.xml does exist in the appropriate folder with the following, essentially identical to the above comment:
<PAGE name='index'> <DETAILS>This is the home page.</DETAILS></PAGE>
I've built a custom FLV player that needs to rely on a PHP script to serve it FLV files in order to control access to those files. My player uses the FLVPlayback component.My actionscript makes a call like this to the PHP script:[code]When tested, the FLVPlayback component simply won't accept the FLV served up to it in this way. It WILL work if loading directly from the file system, so I know my actionscript works. I can load just about any other type of file into Flash this way,including JPG and SWF. FLV is the only format that doesn't work.I've added the video/x-flv MIME Type to all test servers I've tried this on, so the server should recognize the file.
View 1 RepliesI have XML file
[Code]...
in my application is tilelist which loads data from XML why I can not take the name of the selected item in the TextInput?
[Code]...
I'm trying to find a way of pushing the data of a specific XML Node to an Array with a for loop, but I can't seem to find a solution, because the name of the Node I'm pushing data from, depends of the current integer inside the loop.
[Code]...