dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Is there a way to make this script shorter & easier? --- My fingers start to hurt !

  1. #1
    Member
    Join Date
    Oct 2000
    Posts
    32

    Exclamation

    Here's the script:

    a = a+5;
    setProperty ("1", _alpha, 0+a);
    setProperty ("2", _visible, 0);
    setProperty ("3", _visible, 0);
    setProperty ("4", _visible, 0);
    setProperty ("5", _visible, 0);
    setProperty ("6", _visible, 0);
    setProperty ("7", _visible, 0);
    setProperty ("8", _visible, 0);
    setProperty ("9", _visible, 0);
    setProperty ("10", _visible, 0);
    setProperty ("11", _visible, 0);
    setProperty ("12", _visible, 0);
    setProperty ("13", _visible, 0);
    setProperty ("14", _visible, 0);
    setProperty ("15", _visible, 0);
    setProperty ("16", _visible, 0);
    setProperty ("17", _visible, 0);
    setProperty ("18", _visible, 0);
    setProperty ("19", _visible, 0);
    setProperty ("20", _visible, 0);
    setProperty ("21", _visible, 0);
    setProperty ("22", _visible, 0);
    setProperty ("23", _visible, 0);
    setProperty ("24", _visible, 0);
    setProperty ("25", _visible, 0);
    setProperty ("26", _visible, 0);

    if (a>=10) {
    b = b+5;
    setProperty ("2", _alpha, 0+b);
    setProperty ("2", _visible, "1");
    }
    if (b>=10) {
    c = c+5;
    setProperty ("3", _alpha, 0+c);
    setProperty ("3", _visible, "1");
    }
    if (c>=10) {
    d = d+5;
    setProperty ("4", _alpha, 0+d);
    setProperty ("4", _visible, "1");
    }
    if (d>=10) {
    e = e+5;
    setProperty ("5", _alpha, 0+e);
    setProperty ("5", _visible, "1");
    }
    if (e>=10) {
    f = f+5;
    setProperty ("6", _alpha, 0+f);
    setProperty ("6", _visible, "1");
    }
    if (f>=10) {
    g = g+5;
    setProperty ("7", _alpha, 0+g);
    setProperty ("7", _visible, "1");
    }
    if (g>=10) {
    h = h+5;
    setProperty ("8", _alpha, 0+h);
    setProperty ("8", _visible, "1");
    }
    if (h>=10) {
    i = i+5;
    setProperty ("9", _alpha, 0+i);
    setProperty ("9", _visible, "1");
    }
    if (i>=10) {
    j = j+5;
    setProperty ("10", _alpha, 0+j);
    setProperty ("10", _visible, "1");
    }
    if (j>=10) {
    k = k+5;
    setProperty ("11", _alpha, 0+k);
    setProperty ("11", _visible, "1");
    }
    if (k>=10) {
    l = l+5;
    setProperty ("12", _alpha, 0+l);
    setProperty ("12", _visible, "1");
    }
    if (l>=10) {
    m = m+5;
    setProperty ("13", _alpha, 0+m);
    setProperty ("13", _visible, "1");
    }
    if (m>=10) {
    n = n+5;
    setProperty ("14", _alpha, 0+n);
    setProperty ("14", _visible, "1");
    }
    if (n>=10) {
    oo = oo+5;
    setProperty ("15", _alpha, 0+oo);
    setProperty ("15", _visible, "1");
    }
    if (oo>=10) {
    p = p+5;
    setProperty ("16", _alpha, 0+p);
    setProperty ("16", _visible, "1");
    }
    if (p>=10) {
    q = q+5;
    setProperty ("17", _alpha, 0+q);
    setProperty ("17", _visible, "1");
    }
    if (q>=10) {
    r = r+5;
    setProperty ("18", _alpha, 0+r);
    setProperty ("18", _visible, "1");
    }
    if (r>=10) {
    s = s+5;
    setProperty ("19", _alpha, 0+s);
    setProperty ("19", _visible, "1");
    }
    if (s>=10) {
    t = t+5;
    setProperty ("20", _alpha, 0+t);
    setProperty ("20", _visible, "1");
    }
    if (t>=10) {
    u = u+5;
    setProperty ("21", _alpha, 0+u);
    setProperty ("21", _visible, "1");
    }
    if (u>=10) {
    v = v+5;
    setProperty ("22", _alpha, 0+v);
    setProperty ("22", _visible, "1");
    }
    if (v>=10) {
    w = w+5;
    setProperty ("23", _alpha, 0+w);
    setProperty ("23", _visible, "1");
    }
    if (w>=10) {
    x = x+5;
    setProperty ("24", _alpha, 0+x);
    setProperty ("24", _visible, "1");
    }
    if (x>=10) {
    y = y+5;
    setProperty ("25", _alpha, 0+y);
    setProperty ("25", _visible, "1");
    }

    if (y>=100) {
    stop ();
    }

    on the first frame there are 25 MC's and the actions u see above, the second frame has the action gotoAndPlay frame 1

  2. #2
    Senior Member
    Join Date
    Oct 2000
    Posts
    122

    Unhappy

    It will help if you tell us what you are trying to do, then we could help out

  3. #3
    Member
    Join Date
    Oct 2000
    Posts
    32
    Ok I should have been more specific

    Here it is:

    I have a picture cut into 25 pieces, they are all MC's with number 1 to 25, they are all in frame 1 and so are the actions as seen in the post above, frame 2 is empty and only has the action to goandplay frame 1

    So what it does is this:

    Mc named 1 starts setting alpha with an increase of +5
    when it is >= 10 Mc named 2 will start and so on until the picture is totaly visible

    It's all working fine but as u can see the script is very long

    Hope u understand it, otherwise let me know

    Thanx

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Location
    highlands, scotland
    Posts
    223

    heres the first bit that covers setting the visibility of the Mc's from 1 to 26 hopefully, hope this helps in the meantime.

    a = a+5;
    // ok sets the mc "1" to visibility o+a
    setProperty (1, _visible, 0 + a);
    // ok make a loop that makes the visibility of the MC's 2 to 26 to 0 then exit the loop
    for (counter =2; counter < 27; counter ++) {
    setProperty (counter, _visible, 0);
    }


    cheers,
    DaZ

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