Solved

Flash global variable

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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…

734 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