ActionScript 2.0 :: Make These Script Shorter?
Mar 16, 2005I am facing the proble of lagging because of abundant of script.
[Code]...
I am facing the proble of lagging because of abundant of script.
[Code]...
I am facing the proble of lagging because of abundant of script.
Exaple 1:
if(_global.i==5){
_root.shoot5();
[code]....
I am working on a flash site where I want the buttons to animate on Rollover and reverse animation on Rollout. Here is the code I am using at the moment.
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
This works fine but I would like to go one further. Is there a way for me to make the Rollout animation shorter?
So if the button animation is 60 frames long can the Rollout animation occur from say frame 30 on Rollout? The play head needs to jump to frame 30 on Rollout and I have no idea how.
Of course if the playhead is only on frame 20 then on Rollout the animation will reverse from frame 20. (not from frame 30).
This way the Rollover animation will be the focus and the Rollout is...well simply a Rollout animation. Short and sharp.
Right now my stage dimensions are 980 X 800 px. I need to cut or "crop out" the bottom portion of the footer because its height is too long. So I changed the stage dimensions to 980 X 600 px (and changed the corresponding dimensions in the embed tag in the index.html file to match). Doing this seems to cut out the bottom but at the same time adds space to the top and seems to distort the overall spacing. Is there a simple way to crop out the bottom of the stage (just like cropping out a section of a photo)?
View 5 RepliesIs there a shorter way to write this out?
ActionScript Code:
var bytes:ByteArray = new ByteArray;
bytes.writeByte(0x53);
[code].....
I am using a tweener class in AS3 and looking for a way to shorten this script , any suggestions?
p1._x = 600
p1._y = 550
p2._x = 600
[code].....
I have 16 tweens happening at the same time which I've done using actionscript. Its basically the same thing happening 16 times with slight changes to coordinates and mc names in each tween.
Is there a way of creating an array with a list of mc names which can just be dropped in to a template? Below in my code:
[Code]...
I have 10 or 100 or 1000 mc's on stage that do exactly the same on an onRollOver event and on an onRollOut event, what's the easiest way of writing this ? let's assume that the mc's are called mc1 to mc100, could it be done with an array and/or for statement ? Cause I'm used to old fashioned coding, I'm used not to try to cut corners So it kind of restricts my thinking a bit at times. So, do I need to start with an onRollOver event handler for each button in order to make Flash notice the onRollOver event for each button ?
View 1 RepliesI have a dataGrid with a custom itemRenderer. Everytime I tab at least two times on the dataGrid, the cell below the one I taped gets selected. This doesn't happen if I uncomment the code in the method saveBackDataGridContent().The second problem is that if the Line is shorter than the entered text, a horizontalScrollBar will get active, although I set setStyle("horizontalScrollPolicy", "off");...
CustomRenderer.mxml:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="dataService.send()">
<mx:Script>[code]...........
I am trying to convert the longer code i have below into shorter codes, the codes that i have is for Actionscript 2, while i am using as2 debugger, trace(), its getting the loop, however it will not recognize that is a movieclip (button1 - button3 are 3 different movie clips that i assigned).
[CODE]...
i want to make the character in my flash game make a jump when the player presses a key,e.g. 'space',even the player release the key instantly,the character will still finish the complete jump process.
View 1 Replieshow to stop the script when it's running.To make the sky no more snowy and make snow disappear.
View 1 RepliesIs it possible to make flash mx to take the time on the system and make it run a determined frame. I want to make a clock that shows the real time. How can I do it?
View 8 RepliesI followed the bit101 tutorial on gravity and now have a movie clip called "ball" (instance name) with an embedded invisible button (so you can throw it all over the place).I also have a movie clip called "block1" (instance name too! what a coincidence, isn't life lovely). I want to make them collide, and make the ball bounce away.
View 1 Repliesthis is my code for photogallery.there will be 61 images loaded in this array.how can i make an AUTO button which will make a slideshow,showing all the images in array?
arrayrow = new Array()
arrayrow=[
["00.jpg","0","sajkad","hjsgadhj"],[code].....
How can i make a combination of keys make a movie clip visible? Basically i want something like this to work:
if(Key.isDown(Key.Alt && Key.A)){
reminder._visible = true;
}
So when someone presses the Alt and A keys down at the same time the 'reminder' mc becomes visible?
Im have an flv playing on my stage. I want to make a mute button for the video that can instantly make the volume 0 or 100 depending on what it is.So i have tried using this code:
ActionScript Code:
m.onPress = function() {
[code]........However, it doesn't seem to work.
I need to make the background image move opposite the cursor to make it seem like the camera is moving.[URL]
View 1 RepliesI'm trying to make a preloader for a little flash project that involves re-assembling a load of rectangles to make up a pattern.Idea is that instead of the usual load bar i wanted to make use of this pattern that is relevant to the project and have it rebuild it self with these rectangles flying in from the side. So far I have got the tweening sorted using the tween class and staggered the 42 (yes took a little while, probably an easier way so let me know on that also) rectangles using 'setTimeout' so it releases each 100milliseconds after the one one before it. This probably the wrong way to do it but i wanted to check how it looked and this was the one way i knew how to do it.
I want to make it so that these rectangles fly in a complete the pattern once the loading has finished, but on a fast connection I don't want it to rush the animation but for a slow connection I obviously want it to adjust the release time and maybe even the travel speed to compensate.
I had an idea of maybe working out the percentage loaded divided by 42 and then run an if statement to see if that percentage for that segment had been reached before 100millseconds had passed, if 100 had passed then release the rectangle, if not then hold the rectangle until 100 m/s had passed. Not sure if that is the best way to do but that's why I'm looking for some suggestions from more experienced developers.
Code:
import mx.transitions.Tween;
import mx.transitions.easing.Regular;
// declare variables
[code]....
I have a map of the US and each state has a rollover that changes the color of the state...what i am trying to figure out is how to click on the state and have text appear to the side of the US map and have that text stay up until the user clicks on another state.
View 16 RepliesI am trying to make a program that dermines if sides can make a right triangle. The code that I made gives me that it cannot for everything except the sequence 3,4,5.
'Paul Bursu'
'July 08 11'
'To determine if inputted angles can make a triangle'
[Code]....
I saw the snow tutorial on this website and i plan on using it for 20 seconds (500 frames) in my introduction. It works perfectly fine, but after that time, it doesn't stop. It keeps on going and going and going... how to make it stop or make it go into the background? used the code provided by the tutorial. I know this is sudden by can someone answer today because i have to put it together before thursday.
View 1 Replies* I have a flash project called contact
* The document class is ContactClass
I am trying to make a sprite button with graphics and can't make it work. I have successfully added text fields so I know the path is correct. I suspected my code was correct and confirmed it should be, after reading several tutorials showing the process for creating sprite buttons with graphics. Anyway, I imported nearly every class on Earth, but certainly everything which needs to be. Stage is gray and 800x600.The graphics code by itself with appear, but not when linked to the sprite. Also, the sprite won't appear no matter what. Another interesting piece of the puzzle: nothing will trace, not even objects such as textfields which actually appear and function on the stage when I text the code.
public class ContactClass extends Sprite {
public function ContactClass() {
var home_btn:Sprite = new Sprite();[code]....
I was just curious if an array can make itself.ie, I want an array to be [1,1,1,1,1,1,1,1,1] that sounds silly but there is a reason for it.So without having to say 1,1,1,1,1 dozens of times is it possible to just have some variables, 1, and 100, and have the array make 1, 100 times?or have while (array length = = 100? array = 1?
View 1 RepliesI want to make a "module" composed by an image and a text and make this clickable, how could I made this in AS? PS: to create the text I'm using the TextField(), what I have to use to make the image from a url?
View 1 RepliesI would like to make a screensaver with posibilitys to make notes like 3M post-it notes, the flash file should "remeber" the input that the user writes. I have the tools to make screensaver in Flash, but how to make such a flash file?
View 3 RepliesI would like to make a screensaver with posibilitys to make notes like 3M post-it notes, the flash file should "remeber" the input that the user writes. Is this possibel
I have the tools to make screensaver in Flash, but how to make such a flash file.
make a circle object movie clip call ball and make a rectangle object movie clip call mc and paste this coding.
[Code]...
can anyone explain about the movement about D? the D is talk about the distance if i go -X,way my ball go ++ to +x?
Is it possible for an end user to play with a swf, change layout, colours, etc... and then save it? Either as a new swf or the same one. Maybe push all the customizable data to a PHP or XML file and then every time you load that swf it retrieves that data from the PHP or XML file, therefore retaining the settings saved by the user.
View 2 RepliesHow can I make my movies less laggy? so they run smoother and require less of the video card? Take this for example: [URL]..
I realize the frame is massive. but it's like three movie clips and i don't understand how people can develop such satisfying images without it lagging, and why mine are sooo dang slow.