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;
In ActionScript 3, there are some classes that will represent a value rather than the class itself. It's hard to explain properly what I mean, so take this example:
I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query
I have an external function that needs to return a customerID value. However, it seems to be returning the initial value instead of the value that I believe is being set within the function.[code]
I decided to turn this util into a class because I use it in almost all of my projects. Basically what it is is I import an XML file and it has all these HTML characters like & or and my function basically converts those strings of characters to its regular form ie: ['&' (&] or [' ' ( )]
so calling it in a FLA file would be something like this:
Code: var entity:DeEntitizeHTML = new DeEntitizeHTML("bob & jim"); and here is my class file: Code: class com.dop.DeEntitizeHTML { function DeEntitizeHTML(my_str)
[Code]....
how to return that value back to the var entity in my FLA.
Is there any method that returns the Class name of an instance as a String? I would like to then pass that String as the parameter into the getDefinitionByName() method to create a new instance of that Class (whatever it is).basically, whatever I have stored in the variable 'currentPage' (which could be any number of classes I haev written), I want to create a new instance of (therefore re-instantiating it). this will then act as the method for a 'reload' button which is designed to reload whatever the current page/activity is.
I have a variable which needs to be updated upon user input. It works inside the function, the trace function returns the correct type, but for a reason it wont pass it on the variable on the main timeline.[code]
Say I have four sub-classes of 'Car'. One for each color. I want to have one function that can build and return a 'color-car' sub-class based on the passed value. This is a dumb example, I know, but it is precisely what I am trying to do only on a smaller scale.
public class Car { } public class BlueCar extends Car
[code]....
Ok. You get it. This doesn't work for a reason unknown to me. I get 1118 errors which complain about conversion of BlueCar into Car, etc...
I need to load data from a database, so I created the following function and placed it in frame 2 on the main timeline.
Code: getQuestionSet = function (category:String, subject:String, level:Number, count:Number):Array { var questionSet:Array = new Array(); var writeV:LoadVars = new LoadVars();
[Code]...
Whenever I try to call the function, it fails to set the value of the questions array. It always appears empty(questions[0]-questions[10] have the value undefined). But, if I check the values from within the function after I have set them, it works, so I know that it is receiving the values. What am I doing wrong?
Code: questions = getQuestionSet("Art and Music", "Art", 1, 10);
Here is an example of how I have would call the function.
I have a question regarding classes.[code]What i want is that clue() should return me the value of NetStatus which is generated in returnResult() when this function is invoked.Now in this case var "f" will become undefined because Clue() is not returning anything, so how can i find a way that value of NetStatusEvent.NET_STATUS (in this case) will be returned from Clue().Although i can use ENTER FRAME EVENT to check when it has generated a status but i'm sure that there must be a better way.
I 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
I built a class that parses JSON data, stores it in an array, and now I want to return that data so that it can be stores in an array in my root AS file. I'm eventually trying to pass the returned array to another class. My class looks like this:
1061: Call to a possibly undefined method payload through a reference with static type com.src.DataGrab.
Does anyone have advice on what might be wrong with my class, or a more logical way to write the getResults() function so that I can get retrieve the array being generated by this class?
I can use toString() to return any string desired when using trace(instance), is it possible to return other types of objects?For example, I may have this class:
public class List { private var _content:Array = []; public function add():void{} public function remove():void{} }
I normally need to make a getter that returns the _content, eg:
public function get content():Array{ return _content; }
So that I can do things like:
for each(var i:Object in myList.content)
Can I make myList in the above case actually return the value of content automatically? So that I can do like:
trace(myList); // item, item, item (similar output as tracing an array) for each(var i:Object in myList)
I am using Flex's Alchemy library to generate SWC's out of C files. I have a byte array (unsigned char buffer[size]) in the c-layer that I'd like to return to the ActionScript layer as a ByteArray. Do I have to iterate through the array and explicitly call AS3_Set on each element or is there a way to just return the entire C array at once?
I've been trying to implement a QuadTree to store a two-dimensional array representing a terrain. I generate the array first, then I use the below function to generate a QuadTree for the array.
I need to get the value inside a handler.. ActionScript Code: public function verifyUser(p:String):String{ var verify:String var variables:URLVariables = new URLVariables(); var varSend:URLRequest = new URLRequest("verify.php"); varSend.method = URLRequestMethod.POST; varSend.data = variables; [Code] ..... It's always returning 'null'. because its not waiting for the completehandler to be completed and just passes the null value of verify..
ok so i've been stuck on this for a while...What i'm trying to do is create a function that updates a global variable (randomVar) that is itself a parameter in the function e.g
[Code]....
Basically, i thought randomVar and vari were the same so when vari was changed randomVar would too but that's not the case. So how do i make the parameter equal the new value(5). I want to repeat the function using different variables so putting randomVar = vari in the function is not possible.
I have 5 buttons that onRelease (= when clicked) calls the same function with each a different variable.
contentLoader(profile); contentLoader(projects); and so on.
the function is:
function contentLoader(sName:String) { trace(sName); }
Now the trace returns 'undefined'...I just do NOT see it anymore The idea behind is that I want to use a moviecliploader to load in the content corresponding with the clicked button (projects.swf, so it'll use myMCL.loadClip(sName + ".swf"); That trick always worked, but like I said, it keeps returning undefined. Did I make a mistake by strict data typing sName as a String?
I have a function that returns an object full of data pulled when an XML file gets parsed. But I also need to use an array object with additional data. That array also gets built in the same function. Is there a way to return both? I am trying to get both the "Obj" and "SlideTime[idx]" data to use as globals.[code]
I have this class that basically reads a json file and then places it into an array, which I then want to pass back to the var set etc, how do i go about this:I have the following at present:Heres part of my list class:
Code:
... the normal import etc of stuff above then the following.... public function loadVideoList(_videoURL:String=""):void { try{
I am working with code where the variable "k" is a counter. I stripped out the extraneous stuff from the code below - so essentially when the function onExamPlusClick is called, the counter "k" and the minutes of an activity in an array both increment (as well as other things not shown). I'd like to return "k" as well as "activity[0].minutes" to the main program. Since the function is a MouseEvent, I'm unable to change "void" to "number"... and not sure how to return (pass) those variables back to the ain program.
I'm trying to return XML from an event complete back to the main function, but can't figure out how to do it.Here's the functions I'm calling:Main File:
public var mySendAndLoad:SendAndLoad = new SendAndLoad(); mySendAndLoad.sendData(url,variables) The mySendAndLoad class:
In C you can pass a reference to a data item as a parameter to a function. then within the function you can write to that address thus passing back a value to the caller. Can you do anything similar in AS3?
I know you can use the return statement but I want to return a status by that mechanism plus a value in a parameter.