A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: action script not working

  1. #1
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713

    action script not working

    This script I cannot make work in the actions and sounds overview.

    objects = 35;
    loop = 1;
    while(loop <= objects){
    duplicateMovieClip("bar","bar"add loop,loop);
    loop = loop + 1;
    }

    duplicateMovieClip("txt","txt1000",1000000);

    stop();

    the error is:
    line 4 expecting a , or a )

    The clip works but will not replicate itself.
    Any programming language is at its best before it is implemented and used.

  2. #2
    Senior Member FLASHPULSE's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    1,356
    I'm not good at action script but I didn't get any errors with this change. NOT TESTED

    objects = 35;
    loop = 1;
    while(loop <= objects){
    duplicateMovieClip("bar","bar"+ loop,loop);
    loop = loop + 1;
    }

    duplicateMovieClip("txt","txt1000",1000000);

    stop();

  3. #3
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    I am using version koolmoves 4.0 so that may be the difference. I originaly used the code for flask mx and was trying to get it to work in koolmoves. Thank you

    the original code was in the time line and the following was in a mc. The idea is that a clip could be randomized 35 times to give a background effect. Each clip would have a different size. I got the code from www.kirupa.com's site. I did figure another way around.

    (I should have given this in the beginning)
    the code that was in the movie clip was

    onClipEvent(load){
    _x = Math.random()*800;
    speed = Math.random()*5 + 1;
    _y = Math.random()*600 - (_height/2);
    _xscale = Math.random()*400;
    _yscale = Math.random()*400;
    _alpha = Math.random()*30+10;
    }
    onClipEvent(enterFrame){
    _x += speed;
    if(_x >= 800){
    _xscale = Math.random()*150;
    _yscale = Math.random()*150;
    speed = Math.random()*5 + 1;
    _y = Math.random()*600 - (_height/2);
    _x = _width*-1;
    _alpha = Math.random()*30+10;
    }
    }



    Any programming language is at its best before it is implemented and used.

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Posts
    3,512
    Don't use add in line 4. Use +.

  5. #5
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Hello tim.
    For future,try to use this syntax:

    for(l=1;l<35;l++){
    bar.duplicateMovieClip("bar"+l,l);
    }

    cheers

  6. #6
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Originally posted by necromanthus
    Hello tim.
    For future,try to use this syntax:

    for(l=1;l<35;l++){
    bar.duplicateMovieClip("bar"+l,l);
    }

    cheers
    Thank you, this was the trick. I have been unable to do this for a couple of month's. I just do not get scripting. Mabey I could buy actioon script for dummies. (I did not have a problem with fortran or java or c++.)

    The effect I wanted was here. (It is video card intensive)

    http://www.diversioncentral.com/template/floaters.html

    Thank you everyone
    Any programming language is at its best before it is implemented and used.

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Honestly you should start off with Javascrot for dummies and then move onto the book "Actionscript the definitive guide".

    Flash 5+ actionscript model is based on Ecma 262 (JavaScript), however the Flash 4 scripting language resembles Agol (Pascal, Oberion, ect) family languages. What most AS books do not tell you is that in Flash 5 and higher both syntax models are allowed in Flash(At the same time no less). Most third party tools that allow scripting, like KoolMoves /LM2 /3DFA / Nione Imperator (I have not seen SWiSH Max so can't comment on that one), only implement the Flash 5+ model though. KoolMoves specifically will reject the Flash 4 syntax. Becuase both syntax models can be used interchangably in Flash's Actionscript it causes great confusion among would be developers especially if they are are sane and have prior expierince with progaming.

    If you learn ECMA 262 first then you won't be tempted to use the naughty depreciated FLash 4 Syntax and likewise will be able to spot it.

  8. #8
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Originally posted by johnie
    ...(I have not seen SWiSH Max so can't comment on that one)...
    Someone told me that SwishMax use a "pseudo" v6 ActionScript.
    Few examples: onEnterFrame() , onLoad() , etc
    A possible (future) competition between KoolMoves and SwishMax ?
    Probably ...
    But imagine KoolMoves v5.0 with a symbol-library capability !

  9. #9
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Originally posted by johnie
    Honestly you should start off with Javascrot for dummies and then move onto the book "Actionscript the definitive guide".

    Actually on Sunday i ordered "flash mx for dummies" from amazon.com

    I do have the definitive guide but I did not stick to it.
    I also remember you suggesting this some time ago. Thanks
    Any programming language is at its best before it is implemented and used.

  10. #10
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Originally posted by necromanthus
    Someone told me that SwishMax use a "pseudo" v6 ActionScript.
    Few examples: onEnterFrame() , onLoad() , etc
    A possible (future) competition between KoolMoves and SwishMax ?
    Probably ...
    But imagine KoolMoves v5.0 with a symbol-library capability !
    So they copied the LM2 model. Adobe took the 5/6 AS model and further standardized it on ECMA (262) by doing the same thing. They have onmouseover(), onload(), ect.

  11. #11
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Originally posted by johnie
    So they copied the LM2 model. Adobe took the 5/6 AS model and further standardized it on ECMA (262) by doing the same thing. They have onmouseover(), onload(), ect.
    That's right.
    Also,another intresting part is that all V6 commands are available (if my "source" is the right one),but the internal player is Flash V5 (!?!).


  12. #12
    SWiSHer extraordinaire
    Join Date
    Dec 2000
    Location
    Australia
    Posts
    3,900
    FYI: just to clear up a little:

    SWiSHmax scripting is not a copy of either LiveMotion or Flash directly.

    It has on(press,release) {..} etc like Flash
    It has onEnterFrame() {...} like LM
    If has some of its own things onFrame(..) {..}, onSelfEvent(press) etc

    The internal player is mostly Flash 4 (with some support for things like Key, Date, Array etc) and with emulation of math functions etc when exporting to Flash 4. But if you export to Flash 5/6 and play in Flash Player 5/6/7, then you can get at the methods available with that player (eg you can do code that wors with XML, say).

    (hope you don't mind me posting here )
    Last edited by roger_onslow; 09-01-2003 at 08:46 AM.
    Roger Onslow - SWiSHmax: its here!

  13. #13
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Originally posted by roger_onslow
    hope you don't mind me posting here
    Not at all.
    roger,send my best wishes to David M and Hugh B.
    You all are invited to become KoolMoves fans.
    cheers

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