ActionScript 2.0 :: Shifting A Sprite Via A Button?

Feb 19, 2007

im currently workin on a game in my spare time and have come across a few problems. I've gone back to basics to figure out a redesign of my code using functions.

Here's my initial problem:

I have a button, which when pressed will shift a sprite 100px to the right. I wanted it so that everytime i pressed the button, the sprite moved a further 100px from it's stopped location. So basically if it's moving and you push the button again, it'll do nothing. It has to be stationary in order to move. At the moment my code shifts the sprite when the button is pressed, but it just keeps moving forever and doesn't stop

[Code]....

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Shifting What MC Is In Front Of The Others?

Apr 25, 2011

I am currently building a commercial website, and am stuck on the functionality of a 'Featured Businesses' animated graphic. The functionality is there, it works, but the problem is, I can't figure out a proper way to make it so that when one button is pressed (that is behind the others on the timeframe), how can I make it so that all the frames/layers (which contain the other buttons) go behind whatever button is activated?

As I said, it works, the problem is that all but the last button (which is the top layer) are obscured from view by the other buttons/MC's that are on top of it as far as the timeline is concerned.!

I tried messing around with the objectdestroy function, but this is my first foray back into ActionScripting since I scripted my last 2D platformer way back in 2005 when I was using Flash MX and before Adobe took control. So I'm rusty.

The link below should contain the .swf of the functional graphic. As you can see it works, but the top buttons are behind the others, so you can't see their animation fully.=

View 1 Replies

IDE :: Shifting Of Movieclip Containing Static Text/same Xy?

Mar 2, 2009

I have an odd situation where the static text each within a mc for a menu are shifting slightly up and down despite having the exact same rounded x/y values throughout on the timeline in the properties box. There are a few frames on the timeline where they are contained within another movieclip to fade them in, and when I zoom in and make sure they line up exactly, they are fine, but when I play the movie back at various magnifications within the authoring environment and as an exported swf, they randomly shift slightly. Sometimes they randomly shift, and other times at the same magnification they don't at all when replayed back again. It's making me pull my hair out and grind my teeth because I don't know if I am dealing with a known bug or (more likely) my ignorance. I know there is a better way of doing this all with action script, but honestly I am not there yet by a long shot, unless someone could direct me to a proper tutorial.

View 5 Replies

ActionScript 3.0 :: Math.floor Vs Bit Shifting Vs Int

Aug 17, 2009

I just ran some tests on round numbers.In preparation for getting max performance from AS3, I want to test as many areas as possible.All I did was generate a rounded random number a million times per frame, and record the time step in milliseconds.[code]Now the strangest part is having a non rounded random number generated a million times per frame netted an average time of 195 milliseconds, faster than using int as a random number. It must simply be that because Math.random isn't returning an integer, some form of conversion of taking place for your variable to be an integer.

Incidentally, using a Number instead of integer for the looping variable decreased performance minimally, just a few milliseconds.So simply having your variable as an integer, and using no rounding at all produces the fastest results if you want a round number.Remember though, there are many other areas in Flash to dramatically increase performance. Being that we're talking about a million iterations per frame, the difference in performance is not exactly dramatic here. One is not even twice as fast as another, over a million iterations.

View 5 Replies

Flash :: IDE - Text Spacing / Shifting In Cs4?

Dec 30, 2009

I am new to the forum, I have used Flash MX 2004 for quite a while and had never had this problem, recently I gave my site a "facelift" in CS4 and I got it exactly how I wanted it, I exported the swf file and saved the flash file. That was a few days ago, Today I wanted to add a new piece to my portfolio so I opened the same exact file today and everything had shifted! SOOOO FRUSTRATING as I felt I had finally achieved what I wanted to. This is the one I was really happy with:

[Code]...

View 3 Replies

ActionScript 2.0 :: Flag Wave Fade In Keeps Shifting

Nov 10, 2008

I've been trying to piece together a way to have an image with a flag wave fade in as soon as the movie loads. Once the image is faded in almost all the way, I want the waving to slow to a stop so at the end, it's a static image. I've gotten most of this accomplished, however, once the flag wave slows and stops, the entire image shifts up and to the right. I'm sure it has something to do with some displacement variable, but since I'm no coder I can't seem to figure out how to stop this.[code]...

View 1 Replies

ActionScript 2.0 :: Toggle All Variable, With Shifting Variables?

Jul 27, 2010

I am dynamically creating a bunch of buttons which each toggle their variable on and off, causing corresponding graphics to hide.I also want to have a toggle All on and off button that affects all the variables.I can't seem to get my head around the best approach to turning all the individual variables on/off when I don't really know what those variables will be yet, cause it will depend on how each version of this gets set up.

View 2 Replies

Media Server :: Dynamic Video Shifting?

Jul 4, 2009

I'm creating a custom video player where the user can select to play the same video at different speeds (100%, 75%, and 50%).We have rendered 3 different MP4 files,one for each speed, and then there is a mechanism in the video player to load each video as the user demands it.It works fine so far, except that when a new video loads,it begins to play from the beginning, not at the point where the previous video left off (which is crucial).

I thought it would be as simple as using either ns.play("videoname", videotime) or using a ns.seek(videotime), but in ether case,the new video still will only play from the beginning.Here is the code, which includes some calculation for adjust the time depending on the shift from 100%, 75%, and 50%.

function switchSpeedVideo() {
var currentTime:Number = ns.time;
output.text = currentTime.toString(); // outputs correctly[code].....

What is missing here?Currently, I am using HTTP connection("HTTP Pseudo Streaming" with Wowza on SimpleCDN).Does this require RTMP?

View 3 Replies

Fonts Shifting In Snow Leopard Flash CS4

Sep 21, 2009

We have noticed Fonts shift down in our layouts. Our files are very messed up. One particular font that is doing this is TheMix. Anyone else have this happening? The same file opens and displays just fine under Leopard.

View 2 Replies

Flash - Regarding Fullscreen Color-shifting Gradient?

Jun 30, 2010

how to set up 2 pre selected colors to tween a gradient to instead of "random" ones. My Goal would be to use this class as a dynamic background creater and i would like to have different gradient backgrounds on different pages.

View 1 Replies

ActionScript 2.0 :: XML Driven Navigation - Shifting Y Position

May 18, 2010

I have a simple xml driven navigation comprising of 8 items. How I could move the items up if clicked e.g if nav item 3 is clicked, 3,4,5,6,7 and 8 move upwards (so that 3 is at a Y position of 0), and nav item 1 and 2 drop to bottom of nav list?

3
4
5
6
7
8
1
2

View 9 Replies

ActionScript 2.0 :: Shifting The Movie Clip To Other Side

Oct 18, 2006

Is there a way of scrolling (shifting) a movie clip so that a part of it continuously shifts to the other side, i.e. when you scroll the movie clip to the left, the portion that scrolled out appears on the right (like a picture on a rotating drum). Of course in AS 2.0

View 7 Replies

ActionScript 3.0 :: Create Drag/drop Shifting Items?

Jan 19, 2010

What would be a good way to create a grid of images in which one can be dragged to a new position and the other images will shift to make room for the image dragged? Looking at making a little program that will reorder an XML file by visually dragging the items to where I want them.

View 0 Replies

ActionScript 3.0 :: Bitmap Palette Shifting Using 2D Lookup Table

Oct 29, 2010

I'm having some problems porting a palette shifted animation system from J2ME to Flash. The system is used within a game that construct characters from separate body parts for e.g. head, left arm, legs, eyes, mouth etc. These can then be tinted and animated. Each of these body parts is coloured using a look up table. There is the original palette, then there are 18 other palettes that can be used to tint the image. This way you can configure different looking characters without having hundreds of different images. Each palette has 398 colours, there are 18 different palettes in total.

Each body part contains a small amount of colours, usually around 10-20. Colour A1, Colour B1 etc... Then the body part can be tinted using another set of colours, for eg Colour A3, B3, C3 etc.. It's simply a 2D array. (I have screenshots that help explain if needed) Now I've been trying to use PaletteMap, without success. I believe it uses a full colour palette (i.e. 255 vals per colour), and can't simply change colour A1 to colour A3 etc.

I also tried threshold, but that doesn't seem to be fit for purpose. getPixel / setPixel is way too slow for my purpose. It needs to be pretty fast as each body part is animated. I have a lot of flash programming experience, but never at such a low level! I might have been using paletteMap / threshold incorrectly, but the adobe docs leave a lot to be desired!

View 0 Replies

ActionScript 3.0 :: Extract Sound From A Video For Pitch Shifting?

Jan 4, 2011

any thoughts on how to extract the audio from a movie? Pitch shifting is do-able to this article:But the code uses the Sound class.I've NO idea how to go about extracting the audio from a movie/FLVPlayback

View 5 Replies

ActionScript 3.0 :: Flash Project / Shifting Objects Simultaneously

Nov 2, 2011

I was given at work. I will list the details of the project below:Create a Flash presentation that a user (on a browser) could press a button and navigate through scrolling objects. Upon hovering over the object information will pop up in a info bubble. Also upon hovering over an object, the table and gauge to the side will also change in proportion to the object hovered over.Here is what I have done so far and what I can't figure out:

-Anchored background - done
-Objects slide across the screen (no interaction) -done --->I just made them motion tweens though which I've found are rather hard to work with becuase I can't manipulate them well with actionscript.
-User able to control the sliding objects (through arrows/keyboard events) - not done
-Table/guage changes on the hovering over of the object - not done
-Information pops up on the hovering over of an object - not done

Right now I am having trouble with making the user be able to make all the objects slide across the screen at the same time with ONE button click. I can make it so that when you click the object it slides over however man pixels, but what i want is that the uder clicks an arrow and all of the objects slide over x amount of pixels.

View 6 Replies

ActionScript 3.0 :: Create A Print Button And A Sprite?

Jul 27, 2009

I'm going wrong with this? I'm trying to create a print button and a sprite, but nothing is showing up when I publish.n what I'm missing? Basically what I'm trying to do is create a coupon that can then be printed.

//_____PRINTING FUNCTION_____
var printContent:Sprite = new Sprite();
var printBtn:PrintBtn;

[code].....

View 1 Replies

ActionScript 3.0 :: Sprite Add A Child As Button Type?

Oct 19, 2009

I have used AS2 for a while but the movie gets very slow when thousands of objects on the stage. I would like to turn to AS3 for better performance. My basic symbol is a MC consists of a button and a text field. Can I change it from Movie Clip to Sprite? I read a document that says "Sprites serve as containers that can be filled with shapes, images or text. "... Could someone tell me if the Sprite can also be the container for button?

View 8 Replies

ActionScript 3.0 :: Video Container And Sprite(button)?

Apr 4, 2007

Am I missing something or it is just flash? Well I have a PlayerVideo which extends Sprite and have 3 children:1. flash.media.Video2. flash.display.Sprite as PlayPause button3. flash.display.Sprite as MuteUnmute buttonThe thing is that when I have video attached to PlayerVideo, button mouse events are not working, when not Sprite buttons are working okHave anybody ever had something similar ? Mybee some workaround?I have tried wrap with MovieClips and Sprites, but it is the same effect,

View 2 Replies

ActionScript 3.0 :: Custom Button Extends Sprite?

Feb 15, 2009

I am writing a class button that extends Sprite. I use graphic fill to draw button and then use addEventListener to add Tween to MouseOver event. Problem is:

1) If I use MOUSE_OVER event, the tween became sometimes corrupt when Mouse is INSIDE the button.

2)If I use ROLL_Over event, the tween became sometimes corrupt when Mouse is NEAR the button BUT ok WHEN mouse is far enough.

View 1 Replies

Professional :: CS5 Bug: Symbol Rotation Points Shifting With Long Timelines

May 16, 2010

I have come across a large, and very annoying bug in CS5. When animating with the same symbols over a long and complicated timeline, the rotation points of symbols earlier in the timeline begin to shift around very slightly. The more you work on the flash, the more they shift, so things that you did right at the start will begin to wobble around all over the place once your timeline gets very big. This is because, as we all know, when you tamper with a tweened symbol's rotation point, the symbol moves out of place while tweening.
 
This has completely ruined a large project I was working on that I began in CS4.
 
I am using a Mac Pro running 10.6.3

View 4 Replies

ActionScript 3.0 :: Create Most Efficient Fullscreen Color-shifting Gradient?

Oct 12, 2009

For a project I'm working on I'm trying to create a Flash file with a constantly color-shifting gradient that fills up the entire browser window. For a better explanation please see the following link:

View the Example

Don't worry about the moving balls, those are just there to challenge the frameRate of the movie, which has a maximum of 60. If you look at the background you can see the gradient effect I'm referring to.

The method I'm currently using to create the gradient animation is a simple shape tween on the Flash timeline that tweens between shapes with different gradient colors. I'm definitely not achieving the performance I want using this technique.

I've also tried creating a static gradient and shifting its color over time using ColorTransform, but this doesn't offer any better performance.

So that's a long-winded way of asking what people think would be a better way to create such a color-shifting gradient while getting better performance? Some examples might be through bitmapData or using PixelBender, but I'm not versed enough in these techniques to know which would get me the best performance.

View 2 Replies

ActionScript 2.0 :: OSX Browsers - Action Scripted Tweening And Contents Shifting

May 31, 2007

using any browser on OSX, encountered an issue with action scripted tweening(through math formulas not tweening functions) and contents shifting when a window was opened or dragged over it? It's difficult to explain but easy to replicate. This is a template site... Again, only Mac OSX users. For once OSX has a browser problem with flash and all PC browsers work fine.

Let the page load and on the start section where the images are connected by lines, pull any window over it and click back to the template window, I mean any finder window, browser window, and app window, it doesnt matter the contents all dissappear and come back in 5-7 seconds.

View 1 Replies

ActionScript 1/2 :: Make A Button Load A Sprite From Library?

Jun 30, 2011

I am trying to create a newspaper that consists of four pages. Each page i have created and are sitting in the library as sprites. Each page  has buttons that need linking so that when pressed it loads the next page or page that i want. This is the part i am confused with =/ how do i make the buttons on each page load the next page (sprite) from the library? Basically i want to no how to make a button load a sprite from the library when clicked. Does anyone no the script for this?

View 5 Replies

ActionScript 3.0 :: Sprite Button Not Toggling Sound Volume?

Jul 21, 2010

This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.

1 - This button is a mute. � Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)


2 - The toggle button itself � I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?

ActionScript Code:
var btmUpURL:String = "a_icn-1.png";
var btnDwnURL:String = "a_icn-0.png";
var btnLoader1:Loader = new Loader();
var btnLoader0:Loader = new Loader();

[code].....

View 9 Replies

ActionScript 3.0 :: Flash Sprite Button Not Toggling Sound Volume?

Jul 21, 2010

This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.

1 - This button is a mute.

� Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)

2 - The toggle button itself� I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?

[code]....

View 1 Replies

ActionScript 2.0 :: Translate A String From A Textbox By Shifting Each Letter (excluding Vowels) Up A Character?

Jan 18, 2006

Im trying to translate a string from a textbox by shifting each letter (excluding vowels) up a character. For example, B changes to C, C changes to D, D changes to E, etc.[code].....

View 3 Replies

Actionscript 3 :: Class Extending Sprite - Set The Sprite's Width And Height Properties?

Mar 5, 2010

I created a class, extended the sprite class, and now in the constructor I am trying to set the Sprite's width and height properties which are inherited from the DisplayObject. However, after I set this.width and this.height, and print the values, I get 0 for both.

What the heck is going on? When I view the livedocs I see that DisplayObject has width and height listed as public properties. I have been able to instantiate a Sprite directly, and set the width and height after it's been instantiated, so I don't get it.

package {
import flash.display.*;
public class ScrollBar extends Sprite {[code].....

View 1 Replies

Flash: `sprite.visible = False` Doesn't Hide Sprite Immediately?

Apr 4, 2011

I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:

[Code]...

View 1 Replies

IDE :: Adding A Single Sprite On Main Moviclip Sprite Remains Invisible

Mar 2, 2009

I created a new AS3 document (550px by 400px) and added the following code to the first frame.

However, when I run this, I see nothing painted on the screen at all, the screen remains completely white.[code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved