Solved

about how flash works

Posted on 2003-11-02
3
181 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
  • 2
3 Comments
 
LVL 23

Expert Comment

by:adilkhan
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:
adilkhan earned 20 total points
ID: 9668610
Code Runs , Line by Line, One after another.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 what frame rate is, how to control it and what effect it has on the video.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now