Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Simplify This Code


I am wondering how I would simplify this code.

Code:
/////////////////////////////
container_mc.createEmptyMovieClip("bg_mc", 0);
container_mc.createEmptyMovieClip("widget1_mc", 1);
container_mc.createEmptyMovieClip("widget2_mc", 2);
container_mc.createEmptyMovieClip("widget3_mc", 3);
container_mc.createEmptyMovieClip("MainLogo_mc", 4);
container_mc.createEmptyMovieClip("MainMessage_mc", 5);
/////////////////////////////
container_mc.widget1_mc._x = -10;
container_mc.widget1_mc._y = 250;
container_mc.widget2_mc._x = 275;
container_mc.widget2_mc._y = 225;
container_mc.widget3_mc._x = 445;
container_mc.widget3_mc._y = 250;
container_mc.MainMessage_mc._x = 410;
container_mc.MainMessage_mc._y = 23;
container_mc.MainLogo_mc._x = 530;
container_mc.MainLogo_mc._y = 105;
//////////////////////////////
loadMovie("images/bg.jpg", "container_mc.bg_mc");
loadMovie("images/widget1.swf", "container_mc.widget1_mc");
loadMovie("images/widget2.swf", "container_mc.widget2_mc");
loadMovie("images/widget3.swf", "container_mc.widget3_mc");
loadMovie("images/MainLogo.swf", "container_mc.MainLogo_mc");
loadMovie("images/MainMessage.swf", "container_mc.MainMessage_mc");




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 01-31-2007, 03:39 AM


View Complete Forum Thread with Replies

Sponsored Links:

Help Me Simplify This Code Please.
This "little" script I wrote works but its way too damn big.

Note below how I need to make _root.cd1 = all 150 items added together. thanks for your help guys.



_root.cd1 = _root.item1am+_root.item2am+_root.item3am+_root.it em4am+_root.item5am+_root.item6am+_root.item7am+_r oot.item8am+_root.item9am+_root.item10am+_root.ite m11am+_root.item12am+_root.item13am+_root.item14am +_root.item15am+_root.item16am+_root.item17am+_roo t.item18am+_root.item19am+_root.item20am+_root.ite m21am+_root.item22am+_root.item23am+_root.item24am +_root.item25am+_root.item26am+_root.item27am+_roo t.item28am+_root.item29am+_root.item30am+_root.ite m31am+_root.item32am+_root.item33am+_root.item34am +_root.item35am+_root.item36am+_root.item37am+_roo t.item38am+_root.item39am+_root.item40am+_root.ite m41am+_root.item42am+_root.item43am+_root.item44am +_root.item45am+_root.item46am+_root.item47am+_roo t.item48am+_root.item49am+_root.item50am+_root.ite m51am+_root.item52am+_root.item53am+_root.item54am +_root.item55am+_root.item56am+_root.item57am+_roo t.item58am+_root.item59am+_root.item60am+_root.ite m61am+_root.item62am+_root.item63am+_root.item64am +_root.item65am+_root.item66am+_root.item67am+_roo t.item68am+_root.item69am+_root.item70am+_root.ite m71am+_root.item72am+_root.item73am+_root.item74am +_root.item75am+_root.item76am+_root.item77am+_roo t.item78am+_root.item79am+_root.item80am+_root.ite m81am+_root.item82am+_root.item83am+_root.item84am +_root.item85am+_root.item86am+_root.item87am+_roo t.item88am+_root.item89am+_root.item90am+_root.ite m91am+_root.item92am+_root.item93am+_root.item94am +_root.item95am+_root.item96am+_root.item97am+_roo t.item98am+_root.item99am+_root.item100am+_root.it em101am+_root.item102am+_root.item103am+_root.item 104am+_root.item105am+_root.item106am+_root.item10 7am+_root.item108am+_root.item109am+_root.item110a m+_root.item111am+_root.item112am+_root.item113am+ _root.item114am+_root.item115am+_root.item116am+_r oot.item117am+_root.item118am+_root.item119am+_roo t.item120am+_root.item121am+_root.item122am+_root. item123am+_root.item124am+_root.item125am+_root.it em126am+_root.item127am+_root.item128am+_root.item 129am+_root.item130am+_root.item131am+_root.item13 2am+_root.item133am+_root.item134am+_root.item135a m+_root.item136am+_root.item137am+_root.item138am+ _root.item139am+_root.item140am+_root.item141am+_r oot.item142am+_root.item143am+_root.item144am+_roo t.item145am+_root.item146am+_root.item147am+_root. item148am+_root.item149am+_root.item150am;

View Replies !    View Related
Simplify This Code Please
PHP Code:




stop();
baseRate = 9;
scalex = 100;
scaley = 100;
scalex2 = 100;
scaley2 = 100;
scalex3 = 100;
scaley3 = 100;
scalex4 = 100;
scaley4 = 100;
targetx = 25;
targety = 100;
targetx2 = 130;
targety2 = 100;
targetx3 = 235;
targety3 = 100;
targetx4 = 340;
targety4 = 100;
panel.onEnterFrame = function() {
    difference = _root.scalex-_root.panel._xscale;
    rate = difference/baseRate;
    _root.panel._xscale += rate;
    difference2 = _root.scaley-_root.panel._yscale;
    rate2 = difference2/baseRate;
    _root.panel._yscale += rate2;
    difference3 = _root.scalex2-_root.panel2._xscale;
    rate3 = difference3/baseRate;
    _root.panel2._xscale += rate3;
    difference4 = _root.scaley2-_root.panel2._yscale;
    rate4 = difference4/baseRate;
    _root.panel2._yscale += rate4;
    difference5 = _root.scalex3-_root.panel3._xscale;
    rate5 = difference5/baseRate;
    _root.panel3._xscale += rate5;
    difference6 = _root.scaley3-_root.panel3._yscale;
    rate6 = difference6/baseRate;
    _root.panel3._yscale += rate6;
    difference7 = _root.scalex4-_root.panel4._xscale;
    rate7 = difference7/baseRate;
    _root.panel4._xscale += rate7;
    difference8 = _root.scaley4-_root.panel4._yscale;
    rate8 = difference8/baseRate;
    _root.panel4._yscale += rate8;
    difference9 = _root.targetx-_root.panel._x;
    rate9 = difference9/baseRate;
    _root.panel._x += rate9;
    difference10 = _root.targety-_root.panel._y;
    rate10 = difference10/baseRate;
    _root.panel._y += rate10;
    difference11 = _root.targetx2-_root.panel2._x;
    rate11 = difference11/baseRate;
    _root.panel2._x += rate11;
    difference12 = _root.targety2-_root.panel2._y;
    rate12 = difference12/baseRate;
    _root.panel2._y += rate12;
    difference13 = _root.targetx3-_root.panel3._x;
    rate13 = difference13/baseRate;
    _root.panel3._x += rate13;
    difference14 = _root.targety3-_root.panel3._y;
    rate14 = difference14/baseRate;
    _root.panel3._y += rate14;
    difference15 = _root.targetx4-_root.panel4._x;
    rate15 = difference15/baseRate;
    _root.panel4._x += rate15;
    difference16 = _root.targety4-_root.panel4._y;
    rate16 = difference16/baseRate;
    _root.panel4._y += rate16;
};
button1_btn.onRelease = function() {
    scalex = 200;
    scaley = 400;
    scalex2 = 100;
    scaley2 = 100;
    scalex3 = 100;
    scaley3 = 100;
    scalex4 = 100;
    scaley4 = 100;
    targetx = 25;
    targety = 100;
    targetx2 = 230;
    targety2 = 100;
    targetx3 = 335;
    targety3 = 100;
    targetx4 = 440;
    targety4 = 100;
};
button2_btn.onRelease = function() {
    scalex = 100;
    scaley = 100;
    scalex2 = 200;
    scaley2 = 200;
    scalex3 = 100;
    scaley3 = 100;
    scalex4 = 100;
    scaley4 = 100;
    targetx = 25;
    targety = 100;
    targetx2 = 130;
    targety2 = 100;
    targetx3 = 335;
    targety3 = 100;
    targetx4 = 440;
    targety4 = 100;
};
button3_btn.onRelease = function() {
    scalex = 100;
    scaley = 100;
    scalex2 = 100;
    scaley2 = 100;
    scalex3 = 200;
    scaley3 = 200;
    scalex4 = 100;
    scaley4 = 100;
    targetx = 25;
    targety = 100;
    targetx2 = 130;
    targety2 = 100;
    targetx3 = 235;
    targety3 = 100;
    targetx4 = 440;
    targety4 = 100;
};
button4_btn.onRelease = function() {
    scalex = 100;
    scaley = 100;
    scalex2 = 100;
    scaley2 = 100;
    scalex3 = 100;
    scaley3 = 100;
    scalex4 = 200;
    scaley4 = 200;
    targetx = 25;
    targety = 100;
    targetx2 = 130;
    targety2 = 100;
    targetx3 = 235;
    targety3 = 100;
    targetx4 = 340;
    targety4 = 100;
};








this is the way I coded it this morning..
now there must be a way to write is in fewer lines of AS
but I don't have the skills to do it myself.

anybody likes to help me out...

basicly what it does is this :

http://theremedy.be/scrap/scale_bg.swf

tnx

View Replies !    View Related
[as1] [MX] To Simplify A Code
I need some help with simplifying part of the code below, I would do like to simplify the part that is changing the _alpha of all the boxes. Thanks for any help.

code:
on (press) {
_root.mbox._visible = 0;
_root.box._visible = 1;
_root.mbox.xtarget = (_x, 1);
_root.mbox.ytarget = (_y, 190);
_root.box.sq._alpha = 30;
_root.box._alpha = 100;
_root.box1.sq1._alpha = 100;
_root.box1._alpha = 40;
_root.box2.sq2._alpha = 100;
_root.box2._alpha = 40;
_root.box3.sq3._alpha = 100;
_root.box3._alpha = 40;
_root.box4.sq4._alpha = 100;
_root.box4._alpha = 40;
_root.box5.sq5._alpha = 100;
_root.box5._alpha = 40;
_root.box6.sq6._alpha = 100;
_root.box6._alpha = 40;
_root.box.swapDepths (2);
with (_root.box1 && _root.box2 && _root.box3 && _root.box4 && _root.box5 && _root.box6) {
}
}

View Replies !    View Related
Simplify This Code?
I have this massive chunk of code that works perfectly, but well... its massive

Anyone know how to put this into an array or something? I have tried with no luck.
(Also the values need to update constantly)
Thanks.


Code:
if(_root.store.basket.item1.qty==0){
_root.store.line1=""
}
else if(_root.store.basket.item1.qty !=0){
_root.store.line1=_root.store.basket.item1.qty+", "+_root.store.basket.item1.desc+" for "+_root.store.basket.item1.displayprice+" plus "+_root.store.basket.item1.displayship+" Shipping. " + newline
}
if(_root.store.basket.item2.qty==0){
_root.store.line2=""
}
else if(_root.store.basket.item2.qty !=0){
_root.store.line2=_root.store.basket.item2.qty+", "+_root.store.basket.item2.desc+" for "+_root.store.basket.item2.displayprice+" plus "+_root.store.basket.item2.displayship+" Shipping. " + newline
}
if(_root.store.basket.item3.qty==0){
_root.store.line3=""
}
else if(_root.store.basket.item3.qty !=0){
_root.store.line3=_root.store.basket.item3.qty+", "+_root.store.basket.item3.desc+" for "+_root.store.basket.item3.displayprice+" plus "+_root.store.basket.item3.displayship+" Shipping. " + newline
}
if(_root.store.basket.item4.qty==0){
_root.store.line4=""
}
else if(_root.store.basket.item4.qty !=0){
_root.store.line4=_root.store.basket.item4.qty+", "+_root.store.basket.item4.desc+" for "+_root.store.basket.item4.displayprice+" plus "+_root.store.basket.item4.displayship+" Shipping. " + newline
}
if(_root.store.basket.item5.qty==0){
_root.store.line5=""
}
else if(_root.store.basket.item5.qty !=0){
_root.store.line5=_root.store.basket.item5.qty+", "+_root.store.basket.item5.desc+" for "+_root.store.basket.item5.displayprice+" plus "+_root.store.basket.item5.displayship+" Shipping. " + newline
}
if(_root.store.basket.item6.qty==0){
_root.store.line6=""
}
else if(_root.store.basket.item6.qty !=0){
_root.store.line6=_root.store.basket.item6.qty+", "+_root.store.basket.item6.desc+" for "+_root.store.basket.item6.displayprice+" plus "+_root.store.basket.item6.displayship+" Shipping. " + newline
}
if(_root.store.basket.item7.qty==0){
_root.store.line7=""
}
else if(_root.store.basket.item7.qty !=0){
_root.store.line7=_root.store.basket.item7.qty+", "+_root.store.basket.item7.desc+" for "+_root.store.basket.item7.displayprice+" plus "+_root.store.basket.item7.displayship+" Shipping. " + newline
}
if(_root.store.basket.item8.qty==0){
_root.store.line8=""
}
else if(_root.store.basket.item8.qty !=0){
_root.store.line8=_root.store.basket.item8.qty+", "+_root.store.basket.item8.desc+" for "+_root.store.basket.item8.displayprice+" plus "+_root.store.basket.item8.displayship+" Shipping. " + newline
}
if(_root.store.basket.item9.qty==0){
_root.store.line9=""
}
else if(_root.store.basket.item9.qty !=0){
_root.store.line9=_root.store.basket.item9.qty+", "+_root.store.basket.item9.desc+" for "+_root.store.basket.item9.displayprice+" plus "+_root.store.basket.item9.displayship+" Shipping. " + newline
}
if(_root.store.basket.item10.qty==0){
_root.store.line10=""
}
else if(_root.store.basket.item10.qty !=0){
_root.store.line10=_root.store.basket.item10.qty+", "+_root.store.basket.item10.desc+" for "+_root.store.basket.item10.displayprice+" plus "+_root.store.basket.item10.displayship+" Shipping. " + newline
}
if(_root.store.basket.item11.qty==0){
_root.store.line11=""
}
else if(_root.store.basket.item11.qty !=0){
_root.store.line11=_root.store.basket.item11.qty+", "+_root.store.basket.item11.desc+" for "+_root.store.basket.item11.displayprice+" plus "+_root.store.basket.item11.displayship+" Shipping. " + newline
}
if(_root.store.basket.item12.qty==0){
_root.store.line12=""
}
else if(_root.store.basket.item12.qty !=0){
_root.store.line12=_root.store.basket.item12.qty+", "+_root.store.basket.item12.desc+" for "+_root.store.basket.item12.displayprice+" plus "+_root.store.basket.item12.displayship+" Shipping. " + newline
}
if(_root.store.basket.item13.qty==0){
_root.store.line13=""
}
else if(_root.store.basket.item13.qty !=0){
_root.store.line13=_root.store.basket.item13.qty+", "+_root.store.basket.item13.desc+" for "+_root.store.basket.item13.displayprice+" plus "+_root.store.basket.item13.displayship+" Shipping. " + newline
}
if(_root.store.basket.item14.qty==0){
_root.store.line14=""
}
else if(_root.store.basket.item14.qty !=0){
_root.store.line14=_root.store.basket.item14.qty+", "+_root.store.basket.item14.desc+" for "+_root.store.basket.item14.displayprice+" plus "+_root.store.basket.item14.displayship+" Shipping. " + newline
}
if(_root.store.basket.item15.qty==0){
_root.store.line15=""
}
else if(_root.store.basket.item15.qty !=0){
_root.store.line15=_root.store.basket.item15.qty+", "+_root.store.basket.item15.desc+" for "+_root.store.basket.item15.displayprice+" plus "+_root.store.basket.item15.displayship+" Shipping. " + newline
}
if(_root.store.basket.item16.qty==0){
_root.store.line16=""
}
else if(_root.store.basket.item16.qty !=0){
_root.store.line16=_root.store.basket.item16.qty+", "+_root.store.basket.item16.desc+" for "+_root.store.basket.item16.displayprice+" plus "+_root.store.basket.item16.displayship+" Shipping. " + newline
}
if(_root.store.basket.item17.qty==0){
_root.store.line17=""
}
else if(_root.store.basket.item17.qty !=0){
_root.store.line17=_root.store.basket.item17.qty+", "+_root.store.basket.item17.desc+" for "+_root.store.basket.item17.displayprice+" plus "+_root.store.basket.item17.displayship+" Shipping. " + newline
}
if(_root.store.basket.item18.qty==0){
_root.store.line18=""
}
else if(_root.store.basket.item18.qty !=0){
_root.store.line18=_root.store.basket.item18.qty+", "+_root.store.basket.item18.desc+" for "+_root.store.basket.item18.displayprice+" plus "+_root.store.basket.item18.displayship+" Shipping. " + newline
}
if(_root.store.basket.item19.qty==0){
_root.store.line19=""
}
else if(_root.store.basket.item19.qty !=0){
_root.store.line19=_root.store.basket.item19.qty+", "+_root.store.basket.item19.desc+" for "+_root.store.basket.item19.displayprice+" plus "+_root.store.basket.item19.displayship+" Shipping. " + newline
}
if(_root.store.basket.item20.qty==0){
_root.store.line20=""
}
else if(_root.store.basket.item20.qty !=0){
_root.store.line20=_root.store.basket.item20.qty+", "+_root.store.basket.item20.desc+" for "+_root.store.basket.item20.displayprice+" plus "+_root.store.basket.item20.displayship+" Shipping. " + newline
}

View Replies !    View Related
How Can I Simplify This Code?
Hi everyone,
I'm not new to Flash although I am no Pro either...
I have a MovieClip with 2 frames inside

I have 6 buttons on the 1st Frame in fixed position. Now I want the 6 buttons on the 2nd Frame to take the same pattern/position as the Buttons on the 1st Frame.
1st Frame containts these variables:

Code:
_global.Less1x = Less1._x;
_global.Less1y = Less1._y;
_global.Less2x = Less2._x;
_global.Less2y = Less2._y;
_global.Less3x = Less3._x;
_global.Less3y = Less3._y;
_global.Less4x = Less4._x;
_global.Less4y = Less4._y;
_global.Less5x = Less5._x;
_global.Less5y = Less5._y;
_global.Less6x = Less6._x;
_global.Less6y = Less6._y;

This is what the 2nd Frame contains:

Code:
BackLess1._x = _global.Less1x;
BackLess1._y = _global.Less1y;
BackLess2._x = _global.Less2x;
BackLess2._y = _global.Less2y;
BackLess3._x = _global.Less3x;
BackLess3._y = _global.Less3y;
BackLess4._x = _global.Less4x;
BackLess4._y = _global.Less4y;
BackLess5._x = _global.Less5x;
BackLess5._y = _global.Less5y;
BackLess6._x = _global.Less6x;
BackLess6._y = _global.Less6y;


Please write back or at least point me into a direction of a tutorial.

Thanks a lot in advance

View Replies !    View Related
[MX] Please Help Me Simplify This Code ....
Code:
_root.thumbs.thumb1.onRelease = function() {
counter = 1
gotoAndPlay(2)
}


I need to use this piece of code numberous times ... like a hundred ... I could copy and paste it 100 times and just change the numbers ... but surely not ...

so the thumb1 increments to thumb2 and so on ... and the counter value corresponds to the number thumb ... so the next code would be:


Code:
_root.thumbs.thumb2.onRelease = function() {
counter = 2
gotoAndPlay(2)
}


I'm sure there is a simple function? or something I can use .... any help would be great .. thanks

View Replies !    View Related
[F8] Way To Simplify This Code?
I have 10 buttons named hole2_btn through hole9_btn. I am trying to get it set up so that whenever the user clicks any of the buttons, all of the buttons are disabled for 10 secs. This is what i have so far:


PHP Code:



hole2_btn.onRelease = function():Void {
     _level10.menu_mc.hole2_btn.enabled = false;
     _level10.menu_mc.hole3_btn.enabled = false;
     _level10.menu_mc.hole4_btn.enabled = false;
     _level10.menu_mc.hole5_btn.enabled = false;
     _level10.menu_mc.hole6_btn.enabled = false;
     _level10.menu_mc.hole7_btn.enabled = false;
     _level10.menu_mc.hole8_btn.enabled = false;
     _level10.menu_mc.hole9_btn.enabled = false;
    setTimeout(function() {
          _level10.menu_mc.hole2_btn.enabled = true;
          _level10.menu_mc.hole3_btn.enabled = true;
          _level10.menu_mc.hole4_btn.enabled = true;
          _level10.menu_mc.hole5_btn.enabled = true;
          _level10.menu_mc.hole6_btn.enabled = true;
          _level10.menu_mc.hole7_btn.enabled = true;
          _level10.menu_mc.hole8_btn.enabled = true;
          _level10.menu_mc.hole9_btn.enabled = true;
     }, 10000);
};




So this works just fine, however I didn't know if there was a more efficient way of writing this so that I don't have to copy it 10 times (once for each button). I am unfamiliar with writing code to cover many buttons and don't know where to start. I thought there might be some kind of array or string to do this, but again I haven't worked with those at all. If anyone could please show me how to better write this up, I would be greatful.

Thank you for your time and patience.

View Replies !    View Related
Simplify My Code
Hello everyone,

I'm still quite new to AS, so forgive me if this question seems silly!
I've got some code on frame 1 inside a MC on stage, that goes like this:


PHP Code:



tordowntown_mc.onRelease = function(){    nextFrame();    tordowntown_anim.gotoAndPlay(2);    basefade.gotoAndPlay(2);    }tordowntown_mc.onRollOver = function(){    tordowntown_mc.gotoAndPlay(2);    tordowntown_btn.gotoAndPlay(2);    }tordowntown_mc.onRollOut = function(){    tordowntown_mc.gotoAndPlay(1);    tordowntown_btn.gotoAndPlay(1);    }    tordowntown_btn.onRelease = function(){    nextFrame();    tordowntown_anim.gotoAndPlay(2);    basefade.gotoAndPlay(2);    }tordowntown_btn.onRollOver = function(){    tordowntown_mc.gotoAndPlay(2);    tordowntown_btn.gotoAndPlay(2);    }tordowntown_btn.onRollOut = function(){    tordowntown_mc.gotoAndPlay(1);    tordowntown_btn.gotoAndPlay(1);    } 




Now that's only 1 of about 30 that will be on stage, so repeating that block of code 30 times would be a disaster!

It's basically rolling over 1 mc, triggers the rollover for itself + another different MC on stage. Then once you click either of those mc's, it goes to the next frame where it plays the corresponding "_anim" mc.

I've figured out how to do it with one set of mc's, either "_mc" or "_btn", but not both.

I've come up with this, which only partially works:


PHP Code:



var aCities:Array = new Array("tordowntown", "anothertown", "yet another town"); //etc etc, there are many of them    for (j=0; j<aCities.length; j++){        eval([aCities[j]+"_mc"]).onRelease = function(){                        } // I dont know how to get this to work        eval([aCities[j]+"_mc"]).onRollOver = function(){            this.gotoAndPlay(2);            }        eval ([aCities[j]+"_mc"]).onRollOut = function(){            this.gotoAndPlay(1);            } 




Can anyone please help me?? Thanks alot!!!

View Replies !    View Related
Simplify This Code?
Hello...I have a function that is just way too long, though I can't seem to figure out how to shorten it or streamline it. I believe a loop would work, but I can't figure out how to do it. The numbers increment by 35, and there are 18 different statements. Here is the code...any help greatly appreciated...


ActionScript Code:
function centerScroll() {
   
    if (this.scrollbar_mc._x<35) {
        moveContent(0);
    }
    if (this.scrollbar_mc._x>35 && this.scrollbar_mc._x<70) {
        moveContent(1);
    }
    if (this.scrollbar_mc._x>70 && this.scrollbar_mc._x<105) {
        moveContent(2);
    }
    if (this.scrollbar_mc._x>105 && this.scrollbar_mc._x<140) {
        moveContent(3);
    }
    if (this.scrollbar_mc._x>140 && this.scrollbar_mc._x<175) {
        moveContent(4);
    }
    if (this.scrollbar_mc._x>175 && this.scrollbar_mc._x<210) {
        moveContent(5);
    }
    if (this.scrollbar_mc._x>210 && this.scrollbar_mc._x<245) {
        moveContent(6);
    }
    if (this.scrollbar_mc._x>245 && this.scrollbar_mc._x<280) {
        moveContent(7);
    }
    if (this.scrollbar_mc._x>280 && this.scrollbar_mc._x<315) {
        moveContent(8);
    }
    if (this.scrollbar_mc._x>315 && this.scrollbar_mc._x<350) {
        moveContent(9);
    }
    if (this.scrollbar_mc._x>350 && this.scrollbar_mc._x<385) {
        moveContent(10);
    }
    if (this.scrollbar_mc._x>385 && this.scrollbar_mc._x<420) {
        moveContent(11);
    }
    if (this.scrollbar_mc._x>420 && this.scrollbar_mc._x<455) {
        moveContent(12);
    }
    if (this.scrollbar_mc._x>455 && this.scrollbar_mc._x<490) {
        moveContent(13);
    }
    if (this.scrollbar_mc._x>490 && this.scrollbar_mc._x<525) {
        moveContent(14);
    }
    if (this.scrollbar_mc._x>525 && this.scrollbar_mc._x<560) {
        moveContent(15);
    }
    if (this.scrollbar_mc._x>560 && this.scrollbar_mc._x<595) {
        moveContent(16);
    }
    if (this.scrollbar_mc._x>595 && this.scrollbar_mc._x<630) {
        moveContent(17);
    }
    if (this.scrollbar_mc._x>630) {
        moveContent(18);
    }
}

View Replies !    View Related
Simplify This Code
can anyone simplify this code


ActionScript Code:
function doThis(value){
  trace(_root.clicked);
  //do some stuff here
}

_root.mc_btn.mc_b1.txt.text = xTitles[0];
_root.mc_btn.mc_b2.txt.text = xTitles[1];
_root.mc_btn.mc_b3.txt.text = xTitles[2];
_root.mc_btn.mc_b4.txt.text = xTitles[3];
_root.mc_btn.mc_b5.txt.text = xTitles[4];
_root.mc_btn.mc_b6.txt.text = xTitles[5];
_root.mc_btn.mc_b7.txt.text = xTitles[6];
_root.mc_btn.mc_b8.txt.text = xTitles[7];

_root.mc_btn.mc_b2.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b3.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b4.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b5.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b6.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b7.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};
_root.mc_btn.mc_b8.onRelease = function(){
  _root.clicked = this.txt.text;
  _root.doThis(_root.clicked);
};

I know you can simplify this with a for loop but i have troubles with the button names.

i have uploaded fla...

View Replies !    View Related
How Do I Simplify This Code?
I'm just doing a simple link bar where the active link is disabled and goes to a frame label "selected" and setting all the other links mc's to be enabled when unselected and set to goto frame 1.

Here is an example of what i would put in each frame on the maintimeline representing each link.





ActionScript Code:
//link one is selected
links.one.enabled=false;
links.one.gotoAndStop("selected");

links.two.gotoAndStop(1);
links.two.enabled=true;
links.three.gotoAndStop(1);
links.three.enabled=true;
links.four.gotoAndStop(1);
links.four.enabled=true;
links.five.gotoAndStop(1);
links.five.enabled=true;

Thanks!

View Replies !    View Related
Simplify Code
Hello! I think I am going about this in a much longer way than is needed...could anyone let me know if there is a much simplier way to accomplish this?

I would like to end the function fadeIn() once the mc to fade has finished fading. That's it!

Here's my code:

HTML Code:
function fadeIn(mc) {
mc.onEnterFrame=function() {
trace("fading");
this._alpha+=(100-this._alpha)/7;
}
}
function fadeStop(mc) {
mc.onEnterFrame=function() {
trace("end fade");
this.onEnterFrame=null;
}
}
function checkFade(clip) {
this.onEnterFrame=function() {
if (clip._alpha<90) {
fadeIn(one);
} else if (clip._alpha>90) {
fadeStop(one);
trace("ending CHECK FADE");
this.onEnterFrame=null;
}
}
}
button.onRelease=function() {
checkFade(one);
}

View Replies !    View Related
Simplify This Code
Any way to implify this code , or make more clean
thx

if (ojos == 1) {
ojosx.gotoAndStop(2);
} else if (ojos == 2) {
ojosx.gotoAndStop(3);
} else if (ojos == 3) {
ojosx.gotoAndStop(4);
} else if (ojos == 4) {
ojosx.gotoAndStop(5);
} else if (ojos == 5) {
ojosx.gotoAndStop(6);
} else if (ojos == 6) {
ojosx.gotoAndStop(7);
} else if (ojos == 7) {
ojosx.gotoAndStop(8);
}

View Replies !    View Related
Simplify My Code...
Hey - here's a code clip from one of my AS classes...

var oThis:Object = this;
_oListener.onLoadInit = function(mcThumb:MovieClip):Void {
//call the updater.
oThis._TSU.thumbLoaded(mcThumb);
}

Now, this code works fine... but I feel a bit silly having just one line of code in a function... shouldn't there be some way to do something like this....?

var oThis:Object = this;
_oListener.onLoadInit = oThis._TSU.thumbLoaded(mcThumb);

Any tips? What am I doing wrong here?

Thanks again!

View Replies !    View Related
Simplify My Code
Hi,

I'm looking for help to simplify my code. I"m creating a portfolio and there is a lot of repetition in it...

Can anybody help me with this? I will have somethinh like 50 or 60 images to put in this portfolio

thanks a lot for youy help







Attach Code

thumb.load1.loader.autoLoad = true;
thumb.load1.loader.contentPath = "image1.jpg";
//thumb.load1.pBar.source = thumb.load1.loader;
thumb.load1.button.onRelease = function(){
portfolio.gotoAndStop(1);
}

thumb.load2.loader.autoLoad = true;
thumb.load2.loader.contentPath = "image2.jpg";
//thumb.load2.pBar.source = thumb.load2.loader;
thumb.load2.button.onRelease = function(){
portfolio.gotoAndStop(2);
}

thumb.load3.loader.autoLoad = true;
thumb.load3.loader.contentPath = "image3.jpg";
//thumb.load3.pBar.source = thumb.load3.loader;
thumb.load3.button.onRelease = function(){
portfolio.gotoAndStop(3);
}

View Replies !    View Related
How To Simplify This Code?
hi guys whats the correct way to simplify this into 1 line?

