?
Solved

about how flash works

Posted on 2003-11-02
3
Medium Priority
?
227 Views
Last Modified: 2010-04-03
hi, guys:

i am working on a pretty huge flash program, abd are having some problem with functions.
e.g.
function trace_projectile(x){
_root.a=0;
_root.a+=x;
... ... ... //many lines
trace(_root.a);
}

say if i use it several times, could it be, that there maybe some conflict in _root.a.
i mean, that the time i trace _root.a, the same function somewhere else just
set it back to 0 or so.

are functions in flash used one after another, or could they be used parallel???
if the later, i am afraid i must change the function using different variables. :(
0
Comment
Question by:Knightley
[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
3 Comments
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 9666760
Because _root.a is defined within the function. Everything Function repeat's itself it sets your _root.a value back to 0.
You need to define the Initial Value of _root.a outside of your function like this.
_root.a=0;
function trace_projectile(x){
_root.a+=x;
... ... ... //many lines
trace(_root.a);
}
This way function will Grab Variable "a" Value once, outside of your function.
0
 
LVL 1

Author Comment

by:Knightley
ID: 9668270
i do want to the a set back to 0 every time i call the function.
i mean if i use the function twice,

do they run one after another or parallel?
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 80 total points
ID: 9668610
Code Runs , Line by Line, One after another.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…

771 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