Link to home
Start Free TrialLog in
Avatar of FLAASHER
FLAASHERFlag for Saudi Arabia

asked on

Reading from external file action qustion ....

Hi experts

http://flash-db.com/Tutorials/loading/loadingData.php?page=2

in this example flash read more than one record from external text file with this code ..


        myData = new LoadVars()
        myData.load("anastasio2.txt")
        myData.ref = this
        myData.onLoad = function(succes){
            if(succes){
                for(var i=0; i<this.cant; i++){
                    this.ref["Title_txt"+i].htmlText = "<b>"+this["Title"+i]+"</b>"
                    this.ref["Comments_txt"+i].text = this["Comments"+i]
                    this.ref["holder_mc"+i].loadMovie(this["Image"+i])
                }
            } else trace("Error loading data")
        }


my quistuin is
What is " ref " and we use it many times in the code
can any body explain the example ???


Thanks
Avatar of Billystyx
Billystyx

from the tutorial I would say you could just as easily replace 'ref' with _root, and get rid of the 'this'
does this sample actually work? I noticed success is spelled wrong in it...

Billystyx

(as in the first example).
Because, the textifelds are on the _root timeline there, as is the loadVars script.
So you don't really need it, but it is a method to give you the current timeline, no matter where youa re working.
Does this make sense?

Billystyx
ASKER CERTIFIED SOLUTION
Avatar of negatyve
negatyve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial