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
Solved

Flash global variable

Posted on 2011-03-05
4
270 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft WSUS 4 103
need a player that can play .d and .i DVR files 9 1,558
Embedded Video Download (Flash) 3 1,162
Flash player 17 install script .bat or .vbs 9 559
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

840 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