I am writing a screen application which loads in text from an XML file into an object called languagedata. I am writing an app which will have multiple languages. On the presentation screen the first thing that happens is that the XML is loaded and the variables put into my languagedata object. I then reference this object in my first screen to populate textboxes etc. This works fine. When I have a second slide referencing this global variable results in an error. Debug says it is there. I thought I just needed to reference languagedata.property to get my values. It works on the first screen but not on the second one. Any ideas? Steve
I am a little confused. You are putting variables into an object but then talk about a global variable. What is global - the variable or the object? What does 'results in an error' mean? Screens are all movie clips that are all instantiated at the same time. 'Moving' from one screen to another does not update anything because all you are doing is changing the screen's visibility property and nothing else. When you load anything into an object on one screen, all the other screens are already instantiated and their content is set. So when you say, 'the first thing that happens', you are incorrect. It is not the first thing that happens. If you do anything on one screen and reference that in another screen, nothing will happen unless that other screen is 'refreshed' somehow. The screen could have multiple frames in the timeline so that it loops, could use a listener, setInterval function, onEnterFrame, etc. but you need some way for the screen to be updated. You need to stop thinking of screens the way you would think of a timeline. I just made a simple test where I created a global object and placed multiple variables in it ( variables were not declared global) and I could use them with no problem on multiple screens but, to populate text boxes on those screens, I had to use some type of event to update each screen.
Don't see what you're looking for? Try a search.
|