A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 34

Thread: action script "slowing down"

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    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

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    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.

  3. #3
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    you had an endless loop in your code. this causes the error message you wrote.
    visit my homepage -> ejected.de

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    ok well, i havent gotten arround to fixing it but i will hopefully soon.

    thanks

  5. #5
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    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

  6. #6
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    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:
    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].400+random(80);
        
    alien[i].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.
    visit my homepage -> ejected.de

  7. #7
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    yea i dont really understand it, but im still trying..........
    ummmmmmmmmmmmmm well thanks

  8. #8
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    better is this:

    PHP Code:
    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].400+random(80);
        
    alien[num].60+random(330);


    then you easily can add an alien later with calling the function add_alien.
    visit my homepage -> ejected.de

  9. #9
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    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

  10. #10
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    Originally posted by sonic04
    yea i dont really understand it, but im still trying..........
    ummmmmmmmmmmmmm well thanks
    no problem. everyone has started sometimes...
    visit my homepage -> ejected.de

  11. #11
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    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
    visit my homepage -> ejected.de

  12. #12
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    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)
    visit my homepage -> ejected.de

  13. #13
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    4am in germany now. going to bed.... can help you tomorow...

    visit my homepage -> ejected.de

  14. #14
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    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

  15. #15
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    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.
    visit my homepage -> ejected.de

  16. #16
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    just curious

    just curious, but what grade are u in, are u in high school/college/middle school?

  17. #17
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    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.
    visit my homepage -> ejected.de

  18. #18
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    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...

  19. #19
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    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

  20. #20
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center