A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: another quick loadVars question -->

  1. #1
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Location
    Steve Job's Doorstep
    Posts
    695

    another quick loadVars question -->

    my problem is hopefully a simple one.

    Loading vars from a txt file - works
    parsing vars into a usable array - works
    calling the vars from anywhere in the flash file - does not work

    Code:
    varReceiver = new LoadVars();
    varReceiver.load("http://www.somedomain.com/mp3/songs.php");
    varReceiver.onLoad = function() {
    	songs = this.fileList.split("|");
    	titles = this.titleList.split("|");
    	artists = this.artistList.split("|");
    }
    if i trace the vars inside the function, they output the correct values. i.e. trace(songs[0]); ... however if i call it anywhere outside the function it is undefined...

    how do i get the values out of the class!?!?

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Try this
    code:

    this._parent.songs = this.fileList.split("|");
    this._parent.titles = this.titleList.split("|");
    this._parent.artists = this.artistList.split("|");



    Hope it helps
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Now listen heah! Mac8myPC's Avatar
    Join Date
    Aug 2000
    Location
    Steve Job's Doorstep
    Posts
    695
    great idea, but no dice

    I think there's something about classes that I'm just not getting. it seems like it should be simple enough. I usually use _root.varName and that works. I also tried _global.varName and it still didn't work!

  4. #4
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    If your trying to avoid using _root then try

    var home:MovieClip = this
    varReceiver = new LoadVars();
    varReceiver.load("http://www.somedomain.com/mp3/songs.php");
    varReceiver.onLoad = function() {
    home.songs = this.fileList.split("|");
    home.titles = this.titleList.split("|");
    home.artists = this.artistList.split("|");
    }

    trace(home.songs[0]);

    If the trace works the variables should be out. Hope that helps!?
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center