ActionScript 3.0 :: [flex As3] Function Non Recursive Call?

Sep 2, 2009

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.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: [flex As3]function Non Recursive Call. How?

Feb 3, 2009

So, 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.
What's the cleanest way to do that?

View 16 Replies

ActionScript 2.0 :: Place A For Loop In A Recursive Function With The Function Call Within The Loop

Nov 4, 2005

If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?

View 2 Replies

Actionscript :: Recursive Function And Returned Value?

Nov 5, 2010

I think I have the recursion working properly, but I'm not able to get the originally requested item's property set to the right value.The goal here is to find the topmost parent (or "ancestor," depth = 0) of the nested item (a taxonomy based on Dictionary "parent" attributes), and assign that originally requested nested item's "ancestor" property accordingly.For instance, in

Apples
- Red
- - Empire
- - - Fresh

"Fresh"'s ancestor should be set to "Apples." While I'm attempting this on an "on-demand" and individual basis, I'm open to a solution that tags all children that are related to the same ancestor in one fell swoop or for statement, since that would probably be more efficient.

REQUEST

for (var mc:Object in taxonomy) {
var term = taxonomy[mc];[code]....

As you can see, while the recursion does find the root, the originally requested item still gets the default value.

View 2 Replies

ActionScript 2.0 :: Recursive Function XML Tree

May 3, 2004

im having a problem reading a xml tree in Flash MX...[code]and this Actionscript to just to view the tree.[code]meaning that when it calls itself again, that it will stop searching the next items on the same level from where it was called.how do i not let it stop searching and complete the tree.

View 4 Replies

ActionScript 3.0 :: Recursive Function To Search Through XML Tree

Aug 27, 2009

I want to vreate a recursive function that will search through my xml tree and display all the leaves(node values); this is the function that I wrote:

function searchXML (theItem) {
trace("theItem.*.length() "+theItem.length());
trace("theItem.* "+theItem);
trace("--------------------------------------");
if (theItem.*.length() > 0) {
searchXML(theItem.*);
[Code] .....

View 1 Replies

ActionScript 1/2 :: Recursive Function Crawling Through Movieclips?

May 19, 2010

I have this function to find occurences of misstyped varaible names (with wrong lower / upper case). I have a movieclip called "debug" where I define and call this funciton ("getCase(_level0)"). But It never finds my testttt variable - If I put the test varaible in _level0 the variable is found. 
 
var targetsCase_ary:Object =  new Object();
var targetsLower_ary:Object =  new Object();        testttt = 1    testttT = 1        function getCase(clip:MovieClip, recu:Number){        if (recu==undefined) recu = 1;        var n:String;        for (n in clip){            var sPath:String = clip._target + "." + n;            var sPathLower:String = sPath.toLowerCase ();                        //trace(sPathLower + " " +

[code]....

View 3 Replies

ActionScript 3 :: Slowing Down Loop In Recursive Function

May 2, 2010

I have a difficult problem with a recursive function. Essentially I need to 'slow down' a for loop within a function that repeatedly calls itself (the function); Is this possible, or do I need to somehow extract the recursive nature of the function?

function callRecursiveFuncAgain(ob:Object):void{
//do recursive stuff;
for (var i:int = 0; i < 4; i++) {
_nextObj=foo
callRecursiveFuncAgain(_nextObj);
}}

View 3 Replies

ActionScript 3.0 :: Adding Timer To Recursive Function?

Nov 16, 2010

I made an app (Towers of Hanoi) and i added a "demo" button that solves the problem based on a recursive function. The button is supposed to make a move one step at the time, i mean one step at every few seconds so you can actually see how the algorithm works. The problem is i haven't really used the timer event before and i have no idea how to implement it in this particular scenario.

Code:
function hanoiPlay(n:int,a:Stack,c:Stack,b:Stack):void
{

[code]......

View 7 Replies

ActionScript 3.0 :: Recursive Function Returning Null Value

Feb 7, 2011

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.

[Code]....

View 5 Replies

ActionScript 2.0 :: Loading An Xml And Looping Through It Using A Recursive Function?

Jul 22, 2004

FLASH MX 2004

I am loading an xml and looping through it using a recursive function. The problem is that it only reads through the first tree and then quits..?

[Code]....

View 3 Replies

Flex :: Call Function After Remote Call?

Jan 31, 2011

I have a function in Flex which has three function in it.

public function update():void
{
A(); \Dispatches a event with Remote Call

[code].......

View 1 Replies

ActionScript 2.0 :: Creating A Kind Of Tricky Recursive Function?

Apr 4, 2005

Because it's a little hard to explain what I need.. I'll make an example.So.. I have the figure below. I mean.. that's what I'm trying to achieve. For that figure I have data stored in the folowing way._root.marc is an Array.All the paths that leave a square ... like From M0 if you choose 1 you'll get M1,From M0 through 5 you'll get to M3.. and so on.this is stored like_root.marc[0].p - the paths. If _root.marc[x].p.length is 0.. that means that Mx is the last one.. and has no paths assigned, like shown in the figure. My very big problem is that I need to position that MC's.. M3,M4.. all of them, according to the paths above them.

So, to position M2, i need to take a look at M1, and if it has any paths, more than one path, I need to move it further down. But this is not the end of it. If M1 has more paths that lead to other MC-s.. i need to take in considerations their paths too . This drove me mad for the last couple of days, and my time is slowly running out for my diploma What I've tryed till now was to build a function let's say... getNextY(m) that should return a number. A "ponder"?..like...to use it in a line like M2._y = (currIndex + getNextY(1))*dy;// here it should return 5 for instanceM3._y = (currIndex + getNextY(2))*dy;// here getNextY should return 1

View 11 Replies

ActionScript 2.0 :: Recursive Function - Reading A Xml Tree In Flash MX?

May 3, 2004

im having a problem reading a xml tree in Flash MX...i got this tree,

data.xml
PHP Code:
<menu>
<menuitem label="menu1">[code]....

meaning that when it calls itself again, that it will stop searching the next items on the same level from where it was called...how do i not let it stop searching and complete the tree..

View 4 Replies

ActionScript 2.0 :: Creating A Kind Of Tricky Recursive Function

Apr 4, 2005

I'm in a big big mess, trying to figure out how to do this for the last couple of days. I finaly came to the conclusion that I need a recursive function for what I'm trying to do. Because it's a little hard to explain what I need.. I'll make an example. So.. I have the figure below. I mean.. that's what I'm trying to achieve. For that figure I have data stored in the folowing way. _root.marc is an Array. All the paths that leave a square ... like From M0 if you choose 1 you'll get M1, From M0 through 5 you'll get to M3.. and so on. this is stored like _root.marc[0].p - the paths. If _root.marc[x].p.length is 0.. that means that Mx is the last one.. and has no paths assigned, like shown in the figure.

My very big problem is that I need to position that MC's.. M3,M4.. all of them, according to the paths above them. So, to position M2, i need to take a look at M1, and if it has any paths, more than one path, I need to move it further down. But this is not the end of it. If M1 has more paths that lead to other MC-s.. i need to take in considerations their paths too . This drove me mad for the last couple of days, and my time is slowly running out for my diploma What I've tryed till now was to build a function let's say... getNextY(m) that should return a number. A "ponder"?.. like...to use it in a line like
M2._y = (currIndex + getNextY(1))*dy;// here it should return 5 for instance M3._y = (currIndex + getNextY(2))*dy;// here getNextY should return 1 Why 5 or one? because it needs to take into account only if the paths are greater than 1.

View 10 Replies

ActionScript :: Flex - An Object Returned From A Function Call Changed The Next Time The Same Function Is Called?

Jan 10, 2012

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?

View 1 Replies

Flex :: Recursive Iteration Through Every Component Instance?

Nov 17, 2009

I have various custom component instances in my flex app. I want to loop through them recursively and get their instance Ids. The recursive part is very important to me. I have tried doing this, but it didn't do recursive:

for each (var myItem:* in this.MasterContainer.childDescriptors)
{
trace(myItem.id);
}

View 3 Replies

Actionscript 3 :: Recursive Flex View Component?

Sep 15, 2011

I have a Flex component that is a view of a data Object that recursively has a reference to itself.

For example if you had an Employee class that references a boss field of type Person, I'd like to nest the same view for that Boss. This shouldn't be an infinite recursive relationship (e.g. I'd only be viewing the boss field of each object).

I've tried creating an MXML component that references itself but when I run it locks up (seems like it gets into a recursive loop).

Is there anything you can do like includeInLayout conditions that will make sure it doesn't even instantiate that component.

View 3 Replies

Flex :: Flex - Function Call Inside Of Component?

Sep 1, 2010

I want to call an App function inside a (I know about the Component scope already).What I mean is this:

<mx:Script>
<![CDATA[
public someFunction():void {

[code]......

View 1 Replies

Flex :: Call() Of Function With Arguments?

Sep 4, 2009

I have a component that I hand over a function

public var func : Function;

Now the function is a function that has parameters in its signature

public function myFunction(s : String) : void {
doSomething(s);
}

from my component I can call the function with

func.call();

how to invoke the function with its parameters?

View 1 Replies

Flex :: Call Function When Dataprovider Changes?

Feb 6, 2011

How can I set a function to be called when the length of a DataProvider changes?

View 2 Replies

Flex :: Dynamically Call A Function?

Jun 2, 2011

How can we dynamically call a fuction. I have tried below code:

public function checkFunc() : void
{
Alert.show("inside function");

[code]......

View 4 Replies

Actionscript 3 :: Flex: How To Call Function Of Embedded Swf

Jan 5, 2010

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();
}

View 2 Replies

Flex :: Call Parent Function From ItemRenderer

Feb 6, 2010

I want to call the parent function called "edit_groups()" from the itemRenderer. The code for my itemRenderer is:

<mx:VBox id="vbx_container" paddingBottom="4" paddingLeft="4" paddingRight="4" paddingTop="4" borderStyle="solid"
dropShadowEnabled="true" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Canvas width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Image id="image" width="100" height="100" source="{data.thumb}" scaleContent="true" maintainAspectRatio="true"
complete="{image_smoothing_handler(event);}" trustContent="true" doubleClick="{Call The Parent Function"edit_groups()"}"/>
</mx:Canvas></mx:VBox>

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}"/>

View 3 Replies

Flex :: Possible To Call Function By Using Datagrid Column?

May 17, 2010

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?

View 1 Replies

Flex :: Call A Function When Building An Array?

Aug 16, 2010

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.

View 1 Replies

Asp.net :: Access / Invoke / Call Flex Swf Function?

Feb 20, 2011

I create a swf with flex. Than I embeded that swf into aspx page.But how can I access/invoke/call swf function from asp.net???

View 1 Replies

Flex :: Call Child Function From Within Parent?

Jun 1, 2011

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?

View 2 Replies

Flex :: Call A Function In It From Php Side Of AMFPHP?

Aug 26, 2011

Is it possible to call a function in flex from the php side of AMFPHP?

For instance, and error is thrown in php, can i "listen" for it in the flex app?

View 1 Replies

Flex Get Height Of Children When To Call Function?

Jun 8, 2009

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?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved