ActionScript 3.0 :: Image (a Soccerball) To Bounce Around The Screen Diagonally?
Feb 5, 2011
After successfully embedding a *.gif image and resizing it (pretty spesh i know), I decided I wanted the image (a soccerball) to bounce around the screen diagonally, continuously, much like the way the old screensavers used to do.
for the ball movement i have used four seperate
addEventListener(Event.ENTER_FRAME, event#);
calls for each of the four possible diagonal movements I wanted for my ball; those being: downright, downleft, upright, upleft (for want of a better description)and I used if statements to change the diagonal movement of the ball when it hits the edge/edges of the screen;i.e.
Code:
if (image.hitTestPoint(x#, y#, true)){
removeEventListener(Event.ENTER_FRAME, currentevent#);
addEventListener(Event.ENTER_FRAME, newevent#);[code].....
and this works well for about 30 seconds and I can see the ball can bounce diagonally in each of the four directions, after which time the ball decides to move straight down, straight left, continue diagonally for a time, and then straight for a few seconds then come to rest on the left side of the screen near the bottom.And it doesn't necessarily happen when the ball hits directly in the corner of the screen, (I have tested it using various starting positions).
View 8 Replies
Similar Posts:
Oct 24, 2002
I want to make a box come from off screen then bounce back and forth and then come settled down in the middle of the screen. It can be random bouning intervels or a set amount.
View 6 Replies
Feb 13, 2011
So I am trying to get a ball to move around the screen, and when it gets to the walls of the stage I want it to change directions. So far, I have this code:
Code:
import flash.events.Event;
var ballVelx:Number = Math.random() * 15;
var ballVely:Number = Math.random() * 15;
var ballDirx:Number = 1;
[Code].....
This is not in the main timeline, it is in the symbol timeline for Ball. With this, I have the ball moving around and when it reaches the end of the stage it resets with a random velocity/angle. When I uncomment the ballDirx and ballDiry lines and comment out the this.x = 0 line, the ball doesn't change directions, it just stops moving when it reaches the end of the stage.
View 6 Replies
Nov 7, 2002
im working on en site that needs a bouncie image, but all the tuts and movie clip i can find only work with onmouseover effect.. i dont want onmouseover but bounce when the clip loads. maybe someone can rearange this script so it bouces on clipload... this in the 1st frame:
[Code]....
View 12 Replies
Apr 19, 2005
I need a dynamic textbox that is scewed diagonally, but when I free-transform a dynamic textbox to the desired shape, it doesnt even get exported. Similar thing happens with the TextArea-component.
View 1 Replies
Apr 19, 2005
I need a dynamic textbox that is scewed diagonally, but when I free-transform a dynamic textbox to the desired shape, it doesnt even get exported. Similar thing happens with the TextArea-component.
View 1 Replies
Apr 22, 2009
Anyway to align my grid to this way? I've also attached my fla files in cs3 format..
View 2 Replies
Mar 30, 2011
I'm trying to create the following component: Just for information, the blank space will contain a text control, and I'm creating a component that represents the black corner with the (i) icon and the "promotion" text. The part I'm having issues with is this component representing the black corner with the diagonal text. The text has to be able to hold 2 lines. And the black corner has to be able to adjust to the text's size. What's more, the text has a rotation... I'm having some doubts on how to do this:
Should I have different controls for each text line? Should I draw the text in the shape (after doing the rotation) or should I just overlap both components? [When I talk about drawing the text in the shape, I mean in the same way as asked in this question] Is there any way to get the proper size of the triangle shape without doing some extravagant calculations?
[Code].....
View 2 Replies
Mar 25, 2005
i've done the fading grid tutorial at: [URL], but i was wondering if someone knew how to make the grid fade in diagonally from the left or right top corners (or bottom corners too) like this site [URL] i also have another question with the fading grid, does anyone know how to make the grid fade in from random spots on the movie clip instead of the left to right, up to down, etc. way?? i'd really like to see that effect happen, if possible.
View 9 Replies
May 7, 2005
I'm trying to get the characters in this Flash game to move diagonally - it works, but the following occurs: The character is walking twice as fast as it does when going left, right, up, downThe walking animation doesn't play PHP Code:
[Code]...
View 11 Replies
Jan 14, 2010
i have a set of images which i've converted to mcs and have given them all different instance names. The first image motion tweens to the right of the screen via actionscript and then the next one will motion tween from the bottom of the screen to the top and then the image after that will go to the right of the screen and next one goes to to the top, and so on. I have this actionscript for the first image,
[Code]...
I need the next image to start motion tweeing up to the top of the screen right when the first image starts fading out. Then when the second images starts fading out the next image is already motion tweening to the right of the screen and so on. Once every image has run through its tween everything repeats. Is there any way of doing this?
View 3 Replies
Jun 11, 2010
there any way to use "no scale" and "fit to screen" in same file. Just like this website [URL] here image large as per ur screen but txt no change there position and size
View 2 Replies
Nov 23, 2009
Code:
stop();
var imagearr:Array = new Array();
[code].....
View 1 Replies
Apr 7, 2010
I'm trying to create a website with full screen background images (or possibly, a video) but don't know the best way to approach it. The Die Antwoord site does pretty much what I'm trying to accomplish. I'd also like to know how they can use such high resolution images. If I try to use a high res image, the file size is enormous.I also want to do is to be able to change the background image when a button is clicked. What is the best way to do that with large images? Another site that uses similar technology only with a video is the TV on the Radio site.
View 3 Replies
Nov 13, 2009
i had a xml wich is dynamically genrate the values, and i use those value to show as a image in flash as2.now the values are n numbers, if it is beyound the screen i want to resize the whole image in to best fit on my screen.
View 8 Replies
Sep 16, 2010
Is it possible to keep an image at a static location on the screen when the page is scrolled down?
For instance, if I have a .swf with properties of 1700 px height and I am displaying an image (jpg) in a loader whose y position is 40px from the top of the screen when viewed in a browser.
is it possible to "float" that image so that it stays 40px from the top of the browser window when the user scrolls down to see the rest of the page?
I'm trying to set up a gallery and have a grid of thumbs displayed, each of which open a full-sized copy of the image on the thumb.
The thumbnails go beyond the bottom of the screen and when I scroll down to see more thumbs, if a large image is displayed at the time, it scrolls off the top of the screen.
View 4 Replies
Apr 15, 2010
I have imported to the library two images and have given them the custom class names MaskImage and MaskedImage.[code]...
View 1 Replies
Jun 10, 2010
I load many images simultaneously with different Loader class. When loaded I add content of loaders to the movieclips which are child of some other movieclip which is child other... I check that images are loaded addChild method is called, but loaded images cannot be seen on the screen.
Actually, sometimes images can be seen, but sometimes cannot be seen.
Do I need to rerender some DisplayObject? Something similar...
View 1 Replies
Jan 22, 2012
Unable to correctly perform the simplest task - fit image to screen. Pictures loads from the gallery, it is displays, but having tried many ways to understand that there are some oddities.I use Flex ViewNavigatorApplication without ActionBar and full screen. Landscape screen orientation. The best option to accommodate the maximum size of image. All images have a size equal proportions of 3264 x 2448.
Do this:
protected var roll:CameraRoll;
protected var loader:Loader;
if(CameraRoll.supportsBrowseForImage && !roll)[code]............
View 1 Replies
Apr 15, 2010
Is it possible to memorize the image of each screen and print all the images at the end of the session if the user clicks a "print" button ?
View 2 Replies
Apr 15, 2009
I'm trying to create a website similar to this one, where the content is a fixed width and height (i.e. made to fit a 1024x768 screen), but the background image is full screen and scales proportionally when the window is resized.
How can I achieve this full screen background using Flash CS4/AS3?
View 5 Replies
May 11, 2005
I saw this fantastic site1)How did they get the whole image to take up my moniter size?1a) Is it Flash on top of Javascript?2) How did they get the content on top of the HUGE image?
View 1 Replies
Dec 9, 2008
I'm wondering if there is an action script under 1.0 or 2.0 (sorry still trying to learn everything with 3.0) that will allow me to simulate having an image roll out as if it were unrolling on your screen.
View 1 Replies
Apr 8, 2009
I found a tutorial online to do a Image Slideshow. [URL]. But, I can not get anything to work. I am new to this and unfortunately do not have time to do any formal training right now. Probably when this project is done. When I "test movie" I just get a white screen w/ nothing on it. I should be getting a box 500x500 w/ a box that is 400x400 for my frame. I just finished step 3, and I do not get my frame box like a should.
Here is what my .xml document says:
<slideshow width="400" height="400" speed="5">
<image url="images/1.jpg" />
<image url="images/2.jpg" />
<image url="images/3.jpg" /> .....
And here is the action script.
var myShowXML = new XML();
myShowXML.ingoreWhite = true;
myShowXML.load("slideshow.xml");
myShowXML.onLoad = function() {
[Code] .....
View 15 Replies
Jan 5, 2012
Simple question, pretty new to action script and not too sure which would be the best way of implementing this, but how would you scroll through an image if it is bigger than the screen. What I am thinking right now is simply dragging and dropping the image but that doesn't seem like the best solution.
View 1 Replies
Jul 16, 2010
Is there a way to Get the print screen image from the keyboard. Say for example I had a image hosting site and wanted a feature where users could paste in an image and simply host it that way. would that be possible? EDIT: Would it be possible with some sort of third party plugin? Are there any existing Firefox plugins which do something similar?
View 6 Replies
Aug 23, 2011
when i run the image, it only appear in center with 2 blank white space in between.
<s:Image x="0" y="0" height="100%" width="100%" source="@Embed('assets/d.jpg')"/>
How can i make an image goes full screen (covering up the whole screen) with double tap/touch on mobile app?
And if possible how to turn it back to non-full screen (back to normal)?
View 2 Replies
Jan 10, 2009
I know how to make an image full screen, also with a onresize listener. But! Because some of the images are only of a certain pixel size, I don't want to stretch them above that.So, do any of you know how to set limitations? The code I am using is:
tree_mcHeight = new Object ();
tree_mcHeight = tree_mc._height / tree_mc._width;
tree_mcWidth = new Object ();[code].......
It would be nice to change the background colour surrounding the image when it resizes as much as possible.
View 2 Replies
Dec 14, 2009
I have a variety of jpg files I wish to have as a background for my Flash web site, every time the page loads it could load any of the 65 files for example. I have created a MC for them to playback within, how can i use action script to select one of the files located in a folder at root and play it?I currently use:
choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
[code]....
View 2 Replies
Mar 4, 2011
How can I place an image to green screen in flv dynamically?
View 1 Replies