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




Reduce Script



Can I reduce this script and still achieve the same results--

on (rollOver) {if (_root.pinkys._currentframe==1)
_root.pinkys.gotoAndplay("open");
if (_root.pinky._currentframe==1)
_root.pinky.gotoAndplay("open");
if (_root.ring._currentframe==4)
_root.ring.gotoAndplay("close");
if (_root.rings._currentframe==4)
_root.rings.gotoAndplay("close");
if (_root.middle._currentframe==4)
_root.middle.gotoAndplay("close");
if (_root.middles._currentframe==4)
_root.middles.gotoAndplay("close");
if (_root.pointer._currentframe==4)
_root.pointer.gotoAndplay("close");
if (_root.pointers._currentframe==4)
_root.pointers.gotoAndplay("close");
if (_root.thumb._currentframe==4)
_root.thumb.gotoAndplay("close");
if (_root.thumbs._currentframe==4)
_root.thumbs.gotoAndplay("close");
if (_root.news._currentframe==3)
_root.news.stop();
else _root.news.gotoAndStop("over");}

on (rollOut) {if (_root.pinkys._currentframe==4)
_root.pinkys.gotoAndplay("close");
if (_root.pinky._currentframe==4)
_root.pinky.gotoAndplay("close");
if (_root.news._currentframe==3)
_root.news.stop();
else _root.news.gotoAndStop("off");}

on (release) {if (_root.painting._currentframe==3)
_root.painting.gotoAndPlay("off")
if (_root.photo._currentframe==3)
_root.photo.gotoAndPlay("off")
if (_root.writen._currentframe==3)
_root.writen.gotoAndPlay("off")
if (_root.contact._currentframe==3)
_root.contact.gotoAndPlay("off")
if (_root.news._currentframe==3)
_root.news.stop();
else _root.news.gotoAndplay("down");}

on (release) {if (_root.pinky._currentframe==4)
_root.pinky.gotoAndPlay(5);
if (_root.ring._currentframe==5)
_root.ring.gotoAndplay("close");
if (_root.rings._currentframe==5)
_root.rings.gotoAndplay("close");
if (_root.middle._currentframe==5)
_root.middle.gotoAndplay("close");
if (_root.middles._currentframe==5)
_root.middles.gotoAndplay("close");
if (_root.pointer._currentframe==5)
_root.pointer.gotoAndplay("close");
if (_root.pointers._currentframe==5)
_root.pointers.gotoAndplay("close");
if (_root.thumb._currentframe==5)
_root.thumb.gotoAndplay("close");
if (_root.thumbs._currentframe==5)
_root.thumbs.gotoAndplay("close");}

on (release) {if (_root.port._currentframe==5)
_root.port.stop();
else _root.port.gotoAndplay(2);}

on (release){if (_root.d._alpha ==100) {
_root.controller.gotoAndPlay(2);}}


on (release) {if(_root.pinky._currentframe==4)
temp = 1;
while (Number(temp)<=10) {
current = random(1000);
duplicateMovieClip("_root.spark", "spark" add current, current);
setProperty("/spark" add current, _x, _x);
setProperty("/spark" add current, _y, _y);
set("_root.spark" add current add ":xspeed", Number(random(6)-3)+1);
set("_root.spark" add current add ":yspeed", random(8)*-1);
set("_root.spark" add current add ":zspeed", random(10)-4);
set("_root.spark" add current add ":fade", Number(random(4))+3);
temp = Number(temp)+1;
}
}

Thanks for the help



Ultrashock Forums > Flash > Flash Newbie
Posted on: 2002-09-21


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

[F8] How Do I Reduce Lag?
How can i reduce lag in my game?

you can view it here, http://www.worldfaction.com/games/stickmanwars.php

the next update i am working on now lags even more

my whole game is run on one frame. All the code is on this frame. When I create bullets and enemys i attach them and then create an on enterFrame for it all the blood, heads, and dead bodys have onEnterFrames do but i delete them when they hit the ground.

Reduce Size Of Swf?
WOW I finanally finished my high dynamic menu. I've uploaded the new site and what??? It takes very long before I see something and it is not possible to view the whole site anymore!!!
http://www.sabrinamaes.be

FIRST: is there a possibility to reduce size of swf to download: (It is now 849 sec...and about 3KB. On the start page I have 4 different SWF in four frames

SECOND: if this is not possible I probably have to make a preloader to get all bytes first and put the customer through to the site??? If yes is the answer what is the actionscript to use to sent the customer to the site wich is an htm-page. But even then download time will be to big.

I hope somebody can help
Kind regards
Sabrina

Reduce All This To A Function?
I have all this on a "controller" clip to create a set of 4 variables which continuously fade between random numbers between -250 and 250

onClipEvent (load) {
OldNumR = 250-(random(500)+1);
NewNumR = OldNumR;
OldNumG = 250-(random(500)+1);
NewNumG = OldNumG;
OldNumB = 250-(random(500)+1);
NewNumB = OldNumB;
OldNumA = 250-(random(500)+1);
NewNumA = OldNumA;
}
onClipEvent (enterFrame) {
if (OldNumR<NewNumR) {
OldNumR = OldNumR+1;
} else if (OldNumR>NewNumR) {
OldNumR = OldNumR-1;
} else if (OldNumR == NewNumR) {
OldNumR = NewNumR;
NewNumR = 250-(random(500)+1);
}
}
onClipEvent (enterFrame) {
if (OldNumG<NewNumG) {
OldNumG = OldNumG+1;
} else if (OldNumG>NewNumG) {
OldNumG = OldNumG-1;
} else if (OldNumG == NewNumG) {
OldNumG = NewNumG;
NewNumG = 250-(random(500)+1);
}
}
onClipEvent (enterFrame) {
if (OldNumB<NewNumB) {
OldNumB = OldNumB+1;
} else if (OldNumB>NewNumB) {
OldNumB = OldNumB-1;
} else if (OldNumB == NewNumB) {
OldNumB = NewNumB;
NewNumB = 250-(random(500)+1);
}
}
onClipEvent (enterFrame) {
if (OldNumA<NewNumA) {
OldNumA = OldNumA+1;
} else if (OldNumA>NewNumA) {
OldNumA = OldNumA-1;
} else if (OldNumA == NewNumA) {
OldNumA = NewNumA;
NewNumA = 250-(random(500)+1);
}
}


Then my mc's have this. It feeds those values into the color transform one each for RGB and alpha. The affect is that the mc's fade between random colors continuously.

onClipEvent (enterFrame) {
// Create a color object called myColor for the target myMovie
myColor = new Color(this);
// Create a color transform object called myColorTransfrom using
// the generic Object object
myColorTransform = new Object();
// Set the values for myColorTransform
myColorTransform.ra = 100;
myColorTransform.rb = _parent.Controller.OldNumR;
myColorTransform.ga = 100;
myColorTransform.gb = _parent.Controller.OldNumG;
myColorTransform.ba = 100;
myColorTransform.bb = _parent.Controller.OldNumB;
myColorTransform.aa = 100;
myColorTransform.ab = _parent.Controller.OldNumA;
// Associate the color transform object with the Color object created for myMovie
myColor.setTransform(myColorTransform);
}


I know there are other better ways to do this, in fact I already have another better method. What I was wondering is can anyone show mw how something like this could be reduced to a function to make it smaller and more efficient.
I need to start thinking in functions
thanks
mark

How To Reduce CPU Usage
I have create flash presentation using motion tween it almost take 4000 frame.
When I test the exe file, task manager show me 100 % CPU usage.
Presentation is in flash 5.

How I reduce the CPU usage?

How Do You Reduce DL Time?
I've got a Flash MX file I'm only half way finished producing. As it stands now it will take over 710 seconds to download at 56.6 k per second. Is there a way to reduce the file size just before or after the movie is exported?

Thanks in advance for suggestions....
DJ

Reduce Swf Size?
I've made an animation dim.size 550x400, swf file size 2 mb. Is there any way to reduce this movie, dimension and file size by 50% so that it loads faster on the web or do I have to recreate the entire animation at a smaller dimension?

Need To Reduce FLA Dimensions
I have an fla already built, and I would like to reduce the amount of empty stage space from the top. It seems that by default, changing the pixel size (vertical) adds, and removes from the bottom of the stage.

I dont think I could go through and move every part up on the stage... is there a way to remove size from the top?!?!

Please Help!

Thanks!

Reduce The Size Of SWF
I have just designed a flash movie, I had used no image or sound, only flash objects and shapes.

How can I reduce the size of my exported swf?


regards
Hadi

Swf Size Too Big, Don't Know What To Reduce?
Hey guys,

This is the first time I ever made an website, so I'm quite the beginner! Anyways, when I first started making my website the swf was 22MB, but now I managed to reduce it around 7MB and I don't know what to else to reduce?

Here is my fla file if you guys have any suggestions:

http://www.sendspace.com/file/qj8e9l

thx.

Ways To Reduce Lag
what r some ways to reduce lagging?

Need To Reduce Banner To 30k
I created this banner but the K size is way to high. Don't know how to reduce the size without destroying the design.

**Must select version "Flash Player 6" in the publish settings prior to .swf export**

I also need to insert a clickTAG function for the banner to work properly. I don't know what they mean or how to do it, but here's the code.

on (release) {
getURL(clickTAG,"_blank");
}

Help Reduce CPU Usage
Howdy all, in my fla i've got a centipede (don't know if they're just australian!) and it goes around and collects a thing then gets a new segment, this took me awhile to get this far, anyway when the centipede gets like 20 segments it starts lagging real bad, esp with high speed etc. I'm not quite sure why this is because i've seen files with say 100 or 200 things like this, but my computer doesn't skip a beat. I've tried to correct my script but i don't know whats wrong (ie. gotton rid of infinity for loops and such!). Can u help se if there's anything wrong or maybe i'm just paranoid. Cheers Reuben

Reduce The Volume?
hai firends..

I'm new to this forum.. ok my problme is.. I attached two sound files thru actionscript and gave the linkage name snd1 and snd2. i try to reduce the first sound file volume (snd1).

snd1.setVolume(25);

But the volume set 25 to both sound files. How can I reduce the snd1 sound volume? is this script correct?

How Can I Reduce Swf Size?
I use Kirupa's transition tutorial effect on my webpage. The problem is however, the .swf external files are roughly 1000 kb each, with only one picture and scrollable text. How can I reduce the load time of each file? thanks.

Reduce The Volume?
My problem is... I import two sound files and give the linkage name snd1 and snd2.

In the first key frame I add this

sound1 = new Sound();
sound2 = new Sound();
sound1.attachSound("snd1");
sound2.attachSound("snd2");
sound1.start(0, 5);
sound2.start(0, 5);

And also I create a button for control the sound

Inside the button

on(rollOver){
sound1.setVolume(25);
}

on(rollOut){
sound1.setVolume(100);
}

The correct out put is when I rollover the button… sound1 volume is reduce to 25. but the both sound1 and sound2 volume is reduce…. it reduce the master volume. How it is happen. give me a solution or if u have any deferent way to control it please tell about that….

Can Anyone Help Me Reduce This Code?
Hi.

I'm making a preloader for my site, and its working fine.

I want to shorten this code, but don't know how...

This is the code:
Code:

import mx.transitions.Tween;
import mx.transitions.easing.*;
//
stop();
//
var interval:Number = new Number();
var _loaded:Number = new Number();
//
var _start, _finish:Boolean = false;
var p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21:Boolean = false;
preloader._alpha = 0;
//
interval = setInterval(loading, 100);
//
function loading() {
   if (_start != true) {
      _start = true;
      var tw1:Tween = new Tween(preloader, "_alpha", Strong.easeOut, 0, 100, 100, false);
      var tw2:Tween = new Tween(preloader, "_y", Strong.easeOut, 0-preloader._height, Stage.height/2-preloader._height/2, 100, false);
   }
   _loaded = (getBytesLoaded()/getBytesTotal())*100;
   //
   pieces();
   finish();
}
//
function pieces() {
   if (_loaded>=0 && p1 != true) {
      p1 = true;
      preloader.gotoAndStop(1);
   }
   if (_loaded>=5 && p2 != true) {
      p2 = true;
      preloader.gotoAndStop(2);
   }
   if (_loaded>=10 && p3 != true) {
      p3 = true;
      preloader.gotoAndStop(3);
   }
   if (_loaded>=15 && p4 != true) {
      p4 = true;
      preloader.gotoAndStop(4);
   }
   if (_loaded>=20 && p5 != true) {
      p5 = true;
      preloader.gotoAndStop(5);
   }
   if (_loaded>=25 && p6 != true) {
      p6 = true;
      preloader.gotoAndStop(6);
   }
   if (_loaded>=30 && p7 != true) {
      p7 = true;
      preloader.gotoAndStop(7);
   }
   if (_loaded>=35 && p8 != true) {
      p8 = true;
      preloader.gotoAndStop(8);
   }
   if (_loaded>=40 && p9 != true) {
      p9 = true;
      preloader.gotoAndStop(9);
   }
   if (_loaded>=45 && p10 != true) {
      p10 = true;
      preloader.gotoAndStop(10);
   }
   if (_loaded>=50 && p11 != true) {
      p11 = true;
      preloader.gotoAndStop(11);
   }
   if (_loaded>=55 && p12 != true) {
      p12 = true;
      preloader.gotoAndStop(12);
   }
   if (_loaded>=60 && p13 != true) {
      p13 = true;
      preloader.gotoAndStop(13);
   }
   if (_loaded>=65 && p14 != true) {
      p14 = true;
      preloader.gotoAndStop(14);
   }
   if (_loaded>=70 && p15 != true) {
      p15 = true;
      preloader.gotoAndStop(15);
   }
   if (_loaded>=75 && p16 != true) {
      p16 = true;
      preloader.gotoAndStop(16);
   }
   if (_loaded>=80 && p17 != true) {
      p17 = true;
      preloader.gotoAndStop(17);
   }
   if (_loaded>=85 && p18 != true) {
      p18 = true;
      preloader.gotoAndStop(18);
   }
   if (_loaded>=90 && p19 != true) {
      p19 = true;
      preloader.gotoAndStop(19);
   }
   if (_loaded>=95 && p20 != true) {
      p20 = true;
      preloader.gotoAndStop(20);
   }
   if (_loaded>=99 && p21 != true) {
      p21 = true;
      preloader.gotoAndStop(21);
   }
}
//
function finish() {
   if (_loaded == 100 && _finish != true) {
      _finish = true;
      var tw1:Tween = new Tween(preloader, "_alpha", Strong.easeOut, 100, 0, 100, false);
      var tw2:Tween = new Tween(preloader, "_y", Strong.easeOut, Stage.height/2-preloader._height/2, Stage.height, 100, false);
      tw2.onMotionFinished = function() {
         gotoAndStop(nextScene());
         clearInterval(interval);
      };
   }
}


If anyone has any idea, please, give me some advice.

Thanks for now.

mloncaric

Help Me Reduce This Code...
I know this can be reduced for sure, I would assume with a loop of somesort, I am just not getting the loop thing.

Code:

stop();
//////////////////////////////////////////////////////////
//Set Variables
//////////////////////////////////////////////////////////
//for the x and y of the button position
NAV1x = subnav_mc.b1_mc._x-VVXPOS;
NAV1y = subnav_mc.b1_mc._y-VVYPOS;
NAV2x = subnav_mc.b2_mc._x-VVXPOS;
NAV2y = subnav_mc.b2_mc._y-VVYPOS;
NAV3x = subnav_mc.b3_mc._x-VVXPOS;
NAV3y = subnav_mc.b3_mc._y-VVYPOS;
NAV4x = subnav_mc.b4_mc._x-VVXPOS;
NAV4y = subnav_mc.b4_mc._y-VVYPOS;
//var for the text fields
VVT1 = TEXT_mc.text1_mc;
VVT2 = TEXT_mc.text2_mc;
VVT3 = TEXT_mc.text3_mc;
VVT4 = TEXT_mc.text4_mc;
//var for the x and y of the text fields
VVT1._x = NAV1x;
VVT1._y = NAV1y;
VVT2._x = NAV2x;
VVT2._y = NAV2y;
VVT3._x = NAV3x;
VVT3._y = NAV3y;
VVT4._x = NAV4x;
VVT4._y = NAV4y;
//function to check and see what is open and close it.
function FFcloser() {
   subnav_mc.btnmoreinfo_mc.enabled = true;
   subnav_mc.btnmoreinfo_mc.gotoAndPlay("rollout");
   switch (_global.Vwhichtextisshowing) {
   case "button1" :
      Txstart = NAV1x;
      Tystart = NAV1y;
      Ftweendown(VVT1);
      break;
   case "button2" :
      Txstart = NAV2x;
      Tystart = NAV2y;
      Ftweendown(VVT2);
      break;
   case "button3" :
      Txstart = NAV3x;
      Tystart = NAV3y;
      Ftweendown(VVT3);
      break;
   case "button4" :
      Txstart = NAV4x;
      Tystart = NAV4y;
      Ftweendown(VVT4);
      break;
   }
}
//function to set var's for position of the FTextTween Tween
function FTextTween() {
   _global.Vptextup = true;
   switch (_global.Vpb2) {
   case "button1" :
      Txstart = NAV1x;
      Tystart = NAV1y;
      Ftweenup(VVT1);
      _global.Vwhichtextisshowing = "button1";
      break;
   case "button2" :
      Txstart = NAV2x;
      Tystart = NAV2y;
      Ftweenup(VVT2);
      _global.Vwhichtextisshowing = "button2";
      break;
   case "button3" :
      Txstart = NAV3x;
      Tystart = NAV3y;
      Ftweenup(VVT3);
      _global.Vwhichtextisshowing = "button3";
      break;
   case "button4" :
      Txstart = NAV4x;
      Tystart = NAV4y;
      Ftweenup(VVT4);
      _global.Vwhichtextisshowing = "button4";
      break;
   }
}
//
//
//
//

There is a lot more then that, but if I can get help on how to reduce that then I can fix everything else.

Thanks a lot

Aaron...

How Can I Reduce Swf Size?
I have a fla with aprox.6 mb and when i publish it it is almost 4 mb.How can i reduce to 1 mb or less then 1.5mb?
Thank you for your help
Greetings

How Can I Reduce The Size Of My Webby? Pls Help
Im still a bit of a n00b to all this web design lark so go easy on me
after much trial and error i have finally created my first cool webby (in my humble opinion) However, it is currently around 2megs in size and still not completed.
What is it that takes up all the space?
What is the best file format for my pictures?
What would be the best file format for sounds? (which i hope to add)
Any other tricks i should know about?

Also, there is a link to my old webby on it which is on the same ftp server and folder. as far as i know it shouldnt be preloading this, but even so, will having it all in my folder slow my site down?

Pls take a look at http://www.clan-vatu.cjb.net although if you are on 56k be prepared to wait, maybe 6-8 mins im afraid... :/

There may be a lot i need help with i know but i hope someone out there can give me a pointer or two.

also, if you could tell me what connection you have and how long it took you to open it would be appreciated

thx for you time
lev

How To Reduce Processor Load?
I'm working on a project that uses actionscript to animate a running panoramic view, here: http://www.overtype.com/looper_test7.html

..the problem is that some of the other sections of the site tend to run very slowly because of this...the processor hit seems to be about the same no matter how fast i set the speed of my things...i made a version where the mountains completely stop and the processor hit still seems to be the same...

any suggestions?

How To Reduce File Size? - HELP
Hi,
My movie: http://www.OPRNY.com/Flash/Promo2.html loads very slowly since it is over 12000 KB.

This movie: http://www.StreetFlyers.com loads much quicker since it is only about 1200 KB.

My movie has more tweens and graphics, etc. - how can I make the file size smaller?

Thank you,
Dan

PianoManBillyJoel@yahoo.com

Reduce Movie Size
I have seen a no. of sites for eg The new MercedesBenz - E-class site
where they have used huge no. of high quality big photos. Instead
of that the site downloads very fast.
But in my case the intros where I have to use multiple photos is
always attaining a size of 1mb, which takes considerable amount of time and thus creating a problem for us who have poor internet bandwidth.
Pls. provide solution.

How Can I Reduce This File Size Of This?
hello everyone.

i have a short animation with a few layers, a few keyframes and some tweening.

the file size is 46k and i think that means about 9 seconds to load (?maybe?)

is there any way anyone can see to reduce the file size? with or without significantly altering the animation.

am i being wasteful / could i reuse items to save space. 46k just seems quite a lot!

thanks very much for answering, i appreciate your time.

Reduce Load Time
I have a flash site that uses several different scenes, all but one with the same large background image. My file has become large-1mb (I presume because it has to load the large image for each scene). Is there a way to load the image once and then reference it, or would I have been better off avoiding scenes and just spreading it out over one scene in a long timeline? The site in progress I am referring to is at http://www.blueduckdesigns.com/tribalsun

Thanks for your help

Reduce Stage To Fit Button
Hello, when I create a button, it is sitting on the stage which is much bigger than the button is. When I publish it as HTML, it saves the whole stage background as well. Is there a way to reduce the size of the stage to a button size (or whatever) without knowing the dimensions in advance? If not what would be the best way to go about this?

Thanks

File Size 28 Mg Reduce
How can i reduce the size of this Jukebox program i have done in flash. i worked very hard on it and i finally come to the conclusion that it is all together 28 MG!!!!!!!

How can i reduce this file size? Can i simply take my flash file and put it under some program?

HELP ME PLEAAAAAAAAAAASE!

File Size 28 Mg Reduce Help Me
How can i reduce the size of this Jukebox program i have done in flash. i worked very hard on it and i finally come to the conclusion that it is all together 28 MG!!!!!!!

How can i reduce this file size? Can i simply take my flash file and put it under some program?

HELP ME PLEAAAAAAAAAAASE

How Do You Reduce The SWF File Size?
Hi. I have created several flash files for work and I need to change the file size for publishing. As it is right now the file size is about 1.5 MB for each file and I need to reduce that to 1MB or lower since people are going to be viewing them in HTML.

One thing about these flash files is that each one contains about 100 JPG Images. Hence, I tried to reduce the JPG Quality to 90% in the Publishing Setting and the resulting size was about 600KB! I would stick with this but I need the JPG Quality at 100%. Is there any program, or method that can be used to achieve a file size of >1MB?

On the side note, I would like to make this project streamable but I do not know of any program that would achieve this. If you know any, just post it here

Thanks, I appreciate any replies

Reduce File Size
can yo help me to know about file size of flash?how can we reduce the file size?

Can I Reduce The File Size Any More?
Hi I am wondering if I can reduce my file size any more. It is still pretty high at 285 kb. I have tried a few different things: compressing the file on export in flash, not compressing the export and using software to compress it. Deleting some files within the image library. Is there anything else I can do without loosing to much quality. I need to keep it as a swf file because it is going to be in my website template. If you need any more info or would like to see my original file or the report you can export from flash please let me know. Thanks!

[mx04] Need To Reduce Banner To 30k
I created this banner but the K size is way to high. Don't know how to reduce the size without destroying the design.

**Must select version "Flash Player 6" in the publish settings prior to .swf export**

I also need to insert a clickTAG function for the banner to work properly. I don't know what they mean or how to do it, but here's the code.

on (release) {
getURL(clickTAG,"_blank");
}

Thank you, Thank you.

A Pdf Link That Can Reduce 206 Error
Hello:

I am linking to pdf documents from my flash website using

getURL("file.pdf","_blank");

I've recently reviewed my website's server logs and noticed that this action is generating 206 errors (Files Partially Sent) roughly 30% of the time. What happens is the action pulls up a blank "Action Canceled" screen (I'm using IE 6.0.) I then have to refresh the browser to get the prompt to open/save the pdf document.

Is there anyone out there who knows of a method to fix this problem?

Thanking you in advance,

Mark

Reduce Health Bar Every 5 Seconds
Dear all i need to be able to reduce my health bar every 5 second by say 5 or ten whatever it may be

code for my timer that should help you guys to help me. I have a variable called hp which has a initial value of 100 which as above i want to be able to reduce say every 5 seconds by say 5. Any help guys/girls please

//initial variables
var timing:Boolean = false;
var paused:Boolean = false;
var remaining:Number;
var elapsedTime:Number;
var elapsedHours:Number;
var elapsedM:Number;
var elapsedS:Number;
var elapsedH:Number;
var startTime:Number;
var remaining:Number;
var hours:String;
var minutes:String;
var seconds:String;
var hundredths:String;
_root.play_btn.onPress = function() {
if (!_root.timing) {
if (_root.paused) {
_root.startTime = getTimer()-_root.elapsedTime;
} else {
_root.startTime = getTimer();
}
//start timer
_root.paused = false;
_root.timing = true;
}
};
_root.pause_btn.onPress = function() {
//only pause if the timer is actually going
if (_root.timing) {
_root.timing = false;
_root.paused = true;
}
};
_root.stop_btn.onPress = function() {
//stop the timer
_root.timing = false;
//reset the paused variable
_root.paused = false;
//reset the display textbox
_root.timer_txt = "00:00:00:00";
};
_root.onEnterFrame = function() {
if (timing) {
//calculate values
elapsedTime = getTimer()-startTime;
//hours
elapsedHours = Math.floor(elapsedTime/3600000);
remaining = elapsedTime-(elapsedHours*3600000);
//minutes
elapsedM = Math.floor(remaining/60000);
remaining = remaining-(elapsedM*60000);
//seconds
elapsedS = Math.floor(remaining/1000);
remaining = remaining-(elapsedS*1000);
//hundredths
elapsedH = Math.floor(remaining/10);
//output to text box
//add a 0 on the front of the numbers
//if the number is less than 10
if (elapsedHours<10) {
hours = "0"+elapsedHours.toString();
} else {
hours = elapsedHours.toString();
}
if (elapsedM<10) {
minutes = "0"+elapsedM.toString();
} else {
minutes = elapsedM.toString();
}
if (elapsedS<10) {
seconds = "0"+elapsedS.toString();
} else {
seconds = elapsedS.toString();
}
if (elapsedH<10) {
hundredths = "0"+elapsedH.toString();
} else {
hundredths = elapsedH.toString();
}
_root.timer_txt = hours+":"+minutes+":"+seconds+":"+hundredths;


}
}

CS3 Beginner - How To Reduce Code
Hi there,

I'm fairly new to actionscript, and I'm working to learn some new coding - here is the code I'm using right now for a simple photogallery:

photo0.visible = false;
photo1.visible = false;
photo2.visible = false;
photo3.visible = false;
photo4.visible = false;
photo5.visible = false;
photo6.visible = false;
photo7.visible = false;
photo8.visible = false;
photo9.visible = false;

thumb0.addEventListener(MouseEvent.MOUSE_OUT, thumb0Handler2);
function thumb0Handler2(event:MouseEvent):void {
photo0.visible=false;
}
thumb0.addEventListener(MouseEvent.MOUSE_OVER, thumb0Handler1);
function thumb0Handler1(event:MouseEvent):void {
photo0.visible=true;
}

thumb1.addEventListener(MouseEvent.MOUSE_OUT, thumb1Handler2);
function thumb1Handler2(event:MouseEvent):void {
photo1.visible=false;
}
thumb1.addEventListener(MouseEvent.MOUSE_OVER, thumb1Handler1);
function thumb1Handler1(event:MouseEvent):void {
photo1.visible=true;
}

thumb2.addEventListener(MouseEvent.MOUSE_OUT, thumb2Handler2);
function thumb2Handler2(event:MouseEvent):void {
photo2.visible=false;
}
thumb2.addEventListener(MouseEvent.MOUSE_OVER, thumb2Handler1);
function thumb2Handler1(event:MouseEvent):void {
photo2.visible=true;
}

thumb3.addEventListener(MouseEvent.MOUSE_OUT, thumb3Handler2);
function thumb3Handler2(event:MouseEvent):void {
photo3.visible=false;
}
thum32.addEventListener(MouseEvent.MOUSE_OVER, thumb3Handler1);
function thumb3Handler1(event:MouseEvent):void {
photo3.visible=true;
}

thumb4.addEventListener(MouseEvent.MOUSE_OUT, thumb4Handler2);
function thumb4Handler2(event:MouseEvent):void {
photo4.visible=false;
}
thumb4.addEventListener(MouseEvent.MOUSE_OVER, thumb4Handler1);
function thumb4Handler1(event:MouseEvent):void {
photo4.visible=true;
}

Is there a way to reduce this code as I add more photos? Or a more efficient way to code the whole thing?

Thanks

Cleanup, Reduce # Of Statements
I figure that this code can be reduced with a for statement, but I can't figure it out. Here is my code, and below that is my attempt.

On the stage I have 6 movieclips named nav1_ani, nav2_ani, etc. I also have 6 buttons above them named nav1, nav2, nav3, etc.

Here is my code, here I got #5 and #6 working. Instead of duplicating all this code, is there a way to bunch it all into one "for" statement?


Code:
nav1on = false;
nav2on = false;
nav3on = false;
nav4on = false;
nav5on = false;
nav6on = false;
function clicked(button) {
for (i=1; i<7; i++) {
if (i != button) {
_root["nav"+i+"on"] = false;
_root["nav"+i+"_ani"].gotoAndStop("off");
trace("nav"+i+"on");
}
}
}
nav5.onRollOver = function() {
if (nav5on == false) {
_root.nav5_ani.gotoAndPlay("rollOver");
}
};
nav5.onRollOut = function() {
if (nav5on == false) {
_root.nav5_ani.gotoAndStop("off");
}
};
nav5.onPress = function() {
nav5_ani.gotoAndPlay("on");
nav5on = true;
_root.clicked(5);
};
nav6.onRollOver = function() {
if (nav6on == false) {
_root.nav6_ani.gotoAndPlay("rollOver");
}
};
nav6.onRollOut = function() {
if (nav6on == false) {
_root.nav6_ani.gotoAndStop("off");
}
};
nav6.onPress = function() {
nav6_ani.gotoAndPlay("on");
nav6on = true;
_root.clicked(6);
};
Here is my attempt at a "for" statement:


Code:
onLoad = function () {
for (i=1; i<7; i++) {
k = "nav"+i;
k.onRollOver = function() {
_root[k+"_ani"].gotoAndPlay("rollOver");
};
k.onRollOut = function() {
_root[k+"_ani"].gotoAndStop("off");
};
k.onPress = function() {
_root[k+"_ani"].gotoAndPlay("on");
};
}
};

Reduce Swf Filesize When Using Movies
Hi all

I made a swf (1.1Mb) with a movie in it (filesize 1Mb).
The loading of the file takes relatively long.

What is the best way to reduce the filesize? Do I have to convert the movie, or do I have to take a different way to approach this issue?

Thx for your comments
Regards
Beuvema

How Do Reduce Duplicate Code?
I found myself writing this code ...


Code:

this.onRelease = function():Void {
delete this.onEnterFrame;
// and a bunch of code ehre
}

this.onReleaseOutside = function():Void {
delete this.onEnterFrame;
// and a bunch of code ehre

}
See how the two functions are identical. How can I re-write this so I'm not duplicating (copying and pasting) code?

How Do I Reduce Swf File Size
I actually would nejoy working with flash if I knew how to reduce the size of the swf files I always seem to end up with. Am i doing something wrong or have i forgotten one size reducing application. Kindly help

Reduce File Size
Reduce File Size We can use .fla file but size of the file is heavy, how to reduce .fla file size.

Reduce Loading Time
Alright Lads,
I got a bit of a problem! I am building a website for a local school but the problem is the loading time cos its got alot to it! I have got all text loading externaly when its needed but is there any other way i can reduce it? on 512 it about 20sec -- on 56k it about 3mins

example:- this site loads fast unlike mine

cheers Doodles

Can Someone Help Me Reduce My File Size?
Hey, I just launched JoystickAdventures.com and the first thing most dial up viewers said was that the top banner takes a long time to load on their connections.

Now I've looked over my FLA and for the life of me, can't understand why it would be such a hefty file size.
Could someone help me and try to reduce the filesize?

I have the .fla located in a zip file at:
http://www.joystickadventures.com/topbanner.zip

I hope someone can help me as my site just went Live and I don't want to shun anyone away
If you fix it or find a problem (and fix it) email the fixed file to corway@rogers.com or jonas@joystickadventures.com

Thanks guys.... I will owe anyone who helps me a used napkin or at least a bent fork.

Reduce Gradually A Sound
hi! i'm using a sound in a button on rollover and i want that on rollout the sound volume reduce gradually to zero ...can anyone help me!

Reduce First Frame Size
First of all - is this normal? I've been using flash for a while, but I'm only now really digging down into it.

I have a small movie and my first frame is about 5k, so the preloader doesn't show up until about 30%/40% (testing on low bandwidth).

http://www.dougakins.com/FirstFrame.jpg

All I have in my first frame is my preloader which is all text and shapes (no images, video or anything imported - font is not embeded)

http://www.dougakins.com/Preloader.jpg

Everything I have exported for Actionscript I make sure it's not in the first frame.

Should my first frame be this big and if not how can I get it down?

How To Effectively Reduce A Large Swf
I have asked for help on the macromedia site to no avail... I created a website in flash and the file size is large... so when you go to the site, the fla backgound shows until the movie downloads... it takes about 30 seconds, but thats 30 seconds too long... I have gone through it and reduced the size of my .gif files... I have gone through and removed the tweens and manually created tweens.... that helped, but its still large... is there anything else i can do? Is there a way for me to have a preloader not included in the movie that will allow the movie to download while the preloader works??? Maybe there is a something else I can do that I am not aware of....

Any help would be appreciated!

Thanks

Need To Reduce The Total Space Of My Movie
I have a 200x135 movie hat I need to put into a 200 x 150 table on my website. I have redued the size parameters in the code on the site but when I load it, it still takes up (looks like 400 x 200) too much space and force the text box next to it to squeeze to nothing. You can see it here:

http://web.iwebcenters.com/dga2/index2.ivnu


Any suggestions?

Reduce Alpha Of A Movie Clip
Here's what I'm struggling with for the lack of expertise on actionscript
I want an alpha of my movie clip on stage to gradulally decrease. And I'm trying for that decrease to happen after the other clip on stage is done playing

Here's what I have so far in the last frame of a movie clip after which I want the reduction to begin:

stop();
setProperty("_root.targetclip", _alpha, 35)

It's easy enough to assign a static value to it but how do I make it decrease gradually. I realize it has to be done through setting up a variable earlier on.
Something like

transparency = _alpha;

I'm just not sure what to do with it after...
And also definitely not sure about the syntax of all this.

From helping me out I guarantee that you most definitely will experience sense of humungous self-worth and grandeur.
Which (I heard)is not at all an awfull feeling.

Anywho,
Thanks already!

How To Reduce Memory Lag With Current For Loop?
I have a for in for loop that runs like:
for(x=36; x>0; x--){
for(y=0; y<24; y++){
do something to data;
}
}

that itself is a loop of 36 x 24 and it is using 100% cpu. my pc just freezes there if i'm trying to process information at a higher reception rate. is there anyway of reducing that lag? any idea?

any help is appreciated.

btw...how do i put in a code section in a forum like other messages does in a blue block? instead of just having my for loop like above.

How Can I Reduce Projector File Sizes?
Hello everyone,

The question is:

How can I minimise my projector file sizes?

We are having difficulty getting Flash MX projector file sizes below 800Kb. This is regardless of the size of the Flash.swf file we are creating the projector from.

Any suggestions would be much appreciated.

Thanks

Why Does MX Reduce Imported Graphic's Quality?
I have an image created in Image Composer, and every time I import into Flash, it is much much blurrier than it is in Image Composer. Does anyone know why? Does anyone know how to fix it? It is a text graphic, and there's no way I could create it in Flash. So, what do I do?

Copyright © 2005-08 www.BigResource.com, All rights reserved