Solved

Flash global variable

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

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

Suggested Solutions

Title # Comments Views Activity
SWF won't scale? 4 530
Can't find all of the preferences on Flash Pro 2 494
Adobe Flash Player ActionScript error 6 69
I'm running a risk by using Adobe Flash in my site ? 9 123
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. …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

680 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