ActionScript 3.0 :: Simulate Gravitational Acceleration By Constructing Function
Aug 9, 2010
Code:
package {
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class Player extends MovieClip {
spawn();
[Code] .....
I'm trying to simulate gravitational acceleration by constructing a function that will subtract from the Player object's yVelocity every half a second. For now, I'm getting 1180: Call to a possibly undefined function spawn but I'm sure there are other things wrong with the code.
I've been trying to create a new class of vehicle and simulate a somewhat realistic acceleration/velocity relationship and behavior but with no success. At least, I can't figure out how to do what I want to do.
Which is this:I have a vehicle with a maxVelocity and an initialAcceleration properties, and what I want to find out is how to express the vehicle's acceleration with the two above mentioned variables so that the vehicle stops accelerating when it reaches its maxVelocity (meaning that acceleration reaches 0).
I believe there are some serious maths going on behind this seemingly simple thing, at least too serious for me, and I tried to remember what I learned years ago about arithmetic progressions and stuff like that but to no result other than a headache.
Does someone know how to do it, if it's actually possible. And if not, how you guys do to simulate an acceleration that looks like a car's gear.
I am making an interactive diagram showing how the moon creates tides. Imagine a circle in the center (earth) and a smaller circle orbiting around it (moon). Currently, the user can click on the moon and drag it around the earth in a circular orbit. That part works great. How can I manipulate a circular shape (water on earth) depending on the position of the moon? Here's a link to the basics of how tides work, and what the shape of the water should roughly be. [URL].
I have a number of instances of the same movie in a frame. I have named all this instances using the form: movieclipname1, movieclipname2... movieclipnameN.I want to control everyone of them so i have to reference everyone of them using it's own name.Is it possible to use a loop where I will constructing the name of each movie ?[code]
I have a number of instances of the same movie in a frame. I have named all this instances using the form : movieclipname1,movieclipname2...movieclipnameN I want to control everyone of them so i have to reference everyone of them using it's own name. Is it possible to use a loop where I will constructing the name of each movie ? for example:
for (i=1; i++) { with (movieclipname+1) { play(); } }
I am trying to construct an equilateral triangle with the following code, but I am not seeing what I would expect to. I would expect to see a triangle drawn to the stage, but I don't see one. I think there must be something wrong in terms of the location of the tri sprite on the screen.
[Code]...
UPDATE: I can now see the triangle but it is not filled in. It seems to have the generally-correct shape, but I would expect for it be 3 sided, rather than 4.
I am looking at the creation of a quiz using the Learning Interactions in Flash.I noticed that when I place say a Multiple Choice question on the stage that the area which says 'Question will appear here' is a dynamic text field.This renders the final text bitmapped. Is there any way of getting the text to look like smooth like the rest of my work?I have tried to anti alias it for Animation and Readability but it doesn't change.nd in all honesty set against the rest of my work the text looks crap.
I'm working for a company who is using flash to play HD media. Right now, the systems they are having to buy to play the media conent must have relatively decent CPUs in them due to flash relying mostly on the CPU. With the flash 10.1 beta there is now obviously a focus on GPU acceleration and we are quite excited about this as it could considerably drop the cost of each of our hardware units. We have tried some tests thus far however it appears that our flvs are not taking advantage of the GPU acceleration. The only way I know how to test this is by enabling/disabling the hardware acceleration from the settings menu in flash and then restart the browser to be sure the setting has changed.
I am assuming that our flv is perhaps not encoded in a format that flash will be able to use hardware acceleration for however I am not completely sure of this. The media encoding is not part of my job on this project howeve I am tasked with the testing of the flv's on carious hardware. Is there a specific codec that needs to be used or a way of encoding the flv so that flash player 10.1 beta can play the video with hardware acceleration?
I don't know the ins and outs of the encoding process that is currrently being used, but I will pass any infomation gathered here onto our media guys and developers. I do know that using the flash 10.1 beta on youtube I can play 1080p videos fullscreen using nVidia GPU and an intel atom cpu without any issues with the hardware acceleration on. WIthout it, the cpu hits 90+% and the video is way to choppy to be of use so hardware acceleration is definitely working there.
For a maze game, I'm trying to add acceleration to the movement of my character.Because the character shouldn't walk through walls, the movement function and hittest are in the same function.
I tried adding the acceleration in if statements in this function, but that doesn't work properly. [code]...
Is it possible to disable hardware acceleration with actionscript something likehardwareAcceleration.enabled = falseOn some computers and particular browsers the video in my flash app wouldn't show properly displaying only green screen - when I uncheck hardware acceleration in the flash player settings all goes back to normal.So I was wondering would it be possible to do it with actionscript. In my publish settings Hardware acceleration is set to none, but that doesn't seem to work.
In a projector project, in fullscreen mode, the presentation is too slow in some computers. Searching I discovered that in settings in flash players, there's a option for Hardware Acceleration that solves the problem. But when I burn the projector in a CD and run in another machine, the hardware acceleration comes selected again, making the movie to run too slow. Is there a way of turning the hardware acceleration to OFF using actionscript, in a way that no matter what, is will always run smooth?
i have found a code whose purpose is to make an object to follow the mouse arrow. It works perfect, but i would like to add a kind of acceleration to it. That means the closer the object is to the mouse arrow, the faster it moves.
We are doing our second kiosk using Flash and Jugglor. The system uses a 1024x786 touch screen (15") for user input and a 1366x768 Flatscreen (37") for information display.The program is created in Flash with a stage that is 2390x768 (2390=1366+768) We use a 2-headed nVidia card and their drivers split the info onto the proper screens.Works swell! In this iteration, we are using more full-screen hi-def on the info screen and I can't, for the life of me, get a solid answer as to the best way to take advantage of hardware acceleration for hi-def video playback in the CPU (Intel/XP) or the graphics card.
I know that most DVD players are able to do this, but there is enough stammering on the flash playback to suggest that the video is not getting a full boost from the silicon.
I'm toying with an Adobe Air app that plays quite large movies. I want to run it on a 1920x1080 display connected to a Mac. Unfortunately, the movies tend to stutter and I'm betting that happens because I'm not using HW GPU acceleration for H264 playback.
Most of the player code is ported (aka copied) from a web player I built and which runs very smooth on the Flash Player from the browser. So the code shouldn't be the problem.
In the Flash Player, to use GPU acceleration in a fullscreen mode, you have to set the Stage.fullscreenSourceRect property. However, this doesn't seem to work in Adobe Air...
I have a movie clip (1). When I click on 1, I would like to move a second clip (2) to another position along the x axis. This I know how to do. What I'm not sure of it how to code it to decelerate as it approaches it's final position
i created slideshow in flash as3. while moving the image left to right / right to left which showing some jerk effect. i need to move this effect to be smoothly.
this is the code using in my application
TweenLite(this, 8, {x:this.x + 118, ease:Linear.easeNone})); => left to right TweenLite(this, 8, {x:this.x - 118, ease:Linear.easeNone})); => right to left
i have created a slideshow in AS3 scripting to pan images from left to right or right to left. The issue i have on the slideshow is some stutter effects when the set of images are panning from left to right by one after another. Is there anyway to make the panning smoother than the jittery effect.
about using graphic acceleration for smooth effect. What is graphic acceleration and how it helps to achieve the smooth movement of images.
This may be a big ask, and I am just a beginner in coding - but can someone tell me what is wrong with this code? (it is fairly short. The intentions of this code is to make the predefined object hero to move with acceleration and to slowly decelerate over time.
I have a 2D side scrolling game (made with ActionScript 3) that runs at 60 frames per second. I'm trying to make it frame rate independent so it will run on slower devices.
To do this I create a var called timeElapsed by calculating how many milliseconds have passed between each frame and dividing that by 16 (60 fps is about 16ms, I think.) So that at 60 fps the result would be about 1. Then I times any time related vars by this number (e.g player.x = speed * timeElapsed;) This is the code:
private var oldTime :Number; private var defaultFrameRate :uint = 16; // the default frame rate in milliseconds private var timeElapsed :Number;
[Code]....
As you can see, at 30 frames per second the player is moved further in the same amount of real time. What seems to be the issue is that, at 30fps in frame one, my current code doesn't account for the slight difference in speed between frame one and two at 60fps. I thought of getting the average value of speed between any two frames at 60fps and using that to calculate a more accurate value when the frame rate changes but I got the feeling wouldn't work correctly in some other situations since at 60fps for example, it would move the player by 115 and not 110 pixels.
Is their any way to accurately simulate an object accelerating in a way that is frame rate independent?
I have 4 movieclips that are animated around the stage and a basket movieclip button as the home button in the far left corner. When I click the basket I would like to have actionscript animate those 4 movieclips into the basket with an acceleration in 20 frames. This I can easily do without acceleration as I can find out the current location of the movie clips, find out the distance between it and the basket and then divide it by the number of frames I need, and then use that as the speed. But to be honest I am not sure where to begin when I include acceleration. I have dabbled with acceleration in the past but not with a specific number of frames in mind.
Does anyone know of any great resources/tutorials etc on where I can create the same effect as the example link below regarding the horizontal scrolling?
[URL]
I have googled and searched everywhere but can only find actual scrollbars.
I am trying to use the StageVideo object for hardware acceleration capabilities. I am compiling code in FlashBuilder4 and am using sdk Flex Hero (4.5.18623), and Flash 10.2 I think given these settings I should be able to use StageVideo. However when I import flash.media.StageVideo, I just get an error message, telling me that flash.media.StageVideo cannot be found. How can I get StageVideo to work, are there some settings that I should be changing.
[URL].. To enable the SWF file to use hardware acceleration, select one of the following options from the Hardware Acceleration menu: Level 1 - Direct Direct mode improves playback performance by allowing Flash Player to draw directly on the screen instead of letting the browser do the drawing. Level 2 - GPU In GPU mode, Flash Player utilizes the available computing power of the graphics card to perform video playback and compositing of layered graphics. This provides another level of performance benefit depending on the user's graphics hardware. Use this option when you expect that your audience will have high-end graphics cards. If the playback system does not have sufficient hardware to enable acceleration, Flash Player reverts to normal drawing mode automatically. For best performance on web pages containing multiple SWF files, enable hardware acceleration for only one of the SWF files. Hardware acceleration is not used in Test Movie mode. When you publish your SWF file, the HTML file that embeds it contains a wmode HTML parameter. Choosing Level 1 or Level 2 hardware acceleration sets the wmode HTML parameter to "direct" or "gpu" respectively. Turning on hardware acceleration overrides the Window Mode setting you may have chosen in the HTML tab of the Publish Settings dialog box, because it is also stored in the wmode parameter in the HTML file.
Does this mean that the newest version of Flash will support Hardware acceleration? The kind of hardware support that will produce less laggy animations and games? I've been waiting for flash to do this. I have a couple game ideas, but they're too big for flash, and well, I wasn't very inspired to learn other languages.
I'm new to AS3 and desperately trying to figure out how to smoothly accelerate the frame rate of a movie clip (let's say from 0 to 24 over the course of a second or two) as a result of rolling over a button. I've been working on it for about a week just to get this far, and now I've hit a wall. Here's my code thus far:
stop(); var cf:int; var fr:int = 1;[code]....
Basically, right now it starts at a very slow frame rate and stays there, never getting up to 24 fps. The only two objects in the scene are button1 and box1. The desired functionality is that when you hover over button1, the box1 movie clip starts playing slowly then accelerates up to 24 fps and continues playing at that rate until you roll out of button1.
Is it possible to enable hardware acceleration (Level 1, Level 2) for a swf generated in Flash Builder. I don't use the Flash IDE and therefor I have no access to the "Publish Settings" in the Flash IDE? Maybe there is some compiler arguments? [URL]. To enable the SWF file to use hardware acceleration, select one of the following options from the Hardware Acceleration menu:
Level 1 - Direct Direct mode improves playback performance by allowing Flash Player to draw directly on the screen instead of letting the browser do the drawing. Level 2 - GPU In GPU mode, Flash Player utilizes the available computing power of the graphics card to perform video playback and compositing of layered graphics.
This provides another level of performance benefit depending on the user's graphics hardware. Use this option when you expect that your audience will have high-end graphics cards. If the playback system does not have sufficient hardware to enable acceleration, Flash Player reverts to normal drawing mode automatically. For best performance on web pages containing multiple SWF files, enable hardware acceleration for only one of the SWF files.
Hardware acceleration is not used in Test Movie mode. When you publish your SWF file, the HTML file that embeds it contains a wmode HTML parameter. Choosing Level 1 or Level 2 hardware acceleration sets the wmode HTML parameter to "direct" or "gpu" respectively. Turning on hardware acceleration overrides the Window Mode setting you may have chosen in the HTML tab of the Publish Settings dialog box, because it is also stored in the wmode parameter in the HTML file.
In my Flash File I have a wheel. The user is able to rotate the wheel by using arrows to jump to the next "segment" (think 20 images attached to each other forming the circumference of the wheel).
[Code]...
However, what I want to be able to do is, click and drag to spin the wheel, complete with acceleration and deceleration and even settling on the nearest image when the wheel reduces to a certain speed. I have no idea how to go about doing this: I'll need to kinda detect a before and after position of the cursor and translate this into a speed for the wheel which then decelerates over time and also detect which image is closest at a certain speed and "snap" it, both scrolling up and down. (it'll only affect the Y-axis)
We run surf camera streams on our website, which are played via the latest version (5.4) of JWPlayer on our pages. Recently we switched over to another streaming service, and H.264 streams, as we are planning on streaming out to iOS devices in the very near future, however this introduced a bug on the client side where users to not receive vision (they only see a black screen where the video is normally seen).
We have discovered that disabling the Hardware Acceleration (which was introduced in Flash Player 10.1+) fixes this issue, and given the spectrum of environments where this issues is happening I would wager that this is related to specific graphics cards, their drivers, and how they handle the vision decoding etc.
The documentation we have found relating to disabling Hardware Acceleration only indicate that this can be done via the wmode param, i.e. by setting it to wmode="opaque" or wmode="transparent" however this doesn't seem to work in all cases (for the most part the issue is no longer there) however we are still seeing 30% of our users getting this issue.
We can ask the users to disable hardware acceleration themselves, and we have provided details on how to do this, however to me that is only a temporary fix, and I was curious as to whether or not there was something more permanent we can put in until Adobe fix up this issue?