[osflash] LoadVars Error when in a function

Farid Shahlavi fshahlavi at gmail.com
Tue Oct 3 19:11:22 EDT 2006


Well simply because you have a function that is recursively calling itself
from the inner onLoad function.

 

function loadProfile():Void {

            trace("loadProfile called");

            var cb_lv:LoadVars = new LoadVars();

            cb_lv.onLoad = function(success:Boolean) {

                        if(success) {

                                    trace(this.detail);

                                    var arr:Array = this.detail.split("|");

                                    loadProfile(arr);/* This is where you
are calling the outer parent function recursively every time onLoad is
triggered,

which in turn calls the load function on the loadVars object and so on and
so on .. etc */

                                    this.onLoad = null;

                                    delete this.onLoad;

                        } 

            }

cb_lv.load("http://192.168.100.147/Property-getDetail.aspx?id=76");

}

 

Cheers,

 

Farid

  _____  

From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Jonathan Spooner
Sent: Tuesday, October 03, 2006 6:18 PM
To: Open Source Flash Mailing List
Subject: [osflash] LoadVars Error when in a function

 

I would like to have a LoadVars within a function.

 

It works but itcontinuously calls its self. Why, Why, Why

 

It seems when you place the .load() call inside the function it

repeatedlycalls.

 

Thanks for you help.

 

function loadProfile():Void {

            trace("loadProfile called");

            var cb_lv:LoadVars = new LoadVars();

            cb_lv.onLoad = function(success:Boolean) {

                        if(success) {

                                    trace(this.detail);

                                    var arr:Array = this.detail.split("|");

                                    loadProfile(arr);

                                    this.onLoad = null;

                                    delete this.onLoad;

                        } 

            }

 
cb_lv.load("http://192.168.100.147/Property-getDetail.aspx?id=76");

}

loadProfile();

 

 

 

 

-/-

 

JONATHAN SPOONER | senior interactive developer

 

ph 858 777 5034fx 858 777 5050

 <mailto:jspooner at aviatech.com> jspooner at aviatech.com

 <http://www.aviatech.com/> www.aviatech.com




 

Aviatech, LLC

Integrated Marketing Solutions

4350 Executive Drive, Suite 200

San Diego, CA 92121

 

CONFIDENTIALITY NOTICE: This email transmission, and any documents, files or
previous email
messages attached are intended only for the person(s) or entity to which it
is specifically addressed
and may contain confidential information that is legally privileged. Any
review, re-transmission, 
dissemination or other use of, or taking of any action in reliance upon,
this information by persons 
or entities other than the intended recipient is prohibited. If you received
this in error, please 
contact the sender and destroy the original transmission and its attachments
without copying or 
saving in any manner.





 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20061003/b3d3ca7e/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1539 bytes
Desc: not available
Url : http://osflash.org/pipermail/osflash_osflash.org/attachments/20061003/b3d3ca7e/attachment-0001.gif


More information about the osflash mailing list