-------------------------
_root.tutorial-=1;
_root.tutorial+="t";
-------------------------

basically i have this variable called tutorial which is a int.
lets say _root.tutorial=4;

I want it to decrease by 1 and then concat a letter 't' to it, thus changing it into a string.

The above code works but when i change it to:

---------------------------
_root.tutorial-=1+"t";
---------------------------

i get some funny value.

btw just to be sure, flash automatically converts between data types right? if not, how do i convert ints to strs and vice versa?

Int.parseInt(variable); ????
Int.(variable); ????

I need answers!

Thank you

View Replies !    View Related
Simplify Code
Hello,

how can i simplify this code so i won't have to write long lines of the same thing?


ActionScript Code:
img.dot1.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  347.7, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  447, .50, true);}img.dot2.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  538, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  274, .50, true);}img.dot3.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  538, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  274, .50, true);}img.dot4.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  502, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  245, .50, true);}img.dot5.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  502, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  245, .50, true);}img.dot6.onRelease = function () {    new Tween(img, "_x", Strong.easeIn, img._x,  502, .50, true);    new Tween(img, "_y", Strong.easeIn, img._y,  245, .50, true);}


please advice.

thanks.

View Replies !    View Related
Help Simplify This Code
could someone help me simplify this code down a bit
it works just fine as it is, but I would like it to be smaller and more compact if possible

whatever I do I cant get it to work unless its in a mass of if statements




