Solved

Flash global variable

Posted on 2011-03-05
4
273 Views
Last Modified: 2012-05-11
Hi i want to use a global variable in action script 3. How i can do it. Can any one help me. I need some example because i just begin to study it.
0
Comment
Question by:umaxim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 37

Expert Comment

by:CyanBlue
ID: 35046834
Please take a look at these blog posts for the solution...  It's not really recommended to use a global variable in AS3 but nobody is stopping you for using it...
   http://www.uza.lt/codex/as3-global-object/
   http://mtrinitaria.com/mykhel/global-variables-as3/

CyanBlue
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35051415
If you are using timeline script use root.variableName to access it.

Otherwise the suggestion which CyanBlue provided of singleton class is a good way to do so.

Warm Regards
Deepanjan Das
0
 
LVL 1

Author Comment

by:umaxim
ID: 35061978
I use a script and make a look when for example i click contact it begin loop again and in animation clip i put code take number from variable and stop on number frame. This why i need to get root variable on 1 level down.
0
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 35063778
SO it depends:
You may use root.variableName
or parent.variableName. But REMEMBER to declare the variableName is proper place.

Share your fla to suggest specifically.

Warm Regards
Deepanjan Das
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question