Can I call a function when building an array in Flex 3?
public function gridBuilder(myArray:Array):void {
var i:uint;
for (i=0; i<myArray.length; i++){
[Code]....
MyArray is the result of a remote call to the database. I then prepare the array to be used in a dataGrid. I also want to call a function that provides a grade. Unfortunately, my function appears to be called only once. Is it possible to call a function when you're building an array? see the "Grade:" bit.
function doSomething(... args): Object { // do something with each arg }
However, I'm building the arguments for this dynamically:
var someArgs: Array = ['a', 'b', 'c']; doSomething(someArgs);
The problem is, when I call the function in this way args ends up being a 1-element array with someArgs as the first element, not a three-element array.How can I call doSomething with someArgs as the argument array?(For the search engines, this is argument unpacking)
I've defined an array which stores the function name, like this:
var aresetButtonTop:Array = new Array(resetTop1,resetTop2,resetTop3,resetTop4,resetTop5);
Then I have a button named"btnresetTop" which when clicked will call one of the five functions stored in the above array(aresetButtonTop). The functions are called at run-time depending upon some conditions. I need to figure out how I can call those functions using the array index. I'm using the following code to call the function. The value of i has been already calculated.
After doing this I'm getting the following error when I click the button:
TypeError: Error #2007: Parameter listener must be non-null. at flash.events::EventDispatcher/addEventListener() at gallerytest_fla::MainTimeline/thumbTopClick()
Note: thumbTopClick() is a function inside which all these codes are written.
I need to find out whether it is posible in AS3 to call a function name using the array index or not.
So I'm attempting to call a random item from an array which is all fine and dandy, but I'm attempting to fill the array with functions, and therein lies my problem.Here is my code, it's just a test file I made to keep it simple while I learn how to do it:
Code: var functionArray:Array = new Array('a', 'b', 'c'); function a():void
So I'm attempting to call a random item from an array which is all fine and dandy, but I'm attempting to fill the array with functions, and therein lies my problem.Here is my code, it's just a test file I made to keep it simple while I learn how to do it:
Code: var functionArray:Array = new Array('a', 'b', 'c'); function a():void
I'm making numerous ExternalInterface calls to JavaScript methods and have a helper function for doing so:
[Code]...
However this means the JavaScript method will only be passed one argument - the array of arguments - meaning I have to change the JavaScript to accomodate this, e.g. instead of:
if you look at the code:: barn is an instance of an MC on stage. I have a few buttons stored in an array which i want to attach scripts with a for loop. Why does adding an item from the array not work when placed inside the function call?
I have an AS3 program that calls a function multiple times. The function must return multiple variables, so I created a class for the function to declare an object containing all of these variables. For example, here's my class:
package { public class PER { [Code].....
Let's say the calling program calls the function, which returns the variables into data_set1 (where data_set1 depends on input variables arg1, arg2, arg3) using:
var data_set1:PER = function_name(arg1, arg2, arg3);
The calling program does some stuff, then calls the function again, but returns the variables into a new variable name, data_set2:
var data_set2:PER = function_name(arg4, arg5, arg6);
My intention is that data_set1 and data_set2 are different (e.g. not linked together).
My question is, given that arrays are passed by reference, will data_set1 be modified to agree with data_set2 upon the 2nd function call? Why or why not?
i've got a scenario that i'm working thru on paper first and wanted to run it by everyone to see if i'm doing it correctly and most importantly, efficiently so, here goes...the situation | an instance of the DateChooser component reads an xml file which houses info for homework assignments and their due dates. if there is a due date, make sure that date is highlighted on the DateChooser component. from what i've been told, the xml file stores urls which will tell if there is s/thing due on a particular date.
[code]...
What needs to happen as soon as the xml file is loaded? i.e. do i call a function which parses the xml data and puts it into an array? then the DateChooser component iterates thru the array looking for boolean values noting if there is an activity or not and if so, on which day. if it finds one, it sets its highlight property to true for that particular day.
so I have writing a function that returns objects on the stage and puts them into an array. and the function works fine until i call the function on more than one object name, meaning if im in the root class, and I call this function on object1 lets say it will add all the object one's from the stage, but if i call it on object2 it will throw an error, which makes some sense, i guess it means that it is not adding it to a unique array, but im not sure how to do that. would it be a good idea to maybe make a multidimensional array? if that is the case would it be too slow?
I'm looking to build a flash application that acts as a "shell" around a flash game.I only need it to do some pretty basic functions:
1) Calls a PHP script I wrote to determine a few things (if user is logged in, what their userid is)
2) If the php file says the user is logged in, the "shell" should let the user play a .swf flash game that I wrote. And, after they are done playing my .swf game, I want the game to pass out a parameter (score). Again, the "shell" will call a prewritten php script to store the score.
3) If the php file says the user is NOT logged in, the "shell" should display a login box (username/password).
My main challenges have been getting one flash application to call another. (ie: the shell app calling my game). Is this possible?
I create standard AS3 flex project. In constructor goes only start();
rest of functions are basically this: private start():void { f1();} private function f1():void { f2();} private function f2():void { f1();}
And it's standard recursion. SWF either breaks or loops as many times as I tell it. One f calls the other, which calls first... I do not want that. I want f1 to do some stuff, calls f1 and closes itself. Than f2 works, calls f1 and closes. And so on. Like having 2 sets of code that loops through.
I have a Flex 3.4 app that embeds a swf with mx:SwfLoader...
That swf has a public function named "playIt". I've tried dispatching events to gettingHere.content, casting gettingHere.content as a MovieClip and other stuff...
var swfApp:MovieClip = MovieClip(gettingHere.content); if (swfApp.hasOwnProperty("playIt")) { var helloWorld:Function = (swfApp["playIt"] as Function); helloWorld(); }
And I call my itemRenderer from an application like: list_groups_modify.itemRenderer=new ClassFactory(groups.list_groups_modify_item_renderer); <mx:Label text="{data.label}" textAlign="center" maxWidth="60" toolTip="{data.label}"/>
Is it possible to call the function by using the datagrid column item?I want to call the function while the user click the particular column item in the datagrid?
Is it possible to call a child function from within the parent? I know to go child > parent, you can do parentApplication.functionName(parameters);, but what about going the other way... that is parent > child?
I have a function I wrote that gets the height of the application without scrolling. Meaning the height it would need to be to not have to scroll.
[Code]...
This function works well but the problem is knowing when to call it. I planned on calling it after I add/remove any children from it. However thats still too soon because I don't get the correct height yet if I run it then. The fix I currently have is using a Timer to call the function about 300 milliseconds after a child is added/removed which seems to work well but I think this is a very risky fix. So I was wondering a better solution. I am thinking there has to be some sort of event I can listen for that will tell me when its ready for me to run this function, I just don't know what event that would be?
I was wondering if flex has some events that can call before I close the whole application or close browser. Since I would like to send a httpservice to a php before the swf is closed. I tried this before: