Skip to main content
Known Participant
July 7, 2010
Question

Trying to access numerical variable on the stage from a swf file in UILoader

  • July 7, 2010
  • 1 reply
  • 1016 views

I have a program that plays swf files in the UILoader. The program counts the number of customers that use the program by adding 1 to a variable called customerCount each time a button is pressed. I am trying to design one of the swf files so that it can access and diaplay the accumulated value of customerCount. Can someone help me to find the actionscript code that will let me display the value of customerCount in the swf file. Thanks.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 8, 2010

you can easily count how many times a button is pressed (in any one session) but what's that have to do with the number of customers that open your swf?

Known Participant
July 8, 2010

I have a program that runs continuously. Customers click a button to get what they are wanting. Each time a customer clicks a button the customerCount variable is increased by one. Periodically, it is desired to access the numerical value of customerCount by playing a swf file in a UILoader window. My problem is to find the actionscript 3 that I can use in the swf file to read out the value of customerCount in a textfield. I think I need to use code that includes the "stage" but I am really not sure how to do that. Any help on this topic would be much appreciated.

kglad
Community Expert
Community Expert
July 8, 2010

i'm not sure what you mean by say your program runs continuously and i still suspect you're missing something but your loaded swf to access the loading swf's main timeline from its own main timeline by using:

this.parent.parent.

if the variable you want to access is mainswfCustomerCount, you would use:


MovieClip(this.parent.parent).mainswfCustomerCount

if you want to access a textfield (eg, mainswfCustomerCountTF) that exists when the loaded swf tries to access it, you would use:

MovieClip(this.parent.parent).mainswfCustomerCountTF.text