-
action script "slowing down"
when i try to see my movie in my browser it says due to some actionscript flash player 7 will slow down.
i think i got my code wrong so im working on changing it, but if anywone knows if this is a different problem, let me know.
thanks
-
i fixed it
i found the bad script and took it out, i guess ill just work on putting it back in, i must have done something wrong last time.
-
Senior Member
you had an endless loop in your code. this causes the error message you wrote.
-
ok well, i havent gotten arround to fixing it but i will hopefully soon.
thanks
-
y
why cant this script not work? i made a script for a new movie element called "allien" its basically an allien in a ship spinning around being wacky.
anyways, heres my clone code thats causing a slowdown so something isnt "connected" through the code.
// place the allien element into variable
allien = element ("allien")
//clone allien movie
allien = new Array(num_allien);
for (i=0;i<num_allien;i++) {
allien[i].createMovie();
allien[i] = a.clone();
//position somewhere randomly on screen
allien[i].x = 400+random(80);
allien[i].y = 60+random(330);
}
in my other script i have this which is somewhat connected to the script above:
function add_allien() {
// add new allien
allien[num_allien].createMovie();
allien[num_allien] = a.clone();
//position somewhere randomly on screen
allien[num_allien].x = 400+random(80);
allien[num_allien].y = 60+random(330);
does anyone see a problem in this?
thanks
-
Senior Member
is this a joke
the errors I found on first read of code:
1. allien is not correct, it's called alien
2. the following code use the variable allien twice!!!
PHP Code:
allien = element ("allien")
//clone allien movie
allien = new Array(num_allien);
3. the follwing code don't work because variable a is not set
PHP Code:
allien[i] = a.clone();
fix it like this:
PHP Code:
a = element ("alien"); //store the alien element in a variable for easy access
num_alien=10; //set the number of aliens maximal showing on screen
//clone alien movie
alien = new Array(num_alien); //define an array which stores all cloned alien movies
for (i=0;i<num_alien;i++) { // clone num_alien times the alien movie
alien[i].createMovie(); //create an empty movie in array
alien[i] = a.clone(); //clone the element "alien" stored in variable a before
//position the alien somewhere randomly on screen
alien[i].x = 400+random(80);
alien[i].y = 60+random(330);
}
and 4th I think that you call the function add_allien() in a loop. the movie don't stops to call this function. do you know what I'm talking about?
you should try to understand what you are doing there. you only copied the code I gave you. thats no problem, but I assume that you don't understand it really.
Last edited by lopez1_de; 02-17-2005 at 10:58 PM.
-
yea i dont really understand it, but im still trying..........
ummmmmmmmmmmmmm well thanks
-
Senior Member
better is this:
PHP Code:
a = element ("alien"); //store the alien element in a variable for easy access
num_alien=10; //set the number of aliens maximal showing on screen
//clone alien movie
alien = new Array(num_alien); //define an array which stores all cloned alien movies
for (i=0;i<num_alien;i++) { // clone num_alien times the alien movie
add_alien(i);
}
function add_alien(num) {
alien[num].createMovie(); //create an empty movie in array
alien[num] = a.clone(); //clone the element "alien" stored in variable a before
//position the alien somewhere randomly on screen
alien[num].x = 400+random(80);
alien[num].y = 60+random(330);
}
then you easily can add an alien later with calling the function add_alien.
-
ok thanks a lot, but your right i dont understand much of the code, but i am new to the software, and im sure youve been using flash a long time, i can tell... Everyone starts somewhere
-
Senior Member
Originally posted by sonic04
yea i dont really understand it, but im still trying..........
ummmmmmmmmmmmmm well thanks
no problem. everyone has started sometimes...
-
Senior Member
Originally posted by sonic04
ok thanks a lot, but your right i dont understand much of the code, but i am new to the software, and im sure youve been using flash a long time, i can tell... Everyone starts somewhere
LOL you was faster
-
Senior Member
don't forget that you have fixed the array to a size of num_aliens=20.
that means that you can only fill the array alien with maximum 20 clones. you can init the array with NO limit like this to:
alien = new Array();
and don't forget to increase the variable of num_aliens like
num_aliens++;
...if you want to add an alien with the function add_alien(num_aliens)
-
Senior Member
4am in germany now. going to bed.... can help you tomorow...
-
lol u stay up a lot on 3dfa, but i havent had much time to work on my game becuase ive got a ton of school work for the weekend, but ill let you know on my progress i guess.
thanks
-
Senior Member
normaly I have not much time too. But in the moment I'm ill at home. Monday I must go to work again (thanks god no school anymore).
I'm answering fast, because I get an email notice for every reply.
-
just curious
just curious, but what grade are u in, are u in high school/college/middle school?
-
Senior Member
don't exactly know how to compare your school levels with ours. I was going 10 years to school. made a training for 3,5 years as IT-communication technic. and working for 7 years as IT specialist. And I'm programming a lot, but most for hobby purpose.
-
yea, germany is way different than the u.s, i should have figured.
So what type of job are you training to become?
Like are you going to try to program games, websites, databases, or like you said just do that as your hobby?
Im just curious...
-
sweet
sweet, well i finally got around to fixing it, but now theres a few problems with collision but i got a bunch of aliens and asteroids on my screen just like i wanted.
once i fix up my collision codes, everything should be working fine.
thanks
-
collision
this is odd, at first when i just had asteroids, you could hit any asteroid with your gun and they would hide. Now that i added more clones (alliens), i can only hit one asteroid at a time for only one of the 5 i have can be hit. once that one is hit a different one can be hit. Same with the ship. It seems at all times there is only one actually "active" asteroid. Its hard to explain...
but i think by adding more clones the collision got screwed up.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|