Code:
onEnterFrame = function(){
for (var i=0; i < 14; i++){
if (cardsArray[0] == i){
this["cross" + i]._alpha = 100;
}
}

////////////////////////Card 1 Guess////////////////////////
if (_global.goCounter == 1){
if (cardsArray[1] > cardsArray[0] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack1._alpha = 0;
trace("card"+cardsArray[1]);
}

if (cardsArray[1] < cardsArray[0] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack1._alpha = 0;
trace("card"+cardsArray[1]);
}

if (cardsArray[1] < cardsArray[0] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack1._alpha = 0;
trace("card"+cardsArray[1]);
}

if (cardsArray[1] > cardsArray[0] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack1._alpha = 0;
trace("card"+cardsArray[1]);
}

for (var i=0; i < 14; i++){
if (cardsArray[1] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 2 Guess////////////////////////
if (_global.goCounter == 2){
if (cardsArray[2] > cardsArray[1] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack2._alpha = 0;
}

if (cardsArray[2] < cardsArray[1] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack2._alpha = 0;
}

if (cardsArray[2] < cardsArray[1] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack2._alpha = 0;
}

if (cardsArray[2] > cardsArray[1] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack2._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[2] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 3 Guess////////////////////////
if (_global.goCounter == 3){
if (cardsArray[3] > cardsArray[2] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack3._alpha = 0;
}

if (cardsArray[3] < cardsArray[2] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack3._alpha = 0;
}

if (cardsArray[3] < cardsArray[2] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack3._alpha = 0;
}

if (cardsArray[3] > cardsArray[2] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack3._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[3] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 4 Guess////////////////////////
if (_global.goCounter == 4){
if (cardsArray[4] > cardsArray[3] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack4._alpha = 0;
}

if (cardsArray[4] < cardsArray[3] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack4._alpha = 0;
}

if (cardsArray[4] < cardsArray[3] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack4._alpha = 0;
}

if (cardsArray[4] > cardsArray[3] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack4._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[4] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 5 Guess////////////////////////
if (_global.goCounter == 5){
if (cardsArray[5] > cardsArray[4] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack5._alpha = 0;
}

if (cardsArray[5] < cardsArray[4] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack5._alpha = 0;
}

if (cardsArray[5] < cardsArray[4] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack5._alpha = 0;
}

if (cardsArray[5] > cardsArray[4] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack5._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[5] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 6 Guess////////////////////////
if (_global.goCounter == 6){
if (cardsArray[6] > cardsArray[5] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack6._alpha = 0;
}

if (cardsArray[6] < cardsArray[5] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack6._alpha = 0;
}

if (cardsArray[6] < cardsArray[5] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack6._alpha = 0;
}

if (cardsArray[6] > cardsArray[5] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack6._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[6] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 7 Guess////////////////////////
if (_global.goCounter == 7){
if (cardsArray[7] > cardsArray[6] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack7._alpha = 0;
}

if (cardsArray[7] < cardsArray[6] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack7._alpha = 0;
}

if (cardsArray[7] < cardsArray[6] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack7._alpha = 0;
}

if (cardsArray[7] > cardsArray[6] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack7._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[7] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 8 Guess////////////////////////
if (_global.goCounter == 8){
if (cardsArray[8] > cardsArray[7] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack8._alpha = 0;
}

if (cardsArray[8] < cardsArray[7] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack8._alpha = 0;
}

if (cardsArray[8] < cardsArray[7] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack8._alpha = 0;
}

if (cardsArray[8] > cardsArray[7] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack8._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[8] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 9 Guess////////////////////////
if (_global.goCounter == 9){
if (cardsArray[9] > cardsArray[8] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack9._alpha = 0;
}

if (cardsArray[9] < cardsArray[8] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack9._alpha = 0;
}

if (cardsArray[9] < cardsArray[8] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack9._alpha = 0;
}

if (cardsArray[9] > cardsArray[8] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack9._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[9] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 10 Guess////////////////////////
if (_global.goCounter == 10){
if (cardsArray[10] > cardsArray[9] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack10._alpha = 0;
}

if (cardsArray[10] < cardsArray[9] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack10._alpha = 0;
}

if (cardsArray[10] < cardsArray[9] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack10._alpha = 0;
}

if (cardsArray[10] > cardsArray[9] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack10._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[10] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 11 Guess////////////////////////
if (_global.goCounter == 11){
if (cardsArray[11] > cardsArray[10] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack11._alpha = 0;
}

if (cardsArray[11] < cardsArray[10] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack11._alpha = 0;
}

if (cardsArray[11] < cardsArray[10] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack11._alpha = 0;
}

if (cardsArray[11] > cardsArray[10] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack11._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[11] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////

////////////////////////Card 12 Guess////////////////////////
if (_global.goCounter == 12){
if (cardsArray[12] > cardsArray[11] && _global.hlPress == 1){
scoring.gotoAndPlay(2);
cardBack12._alpha = 0;
}

if (cardsArray[12] < cardsArray[11] && _global.hlPress == 1){
scoring.gotoAndPlay(3);
cardBack12._alpha = 0;
}

if (cardsArray[12] < cardsArray[11] && _global.hlPress == 2){
scoring.gotoAndPlay(2);
cardBack12._alpha = 0;
}

if (cardsArray[12] > cardsArray[11] && _global.hlPress == 2){
scoring.gotoAndPlay(3);
cardBack12._alpha = 0;
}

for (var i=0; i < 14; i++){
if (cardsArray[12] == i){
this["cross" + i]._alpha = 100;
}
}
}
/////////////////////////////////////////////////////////////



}

View Replies !    View Related
[as1] [help] To Simplify A Code
I need some help with simplifying part of the code below, I would do like to simplify the part that is changing the _alpha of all the boxes. Thanks for any help.


ActionScript Code:
on (press) {
    _root.mbox._visible = 0;
    _root.box._visible = 1;
    _root.mbox.xtarget = (_x, 1);
    _root.mbox.ytarget = (_y, 190);
    _root.box.sq._alpha = 30;
    _root.box._alpha = 100;
    _root.box1.sq1._alpha = 100;
    _root.box1._alpha = 40;
    _root.box2.sq2._alpha = 100;
    _root.box2._alpha = 40;
    _root.box3.sq3._alpha = 100;
    _root.box3._alpha = 40;
    _root.box4.sq4._alpha = 100;
    _root.box4._alpha = 40;
    _root.box5.sq5._alpha = 100;
    _root.box5._alpha = 40;
    _root.box6.sq6._alpha = 100;
    _root.box6._alpha = 40;
    _root.box.swapDepths (2);
    with (_root.box1 && _root.box2 && _root.box3 && _root.box4 && _root.box5 && _root.box6) {
    }
}

View Replies !    View Related
Simplify Code
i am pretty darn new to AS..and i am doing this site...I am having some issue simplifying my code...could someone take a look at this and tell how i could condense some of this..i am also having an issue with smoothness...everything works fine until i put in the loader to add external swf...it bogs down and is choppy..but when i take the loader out and just have the buttons animating the stage it runs just fine..any thoughts...here is the code i have...i know its long...sorry

Code:

stop();

//Imports
import gs.*;
import gs.TweenGroup;
import gs.easing.*;
import gs.easing.CustomEase;

// Url Requests
var appsPoultryRequest:URLRequest = new URLRequest("swf/appetizers/poultry/appsPoultry.swf");
var mainsPoultryRequest:URLRequest = new URLRequest("swf/mainDishes/poultry/mainPoultry.swf");
var dessertsPiesRequest:URLRequest = new URLRequest("swf/desserts/pies/dessertsPies.swf");
var dessertsSpecialtiesRequest:URLRequest = new URLRequest("swf/desserts/specialties/dessertsSpecialties.swf");

//Loader
var recipeLoader:Loader = new Loader();
recipeLoader.x = 15;
recipeLoader.y = 135;

//Arrays
var homeBtnArray:Array=new Array(homeBtn,recipeBtn);
var mainBtnArray:Array=new Array(appsBtn,dessertsBtn,drinksBtn,mainsBtn,sandsBtn,sidesBtn,soupsBtn);
var appsBtnArray:Array=new Array(beefBtn,gameBtn,porkBtn,poultryBtn,seafoodBtn,veggieBtn);
var drinksBtnArray:Array=new Array(alcoholicBtn,nonalcoholicBtn,smoothieBtn);
var dessertsBtnArray:Array=new Array(cakesBtn,cookiesBtn,icecreamBtn,piesBtn,specialtiesBtn);
var mainsBtnArray:Array=new Array(beefBtn2,gameBtn2,porkBtn2,poultryBtn2,seafoodBtn2,veggieBtn2);
var sandsBtnArray:Array=new Array(beefBtn3,gameBtn3,porkBtn3,poultryBtn3,seafoodBtn3,veggieBtn3);
var sidesBtnArray:Array=new Array(beefBtn4,gameBtn4,porkBtn4,poultryBtn4,seafoodBtn4,veggieBtn4);
var soupsBtnArray:Array=new Array(beefBtn5,gameBtn5,porkBtn5,poultryBtn5,seafoodBtn5,veggieBtn5);

//Groups
var mainBtnGroup:TweenGroup = TweenGroup.allTo(mainBtnArray,1,{x:-150, alpha:1, stagger:.05}, TweenMax);
var appsBtnGroup:TweenGroup = TweenGroup.allTo(appsBtnArray,1,{x:344.6,y:204.8, alpha:0, stagger:.02}, TweenMax);
var drinksBtnGroup:TweenGroup = TweenGroup.allTo(drinksBtnArray,1,{x:804.3,y:205.7, alpha:0, stagger:.02}, TweenMax);
var dessertsBtnGroup:TweenGroup = TweenGroup.allTo(dessertsBtnArray,1,{x:575,y:204.8,alpha:0,stagger:.02}, TweenMax);
var mainsBtnGroup:TweenGroup = TweenGroup.allTo(mainsBtnArray,1,{x:345.8,y:348.9,alpha:0,stagger:.02}, TweenMax);
var sandsBtnGroup:TweenGroup = TweenGroup.allTo(sandsBtnArray,1,{x:575,y:348.9,alpha:0,stagger:.02}, TweenMax);
var sidesBtnGroup:TweenGroup = TweenGroup.allTo(sidesBtnArray,1,{x:804.3,y:348.9,alpha:0,stagger:.02}, TweenMax);
var soupsBtnGroup:TweenGroup = TweenGroup.allTo(soupsBtnArray,1,{x:575,y:491.4,alpha:0,stagger:.02}, TweenMax);

//Mouse Clicks
  //Main Stage
   homeBtn.addEventListener(MouseEvent.CLICK, backAnimation);
   appsBtn.addEventListener(MouseEvent.CLICK, appsLoaded);
   dessertsBtn.addEventListener(MouseEvent.CLICK, dessertsLoaded);
   drinksBtn.addEventListener(MouseEvent.CLICK, drinksLoaded);
   mainsBtn.addEventListener(MouseEvent.CLICK, mainsLoaded);
   recipeBtn.addEventListener(MouseEvent.CLICK, outAnimation);
   sandsBtn.addEventListener(MouseEvent.CLICK, sandsLoaded);
   sidesBtn.addEventListener(MouseEvent.CLICK, sidesLoaded);
   soupsBtn.addEventListener(MouseEvent.CLICK, soupsLoaded);
  //Appetizers   
   //beefBtn.addEventListener(MouseEvent.CLICK,);
   //gameBtn.addEventListener(MouseEvent.CLICK,);
   //porkBtn.addEventListener(MouseEvent.CLICK,);
   poultryBtn.addEventListener(MouseEvent.CLICK, appsPoultry);
   //seafoodBtn.addEventListener(MouseEvent.CLICK,);
   //veggieBtn.addEventListener(MouseEvent.CLICK,);
  //Desserts   
   //cakesBtn.addEventListener(MouseEvent.CLICK,);
   //cookiesBtn.addEventListener(MouseEvent.CLICK,);
   //icecreamBtn.addEventListener(MouseEvent.CLICK,);
   piesBtn.addEventListener(MouseEvent.CLICK, dessertsPies);
   specialtiesBtn.addEventListener(MouseEvent.CLICK,dessertsSpecialties);
  //Drinks   
   //alcoholicBtn.addEventListener(MouseEvent.CLICK,);
   //nonalcoholicBtn.addEventListener(MouseEvent.CLICK,);
   //smoothieBtn.addEventListener(MouseEvent.CLICK,);
  //Main Dishes   
   //beefBtn2.addEventListener(MouseEvent.CLICK,);
   //gameBtn2.addEventListener(MouseEvent.CLICK,);
   //porkBtn2.addEventListener(MouseEvent.CLICK,);
   poultryBtn2.addEventListener(MouseEvent.CLICK, mainsPoultry);
   //seafoodBtn2.addEventListener(MouseEvent.CLICK,);
   //veggieBtn2.addEventListener(MouseEvent.CLICK,);   
  //Sandwiches
   //beefBtn3.addEventListener(MouseEvent.CLICK,);
   //gameBtn3.addEventListener(MouseEvent.CLICK,);
   //porkBtn3.addEventListener(MouseEvent.CLICK,);
   //poultryBtn3.addEventListener(MouseEvent.CLICK, loadMC);
   //seafoodBtn3.addEventListener(MouseEvent.CLICK,);
   //veggieBtn3.addEventListener(MouseEvent.CLICK,);
  //Sides   
   //beefBtn4.addEventListener(MouseEvent.CLICK,);
   //gameBtn4.addEventListener(MouseEvent.CLICK,);
   //porkBtn4.addEventListener(MouseEvent.CLICK,);
   //poultryBtn4.addEventListener(MouseEvent.CLICK, loadMC);
   //seafoodBtn4.addEventListener(MouseEvent.CLICK,);
   //veggieBtn4.addEventListener(MouseEvent.CLICK,);
  //Soups
   //beefBtn5.addEventListener(MouseEvent.CLICK,);
   //gameBtn5.addEventListener(MouseEvent.CLICK,);
   //porkBtn5.addEventListener(MouseEvent.CLICK,);
   //poultryBtn5.addEventListener(MouseEvent.CLICK, loadMC);
   //seafoodBtn5.addEventListener(MouseEvent.CLICK,);
   //veggieBtn5.addEventListener(MouseEvent.CLICK,);   
   
   
//Functions
//===========================================================
function outAnimation(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false;
     mainBtnGroup.resume();
   }
//===========================================================
function backAnimation(e:MouseEvent):void
    {
   mainBtnGroup.reversed = true;
   var appsBtnGroup:TweenGroup = TweenGroup.allTo(appsBtnArray,3,{x:344.6,y:204.8, alpha:0, stagger:.02}, TweenMax);
   var dessertsBtnGroup:TweenGroup = TweenGroup.allTo(dessertsBtnArray,3,{x:575,y:204.8,alpha:0,stagger:.02}, TweenMax);
   var drinksBtnGroup:TweenGroup = TweenGroup.allTo(drinksBtnArray,3,{x:804.3,y:205.7, alpha:0, stagger:.02}, TweenMax);
   var mainsBtnGroup:TweenGroup = TweenGroup.allTo(mainsBtnArray,3,{x:345.8,y:348.9, alpha:0, stagger:.02}, TweenMax);
   var sandsBtnGroup:TweenGroup = TweenGroup.allTo(sandsBtnArray,3,{x:575,y:348.9, alpha:0, stagger:.02}, TweenMax);
   var sidesBtnGroup:TweenGroup = TweenGroup.allTo(sidesBtnArray,3,{x:804.3,y:348.9, alpha:0, stagger:.02}, TweenMax);
   var soupsBtnGroup:TweenGroup = TweenGroup.allTo(soupsBtnArray,3,{x:575,y:491.4, alpha:0, stagger:.02}, TweenMax);
   }
//===========================================================
function appsLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(beefBtn,2,{x:100, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(gameBtn,2,{x:290,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(porkBtn,2,{x:480,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(poultryBtn,2,{x:670,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(seafoodBtn,2,{x:860,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(veggieBtn,2,{x:1050,y:70, alpha:1, ease:Cubic.easeOut});
   }

//===========================================================
function dessertsLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(cakesBtn,2,{x:116.5, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(cookiesBtn,2,{x:345.8,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(icecreamBtn,2,{x:575,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(piesBtn,2,{x:804.3,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(specialtiesBtn,2,{x:1033.6,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function drinksLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(alcoholicBtn,2,{x:345.8, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(nonalcoholicBtn,2,{x:575,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(smoothieBtn,2,{x:804.3,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function mainsLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(beefBtn2,2,{x:100, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(gameBtn2,2,{x:290,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(porkBtn2,2,{x:480,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(poultryBtn2,2,{x:670,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(seafoodBtn2,2,{x:860,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(veggieBtn2,2,{x:1050,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function sandsLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(beefBtn3,2,{x:100, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(gameBtn3,2,{x:290,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(porkBtn3,2,{x:480,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(poultryBtn3,2,{x:670,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(seafoodBtn3,2,{x:860,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(veggieBtn3,2,{x:1050,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function sidesLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(beefBtn4,2,{x:100, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(gameBtn4,2,{x:290,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(porkBtn4,2,{x:480,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(poultryBtn4,2,{x:670,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(seafoodBtn4,2,{x:860,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(veggieBtn4,2,{x:1050,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function soupsLoaded(e:MouseEvent):void
    {
     mainBtnGroup.reversed = false; //automatically resumes the group too
     TweenMax.to(beefBtn5,2,{x:100, y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(gameBtn5,2,{x:290,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(porkBtn5,2,{x:480,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(poultryBtn5,2,{x:670,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(seafoodBtn5,2,{x:860,y:70, alpha:1, ease:Cubic.easeOut});
    TweenMax.to(veggieBtn5,2,{x:1050,y:70, alpha:1, ease:Cubic.easeOut});
   }
//===========================================================
function appsPoultry (e:MouseEvent):void
   {
    recipeLoader.load(appsPoultryRequest)
    addChild(recipeLoader)
   }
function mainsPoultry (e:MouseEvent):void
   {
    recipeLoader.load(mainsPoultryRequest)
    addChild(recipeLoader)
   }
function dessertsPies (e:MouseEvent):void
   {
    recipeLoader.load(dessertsPiesRequest)
    addChild(recipeLoader)
   }   
function dessertsSpecialties (e:MouseEvent):void
   {
    recipeLoader.load(dessertsSpecialtiesRequest)
    addChild(recipeLoader)
   }   
//===========================================================

//Filters//
TweenGroup.allTo(homeBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(mainBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(appsBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(dessertsBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(drinksBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(mainsBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(sandsBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(sidesBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);
TweenGroup.allTo(soupsBtnArray, .2, {glowFilter:{color:0x64D9F4, alpha:1, blurX:20, blurY:20}}, TweenMax);



i have also attached the flash file for some one to take a look at...thanks

here is the link too so you can see on the web and see how choppy it is...

http://joanrobertsfoundation.com/recipeExchange.swf

thanks

View Replies !    View Related
Simplify This Code? Variables?
Hi all,

I'm doing a rollover action that fades in on rollover and on rollout basically sends the playhead to the correct frame on the movie clip so the fade out is smooth.

Here is the code I am using which works fine. Is there a tidier way to do this using the _currentFrame and variables? I'm trying to streamline this code. Any help would be appreciated!

Thanks


on (rollOver) {
_root.rollover.gotoAndPlay(2);
}
on (rollOut) {
if (rollover._currentFrame == 2) {
rollover.gotoAndPlay(31);
}
if (rollover._currentFrame == 3) {
rollover.gotoAndPlay(30);
}
if (rollover._currentFrame == 4) {
rollover.gotoAndPlay(29);
}
if (rollover._currentFrame == 5) {
rollover.gotoAndPlay(28);
}
if (rollover._currentFrame == 6) {
rollover.gotoAndPlay(27);
}
if (rollover._currentFrame == 7) {
rollover.gotoAndPlay(26);
}
if (rollover._currentFrame == 8) {
rollover.gotoAndPlay(25);
}
if (rollover._currentFrame == 9) {
rollover.gotoAndPlay(24);
}
if (rollover._currentFrame == 10) {
rollover.gotoAndPlay(23);
}
if (rollover._currentFrame == 11) {
rollover.gotoAndPlay(22);
}
}

View Replies !    View Related
Help Simplify CreateTextField Code
Code:
_root.createTextField("texttopic1", 1, 80, 125, 150, 10);
texttopic1.multiline = true;
texttopic1.autoSize = true;
myformat1 = new TextFormat();
myformat1.font = "Verdana";
myformat1.size = "10";
_root.createTextField("texttopic2", 2, 80, 175, 150, 10);
texttopic2.multiline = true;
texttopic2.autoSize = true;
_root.createTextField("texttopic3", 3, 80, 225, 150, 10);
texttopic3.multiline = true;
texttopic3.autoSize = true;
_root.loadVariables("text/texttopics.txt");
_root.onData = function() {
_root.texttopic2.text = topic2;
_root.texttopic1.text = topic1;
_root.texttopic3.text = topic3;
texttopic1.setTextFormat(myformat1);
texttopic2.setTextFormat(myformat1);
texttopic3.setTextFormat(myformat1);
};
This code allows me to dynamically create 3 different textfields. What I would like is to make it more simple, as I would get a hughe amout of code if I would want 5 textfields or more.
I tried using "for (i=0, i<4, i++)" but I got stuck on the instance name. I used "texttopic"+1, but when I wanted to target the instance name, in the line "texttopic"+1.multiline = true; if didn't do much anymore.

View Replies !    View Related
How Can I Simplify This Code Into An Array?
I assume that there is a smart cookie who knows how to write this into an Array, because am having some trouble.

I would like to be able to duplicate this Button function below. The Pic1, and whichStyle values are identical. I would like to condense this code to make it simpler, and more reusable...


Code:
// Button 1
_root.gallery.Pic1.onPress = function() {
if (whichStyle!=1) {
fadeOut = true;
whichStyle=1;
}
};
//Button 2
_root.gallery.Pic2.onPress = function() {
if (whichStyle!=2) {
fadeOut = true;
whichStyle=2;
}

View Replies !    View Related
Using Variables To Simplify My Code
Hi,

I need to simplify my code for the use of multiple buttons..

As you can see in my code, there is a lot of lines that repeats...I know I should use variables or something like that but I'm really not a programmer so if anybody could help me with this...
In my test, I'm using 6 buttons but for the real project, threre will be around 36 buttons..

How do I change btn1, btn2, btn3...., page1.html, page2.html, page3.html....etc to variables? And what will be the code on the buttons to change these variables??

Thanks a lot in advance...(and sorry for my english!)










Attach Code

menu.btn1.btn00.onPress = function () {
getURL("page1.html", "_self");
};
if (_level0.niveau == "page1"){
menu.btn1.gotoAndStop("off");
}

menu.btn2.btn00.onPress = function () {
getURL("page2.html", "_self");
};
if (_level0.niveau == "page2"){
menu.btn2.gotoAndStop("off");
}

menu.btn3.btn00.onPress = function () {
getURL("page3.html", "_self");
};
if (_level0.niveau == "page3"){
menu.btn3.gotoAndStop("off");
}

menu.btn4.btn00.onPress = function () {
getURL("page4.html", "_self");
};
if (_level0.niveau == "page4"){
menu.btn4.gotoAndStop("off");
}

menu.btn5.btn00.onPress = function () {
getURL("page5.html", "_self");
};
if (_level0.niveau == "page5"){
menu.btn5.gotoAndStop("off");
}

menu.btn6.btn00.onPress = function () {
getURL("page6.html", "_self");
};
if (_level0.niveau == "page6"){
menu.btn6.gotoAndStop("off");
}

View Replies !    View Related
How To Simplify And Improve My Code?
Hello,
Been reading up on the flash transition object.

I came up with this way of fading out one clip and fading in another and having them loop forever using the transition objects but it's very dirty coding and not very flexible.

Is there a way to clean it up so that I can add as many clips as I want without having to write more code, just by adding more movie clips to the stage?

Thanks


Code:
// initialize all the clips to 0 alpha
function fullalpha() {
var i;
for(i in _root) {
if (this[i] instanceof MovieClip);
this[i]._alpha = 0;
}
}
fullalpha();



import mx.transitions.Tween;
import mx.transitions.easing.*;

//fade out the first object
function playFades() {
var tween_handler1:Object = new Tween(content1, "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler1.onMotionFinished = function() {
//fade in second object
var tween_handler1:Object = new Tween(content2, "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//fade out the second object
var tween_handler1:Object = new Tween(content2, "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler1.onMotionFinished = function() {
//fade in the first object
var tween_handler1:Object = new Tween(content1, "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//loop back to the beginning again
playFades();
}
}
}
}
}
playFades();

View Replies !    View Related
Can You Simplify This Code Using A Loop?
Hi,

can you simplify this code using a loop?

Code:
button1.onPress = function() {
trace("Button1");
};
button2.onPress = function() {
trace("Button2");
};
button3.onPress = function() {
trace("Button3");
};
A simple loop like the one below does not work, as it counts to 4 and then always only displays "Button4".

Code:
for (i=1; i<4; i++) {
_root["button"+i].onPress = function() {
trace("Button"+i);
};
}
There must be a very simple solution for this...
Thanks for your input!

View Replies !    View Related
Simplify Code To: String, Array, Var?
Greetings all,

I am trying to simplify my code. What I am tring to do is compare the characters in the string to the characters in the input text fields, which I have manually coded below, and if they do not match change the color of the text in the field. Is there a way to eliminate the hand coding of each text field if/else statements as I have below? Any assistance, guidance will be greatly appreciated. I am using Flash MX for this project.

Code:

function twocheck() {
two = "";
for (var i = 1; i<=6; i++) {
two += this["r4"+"_"+i].text.toString();
}
trace(two);
///////////chalk
/////////below is what I want to simplify
if (r4_1.text == "c") {
r4_1.setTextFormat(black);
} else {
r4_1.setTextFormat(red);
_hint1._visible = true;
}
if (r4_2.text == "h") {
r4_2.setTextFormat(black);
} else {
r4_2.setTextFormat(red);
_hint2._visible = true;
}
if (r4_3.text == "a") {
r4_3.setTextFormat(black);
} else {
r4_3.setTextFormat(red);
_hint3._visible = true;
}
if (r4_4.text == "l") {
r4_4.setTextFormat(black);
} else {
r4_4.setTextFormat(red);
_hint4._visible = true;
}
if (r4_5.text == "k") {
r4_5.setTextFormat(black);
} else {
r4_5.setTextFormat(red);
_hint5._visible = true;
}
/////////////////above is what I want to simplify
if ((two == "chalk")) {
a_two.num._alpha = 50;
a_two.enabled = false;
checkword._visible = false;
Selection.setFocus(parking);
beepacross();
}
}

View Replies !    View Related
Could Someone (ideally Senocular) Help Me Simplify This Code.
I modified senocular's waitbuttonanimations fla which is basically 3 mbuttons that each play an mc. But when a button is pressed it waits untill the previous buttons mc plays its out animation before it plays its in animation.

Anyway, i modified this so that instead of an animation tween it does an alpha fade. Here it is: www.s91931107.onlinehome.us/wait%20buttons2.swf.

The only problem is that i used 3 onEnterFrame events that are constantly playing even when they are not needed. If someone could take a look at my fla (it should'nt take long to see how it works) and see if they can come up with a more efficient way then that would be great. Thanks!

HERES THE FLA: www.s91931107.onlinehome.us/wait%20buttons2.fla.

View Replies !    View Related
Could Someone (ideally Senocular) Help Me Simplify This Code.
I modified senocular's waitbuttonanimations fla which is basically 3 mbuttons that each play an mc. But when a button is pressed it waits untill the previous buttons mc plays its out animation before it plays its in animation.

Anyway, i modified this so that instead of an animation tween it does an alpha fade. Here it is: www.s91931107.onlinehome.us/wait%20buttons2.swf.

The only problem is that i used 3 onEnterFrame events that are constantly playing even when they are not needed. If someone could take a look at my fla (it should'nt take long to see how it works) and see if they can come up with a more efficient way then that would be great. Thanks!

HERES THE FLA: www.s91931107.onlinehome.us/wait%20buttons2.fla.

View Replies !    View Related
How To Simplify And Automate My Transition Object Code?
Hello,
Been reading up on the flash transition object as I need to create a number of transition clips, basically fading in an infinite loop between images, of which there may be 2-5 images.

I came up with this way of fading out one clip and fading in another and having them loop forever using the transition objects but it's very dirty and not very flexible in that if there are more than 2 clips I have to manually add the code for them.

Is there a way to clean it up so that I can add as many clips as I want without having to write more code, just by adding more movie clips to the stage?

Thanks


Here is my code

Code:
// initialize all the clips to 0 alpha
function fullalpha() {
var i;
for(i in _root) {
if (this[i] instanceof MovieClip);
this[i]._alpha = 0;
}
}
fullalpha();



import mx.transitions.Tween;
import mx.transitions.easing.*;

//fade out the first object
function playFades() {
var tween_handler1:Object = new Tween(content1, "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler1.onMotionFinished = function() {
//fade in second object
var tween_handler1:Object = new Tween(content2, "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//fade out the second object
var tween_handler1:Object = new Tween(content2, "_alpha", Strong.easeIn, 100, 0, 3.5, true);
tween_handler1.onMotionFinished = function() {
//fade in the first object
var tween_handler1:Object = new Tween(content1, "_alpha", Strong.easeIn, 0, 100, 1, true);
tween_handler1.onMotionFinished = function() {
//loop back to the beginning again
playFades();
}
}
}
}
}
playFades();

View Replies !    View Related
Simplify Drag Code Using ["label"+i]
hi im currently making a drag and drop game with 5 targets (target1_mc. target2_mc etc....) and 5 draggable movie clips (label1, label2, label3 etc...

when the user drags the mc and drops it over any target (right or wrong) it snaps into place and disables. I can do this but it seems very code heavy with the following code used for every label:


Code:

//Code to make the movie clip draggable
this.label1.onPress = function() {
startDrag(this);
label1.swapDepths(100);
_root.answer1="";
}
this.label1.onRelease = function() {
stopDrag();

// tests to see if the draggable movie clip is over a target then locks it into place
if(eval(this._droptarget) == _root.target1_mc) {
setProperty(this, _x, 150);
setProperty(this, _y, 100);
_root.allCorrect +=1;
label1.enabled=false;
}
if(eval(this._droptarget) == _root.target2_mc) {
setProperty(this, _x, 160);
setProperty(this, _y, 200);
label1.enabled=false;
}
if(eval(this._droptarget) == _root.target3_mc) {
setProperty(this, _x, 400);
setProperty(this, _y, 180);
label1.enabled=false;
}
if(eval(this._droptarget) == _root.target4_mc) {
setProperty(this, _x, 260);
setProperty(this, _y, 260);
label1.enabled=false;
}
if(eval(this._droptarget) == _root.target5_mc) {
setProperty(this, _x, 390);
setProperty(this, _y, 90);
label1.enabled=false;
}
}



i have seen how you can use '+i to indicate a movie clip instance with a number after it and wonder how I could apply it in this situation reducing my amount of code.

Thanks

Andy

View Replies !    View Related
Simplify?
Hello,

Look at my flash document. Is there an easier way to do this. Also how do I make the character move?


Ryan

View Replies !    View Related
Can Someone Help Simplify This?
I'm trying to figure out how to turn an array into a scrolling list of button links. I have found a tutorial on FlashKit that does exactly that, but unfortunatly it also does about 20 other things, plus it's written for an older version of Flash, and being a relative newbie I am having trouble figuring it out.

Have a look at:
http://www.flashkit.com/tutorials/In...u-73/index.php

What I would like to be able to reproduce is just the scrollable list of links, (which is generated from an array in the actionscript), without any of the search functionality.

Any help would be extreamly appresiated!

View Replies !    View Related
Can Someone Help Me Simplify?
...and translate italian? I downloaded a dynamic menu from the "movies" section of FK a while ago. It's a sweet menu, but it's hard as heck to figure out the scripting: I feel like there's an easier way to script it, not so much long hand and redundancy...not to mention some of the words are in italian.

So, i've attached the fla, can anyone give a stab at simplifying it? I'm ok with scripting, but certainly no pro. And I guess I should say that i've played with it enough to figure out how to manipulate it to fit my needs, but whenever i come back to edit it....it takes forever to refigure it out!

thanks for any help.

View Replies !    View Related
How To Simplify As
hi,

can anyone help me how to simplify this?


Code:
var today = new Date();
//var minutes = today.getMinutes();
//var hours = today.getHours();
//var dat = today.getDate();
//var month = today.getMonth();
//var year = today.getFullYear();
//var dayN = today.getDay();
//
var launch_start = new Date(2008, 5, 1);
var launch_end = new Date(2008, 5, 7);
//
var roadshow1_start = new Date(2008, 5, 7);
var roadshow1_end = new Date(2008, 5, 11);
//
var recipe1 = new Date(2008, 5, 11);
//
var myth1 = new Date(2008, 5, 12);
//
var myth2 = new Date(2008, 5, 13);
//
var recipe2 = new Date (2008, 5, 14);
//
var myth3 = new Date(2008, 5, 15);
//
var myth4 = new Date(2008, 5, 16);
//
var roadshow2_start = new Date(2008, 5, 17);
var roadshow2_end = new Date(2008, 5, 22);
//
var myth4 = new Date(2008, 5, 16);
//
var recipea1 = new Date (2008, 5, 22);
//
var myth5 = new Date(2008, 5, 23);
//
var roadshow3_start = new Date(2008, 5, 24);
var roadshow3_end = new Date(2008, 5, 29);
//
var recipe2 = new Date (2008, 5, 29);
//
var myth6 = new Date(2008, 5, 30);
//
var roadshow4_start = new Date(2008, 6, 1);
var roadshow4_end = new Date(2008, 6, 6);
//
var myth7 = new Date(2008, 6, 6);
//
/*var roadshow5_start = new Date(2008, 6, 7);
var roadshow5_end = new Date(2008, 6, 13);*/
//
var onwards = new Date (2008, 6, 6);
//end

//condition for the events, myths & recipes
if ((today >= launch_start)&&(today < launch_end)) {
eventsmovie.gotoAndStop(2);
}
if ((today >= roadshow1_start)&&(today < roacshow1_end)) {
eventsmovie.gotoAndStop(3);
}
if ((today >= roadshow2_start)&&(today < roadshow2_end)) {
eventsmovie.gotoAndStop(4);
}
if ((today >= roadshow3_start)&&(today < roadshow3_end)) {
eventsmovie.gotoAndStop(5);
}
if ((today >= roadshow4_start)&&(today < roadshow4_end)) {
eventsmovie.gotoAndStop(6);
}
/*else if ((today >= roadshow5_start)&&(today < roadshow5_end)) {
eventsmovie.gotoAndStop(7);
}
*/
if ((today == recipe1)||(today == recipea1)||(today == recipe2)||(today == myth1)||(today == myth2)||(today == myth3)||(today == myth4)||(today == myth5)||(today == myth6)||(today == myth7)||(today > onwards)){
frame = random(9)+8;
trace(frame);
eventsmovie.gotoAndStop(frame);
}
Thanks alot!

View Replies !    View Related
Simplify Mc
I have attached the "button mc" I use on my page.
The "button mc" is very complex abd consists of alot of symbols.

Im trying to simplify this Mc.
Can I use hittest and archive the same effect ?
If so, how ? (can't figure it out myself)

View Replies !    View Related
Help Me Simplify This AS
Code:
lunchMenu.lunch1.onRollOver = function() {
lunchMenu.lunch1.gotoAndStop("on");
lunchMenu.lunch1.dishContents.text = "Dish Contents";
}
lunchMenu.lunch1.onRollOut = function() {
lunchMenu.lunch1.gotoAndStop("off");
}
lunchMenu.lunch2.onRollOver = function() {
lunchMenu.lunch2.gotoAndStop("on");
lunchMenu.lunch2.dishContents.text = "Dish Contents";
}
lunchMenu.lunch2.onRollOut = function() {
lunchMenu.lunch2.gotoAndStop("off");
}
lunchMenu.lunch3.onRollOver = function() {
lunchMenu.lunch3.gotoAndStop("on");
lunchMenu.lunch3.dishContents.text = "Dish Contents";
}
lunchMenu.lunch3.onRollOut = function() {
lunchMenu.lunch3.gotoAndStop("off");
}
lunchMenu.lunch4.onRollOver = function() {
lunchMenu.lunch4.gotoAndStop("on");
lunchMenu.lunch4.dishContents.text = "Dish Contents";
}
lunchMenu.lunch4.onRollOut = function() {
lunchMenu.lunch4.gotoAndStop("off");
}
lunchMenu.lunch5.onRollOver = function() {
lunchMenu.lunch5.gotoAndStop("on");
lunchMenu.lunch5.dishContents.text = "Dish Contents";
}
lunchMenu.lunch5.onRollOut = function() {
lunchMenu.lunch5.gotoAndStop("off");
}
lunchMenu.lunch6.onRollOver = function() {
lunchMenu.lunch6.gotoAndStop("on");
lunchMenu.lunch6.dishContents.text = "Dish Contents";
}
lunchMenu.lunch6.onRollOut = function() {
lunchMenu.lunch6.gotoAndStop("off");
}
...and so on.

I know there's a way to simplify this. I've got a lot of menus and a lot of menu items...

THANKS!

-t

View Replies !    View Related
How Can I Simplify All Of These?
ActionScript Code:
manhattanItems.manha1.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point1});}manhattanItems.manha2.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point2});}manhattanItems.manha3.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point3});}manhattanItems.manha4.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point4});}manhattanItems.manha5.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point5});}manhattanItems.manha6.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point6});}manhattanItems.manha7.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point7});}manhattanItems.manha8.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point8});}manhattanItems.manha9.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point9});}manhattanItems.manha10.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point10});}manhattanItems.manha11.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point11});}manhattanItems.manha12.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point12});}manhattanItems.manha13.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point13});}manhattanItems.manha14.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point14});}manhattanItems.manha15.onRelease = function (){    _root.currentItem1.swapDepths (300);    _root.currentItem1.removeMovieClip();    eventResponder({target:point15});}

View Replies !    View Related
Simplify Mc
I have attached the "button mc" I use on my page.
The "button mc" is very complex abd consists of alot of symbols.

Im trying to simplify this Mc.
Can I use hittest and archive the same effect ?
If so, how ? (can't figure it out myself)

View Replies !    View Related
Simplify This... With While?
I think i can make this in to one for loop and with while.. but can't figure it out how.


ActionScript Code:
example.onLoad = function() {
    exmpeltrad.dataProvider = unescape(example)
    for (i=0; i<exmpeltrad.getTreeNodeAt(0).attributes.antal; i++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(0).getTreeNodeAt(i), exmpeltrad.getTreeNodeAt(0).getTreeNodeAt(i).attributes.typ);
    }
    for (b=0; b<exmpeltrad.getTreeNodeAt(1).attributes.antal; b++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(1).getTreeNodeAt(b), exmpeltrad.getTreeNodeAt(1).getTreeNodeAt(b).attributes.typ);
    }
    for (b=0; b<exmpeltrad.getTreeNodeAt(2).attributes.antal; b++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(2).getTreeNodeAt(b), exmpeltrad.getTreeNodeAt(2).getTreeNodeAt(b).attributes.typ);
    }
    for (b=0; b<exmpeltrad.getTreeNodeAt(3).attributes.antal; b++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(3).getTreeNodeAt(b), exmpeltrad.getTreeNodeAt(3).getTreeNodeAt(b).attributes.typ);
    }
    for (b=0; b<exmpeltrad.getTreeNodeAt(4).attributes.antal; b++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(4).getTreeNodeAt(b), exmpeltrad.getTreeNodeAt(4).getTreeNodeAt(b).attributes.typ);
    }
    for (b=0; b<exmpeltrad.getTreeNodeAt(5).attributes.antal; b++) {
        exmpeltrad.setIcon(exmpeltrad.getTreeNodeAt(5).getTreeNodeAt(b), exmpeltrad.getTreeNodeAt(5).getTreeNodeAt(b).attributes.typ);
    }
}

View Replies !    View Related
Simplify This, Function? How?
Basically, i have a few buttons, that toggle back and forth when pressed, and at the same time, make a box get bigger, but just for 2 buttons, it's a lot of code. so i want to simplify and make a single function, but i have no idea how to do this, because the box gets bigger from a movie clip enter frame event. here it is:

http://www.gibsondesign.com/flashExample

thanks everyone for any help at all. you can reply or email me at:

matt@gibsondesign.com

thanks again, matt

View Replies !    View Related
Loop Or Simplify
How can I loop or simplify this code:

on (press) {
if (_root.item_a1 eq "on") {
_root.itembox = _root.itembox + _root.app1 +", ";
}
if (_root.item_a2 eq "on") {
_root.itembox = _root.itembox + _root.app2+", ";
}
if (_root.item_a3 eq "on") {
_root.itembox = _root.itembox + _root.app3+", ";
}
}


thanks.

View Replies !    View Related
Simplify The Scripts
Does there have any way to simplify the scripts below?

Code:
if(Key.getCode()==Key.DOWN){
this._y+=a;
action="1";
}
if(Key.getCode()==Key.UP){
this._y-=a;
action="13";
}
if(Key.getCode()==Key.LEFT){
this._x-=a;
action="9";
}
if(Key.getCode()==Key.RIGHT){
this._x+=a;
action="5";
}

View Replies !    View Related
Help Simplify My Effect
Hi there!
I am trying to make a dotted line that goes from a locked point, to the mouse, and follows it around. I managed to do it writting a script that makes a MC rotate around its 0x 0y position, masks that flip and follows the mouse, etc. etc. So as you can see I have done it but its too jumpy, complex, and it blocks other buttons and MCs. basically its too much just for a simple effect. Messy messy messy.

Can anyone show me how to do it with just action scripts and a dotted line?

I've attached my .swf so you can see what I want.

Thank ya much

View Replies !    View Related
How To Simplify Actionscript
Hi All,

This might be elementary but how can I simplify the following:

I've got labeled buttons- button1, button2, button3..... In the actionscript for the Frame 1, I've basically duplicated this:

button2.onPress = function () {
_global.myVar = 2;
gotoAndPlay (2);
}
country3.onPress = function () {
_global.myVar = 3;
gotoAndPlay (2);
}

Ideally, what I'd like to get it do is take the number of the button and put it into a global variable and then play the frame 2 on my main timeline. I'd just like to understand how to make it more simple.

Thanks in advance.

View Replies !    View Related
[F8] OnChanged - Simplify?
Is there a way to simplify this:

r1_8.onChanged = function() {
this.text = this.text.toLowerCase();
_hint7._visible = false;
Selection.setFocus(r1_9);
};
r1_9.onChanged = function() {
this.text = this.text.toLowerCase();
_hint8._visible = false;
Selection.setFocus(r1_10);
};
r1_10.onChanged = function() {
this.text = this.text.toLowerCase();
_hint9._visible = false;
a1a();
Selection.setFocus(parking);
};
This is used in a word game and I am hoping that there is a way to simplify this rather than having to do this for each individual input textfield as I am having to do now.

Any assistance will be appreciated.

View Replies !    View Related
[F8] How To Simplify This Scrip?
Hi. I've been constructing my action scripts in a laborious way to give actions to each instance of my MCs. They are all named "pictX" (ie. pict1, pict2 etc).

Is there a way to simplify my script below so that it will give the same function to instances name from "pict1" to "pict25" to save me repeating the script for each instance? – I must admit variables are not my strongest attribute .

Thanks !D
stop();
// base to drag function
txtVar = new LoadVars();
txtVar.onLoad = function() {
txtField.html = true;
txtField.htmlText = this.text;
};
titleVar = new LoadVars();
titleVar.onLoad = function() {
titleField.html = true;
titleField.htmlText = this.title;
};
txtVar.load("text/photo.txt");
// start/stop drag and change depth
pict1.frame.border1.onPress = function() {
startDrag(_root.pict1);
_root.pict1.swapDepths(105);
};
pict1.frame.border1.onRelease = function() {
stopDrag();
};
pict2.frame.border1.onPress = function() {
startDrag(_root.pict2);
_root.pict2.swapDepths(105);
};
pict2.frame.border1.onRelease = function() {
stopDrag();
};
pict3.frame.border1.onPress = function() {
startDrag(_root.pict3);
_root.pict3.swapDepths(105);
};
pict3.frame.border1.onRelease = function() {
stopDrag();
};
pict4.frame.border1.onPress = function() {
startDrag(_root.pict4);
_root.pict4.swapDepths(105);
};
pict4.frame.border1.onRelease = function() {
stopDrag();
};
pict5.frame.border1.onPress = function() {
startDrag(_root.pict5);
_root.pict5.swapDepths(105);
};
pict5.frame.border1.onRelease = function() {
stopDrag();
};
// loads external movies
loadMovie("images/image1.jpg", "_root.pict1.frame.Pic");
loadMovie("images/image2.jpg", "_root.pict2.frame.Pic");
loadMovie("images/image3.jpg", "_root.pict3.frame.Pic");
loadMovie("images/image4.jpg", "_root.pict4.frame.Pic");
loadMovie("images/image5.jpg", "_root.pict5.frame.Pic");

View Replies !    View Related
Simplify Hittest
Hi all!
I have some movieclips all of them draggable, with instanceNames :
two_1, two_2, two_3, two_4, two_5
three_1, three_2, three_3, three_4, three_5
five_1, five_2, five_3, five_4, five_5
seven_1, seven_2, seven_3, seven_4, seven_5

I then I have som movieclips , Instancenames:
place_1, place_2, place_3, place_4, place_5, place_6

When I do a hittest I want for example that if five_1 or five_2 or five_3 or five_4 or five_5 hittest place_1
it shal result in score++.
Is there a way to involve all movieclips that begin with Five in the hittest?


What shal I write instead of five_1 to mean anyone of five_1, five_2, five_3, five_4, five_5.

Code:

if (_root.five_1.hitTest(_root.place_1)) {
score++
}
};
I have many of hittests like this so to simplify would mean a lot.

View Replies !    View Related
Help Me To Simplify These Codes
I don't know how to convert normal name which has number at the end into index name.

All my MC instance are created by dragging from the Library into stage and name them manually (e.g. MC1, MC2, MC3...MC22). For any MC that are not within another MC, I can use "this" to make them indexed. Here's my current practice:

for (var i=1; i<22; i++) this["MC"+i].visible = false;


But if the MC is inside another MC, I can't make it like this:
for (var i=1; i<22; i++) ParentMC.this["MC"+i].visible = false;

So whats wrong? If you don't understand my question, please help me simplify these codes into "for loop". These are working codes:


ActionScript Code:
var mySharedObject:SharedObject = SharedObject.getLocal("kurinbox");
mySharedObject.data.name1 = "Anonymous";
mySharedObject.data.name2 = "Anonymous";
mySharedObject.data.name3 = "Anonymous";
mySharedObject.data.name4 = "Anonymous";
mySharedObject.data.name5 = "Anonymous";
mySharedObject.data.name6 = "Anonymous";
mySharedObject.data.name7 = "Anonymous";
mySharedObject.data.name8 = "Anonymous";
mySharedObject.data.name9 = "Anonymous";
mySharedObject.data.name10 = "Anonymous";
mySharedObject.flush();
Menu_Main_MC.hsName1.text = mySharedObject.data.name1;
Menu_Main_MC.hsName2.text = mySharedObject.data.name2;
Menu_Main_MC.hsName3.text = mySharedObject.data.name3;
Menu_Main_MC.hsName4.text = mySharedObject.data.name4;
Menu_Main_MC.hsName5.text = mySharedObject.data.name5;
Menu_Main_MC.hsName6.text = mySharedObject.data.name6;
Menu_Main_MC.hsName7.text = mySharedObject.data.name7;
Menu_Main_MC.hsName8.text = mySharedObject.data.name8;
Menu_Main_MC.hsName9.text = mySharedObject.data.name9;
Menu_Main_MC.hsName10.text = mySharedObject.data.name10;

View Replies !    View Related
Loader Need To Simplify
Hi,

I've got this loader that I want to get the firstFrameBytes.

So that I can add this to any existing project without looking at the bytes at the first frame.

Here's my code:

ActionScript Code:
onClipEvent (load)
{
    total = _parent.getBytesTotal();
    firstframebytes = 390722;       //    bytes amount at first frame, get this value at bandwidth profiler while test movie
}
onClipEvent (enterFrame)
{
    loaded = _parent.getBytesLoaded();
    percent = int((loaded - firstframebytes) / (total - firstframebytes) * 100);
    _root.loade.P = percent + "%";
    gotoAndStop(percent);
    if (loaded == total)
    {
       _parent.gotoAndPlay(2);
    } // end if
}

Thanks,

View Replies !    View Related
Simplify If Statement
how could I write this in a different way? I's very long with the original paths and confusing.

Code:
if (((a>y-range) && (a<y)) || ((a<y+range) && (a>y))) {
a=y;
}else{
a += (y-a)/speed;
}
Happy for any ideas.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved