Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:07:39+00:00 2026-05-11T05:07:39+00:00

I’m doing some work in Actionscript 2.0 for the first time in a while

  • 0

I’m doing some work in Actionscript 2.0 for the first time in a while (really simple stuff, just pulling content from a text file), and I can not fathom for the life of me why I’m getting such unpredictable output here.

Sometimes when I test build a simple script like this, variables are listed as undefined, and sometimes they aren’t.

I’d assume that this might be because the data loaded in from cookware.txt wasn’t loaded into the memory yet, but this doesn’t seem to be the case – according to the Actionscript dictionary here, the onLoad function only fires when data has been loaded as is accessible to the rest of the program.

Can anyone shed some light? Or see why this could be happening?

Contents of cookware.txt:

pots=44&kettles=43 

Code

_global.pots; _global.kettles;  trace('variables not assigned') trace('before: kettles (global) = ' + _global.kettles);  trace('before: pots (global) = ' + _global.pots);  var my_lv:LoadVars = new LoadVars();  my_lv.onLoad = function(success:Boolean):Void {     if (success) {          trace('variables clearly loaded: kettles = ' + kettles);           _global.kettles = this.kettles;          trace('assigned during loop: kettles in = ' + _global.kettles);            trace('pots = ' + kettles);          _global.pots = this.pots;          trace('during: pots = ' + _global.pots);       } else {         trace('Error');     } }   my_lv.load('cookware.txt');  trace('after: kettles (global) = ' + _global.kettles);  trace('after: pots (global) = ' + _global.pots); 

Output::

Sometimes it’s this:

variables not assigned before: kettles (global) = undefined before: pots (global) = undefined after: kettles (global) = undefined after: pots (global) = undefined variables clearly loaded: kettles = undefined assigned during loop: kettles in = 43 pots = 43 during: pots = 43 

and sometimes it’s this:

variables not assigned before: kettles (global) = 43 before: pots (global) = 44 after: kettles (global) = 43 after: pots (global) = 44 variables clearly loaded: kettles = 43 assigned during loop: kettles in = 43 pots = 43 during: pots = 43 

Again, whether variables are undefined or not seems totally random. What is going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:07:39+00:00Added an answer on May 11, 2026 at 5:07 am

    Thanks for the help guys – I didn’t click before that LoadVars() was an asynchronous function, and that the rest of the script would continue without checking if it was loaded.

    I managed to fix this by checking it loadVar has completed on each frame, then executing the code after the loadVar was completed.

    I had compiling the swf for testing (command + return).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am doing a simple coin flipping experiment for class that involves flipping a
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.