ActionScript 2.0 :: Drawing Heartrate App Is Killing CPU
Mar 1, 2005When i run this swf for a while, the CPU reaches 100% and my computer get locked. I guess it has to do with enterFrame, but are not sure.
[Code]...
When i run this swf for a while, the CPU reaches 100% and my computer get locked. I guess it has to do with enterFrame, but are not sure.
[Code]...
When i run this swf for a while, the CPU reaches 100% and my computer get locked. I guess it has to do with enterFrame, but are not sure.
code on MC:
onClipEvent (enterFrame) {
this._x = this._x-0.5;
}
code inside MC:
_root.createEmptyMovieClip("triangle", 1);
z = Math.sin(x)/Math.tan(y);
x = x+3;
[code]....
i have buttons in my library.url...into it when i edit it from the library but it always says "current selections can't have actions applied to it". How do i get to it so i can have a link pop up when i click the button? does the "getURL" also work for files on my computer? for instance i want to click a button and have a movie pop up from one of my folders on the c drive.
View 8 Repliesdeleting, killing objects and functions. There seem to be a few different ways to achieve to completely get rid of unwanted objects and functions(which are in turn objects as well, no?)
Just to refresh:
objects:
Code:
object = undefined // does the job
object = null // does the job
exception: if the object is referenced anywhere else in the application, the object is still in memory, unless the object's reference is killed as above. also: if you attempt to try cleaning up and object , which has objects itself, (e.g. object.subObject = new Object()), then those subObjects are still alive.
To properly clean up the object with subObjects, the subObjects have to be killed off seperately.
[Code]...
I have an MC(named "mouseTip") that gets added to the stage and follows my mouse on MOUSE_OVER. On MOUSE_OUT it gets removed. I just created a dynamic text field inside mouseTip so I can display type when mouseTip is present. For some reason, when that happens the mouse gets blocked by the textfield inside mouseTip and the MOUSE_OUT gets triggered.Once mouseTip is removed, the MOUSE_OVER gets triggered since the mouse is still over the button and my mouseTip MC just flickers rapidly.
View 5 Repliesi have some drop downs that i am trying to create but when i add some actionscript on (rollover) {stuff} it kills the over state of the button.I can add actionscript to a button and still have its over state show
View 3 RepliesI've attached the FLA.I'm trying to make a game where the guy kills rats that appear randomly as the scenery moves down, however every time I shoot the rat and remove the rat child, it throws an error that my actionscript is pointing to an inexistent rat. Hence my problem... is there a way to add many instances of the same class with AS3 at random intervals and remove them when it's shot with the bullet???
View 10 RepliesI'm confused on the parent/child thing. Seems like the "child" statement would refer to the file I'm loading, not the file I'm in? I want the file I'm IN to kill ITSELF when it loads the next swf (it's child?)And then there are other times when I want them to stack one on top of the other. I've added comments above each set of button code to explain./This code is in home swf. Handles portfolio buttons. I do not want to unload Home.swf, so this works fine.
scene1.addEventListener(MouseEvent.CLICK, myRequest);
scene2.addEventListener(MouseEvent.CLICK, myRequest);
scene3.addEventListener(MouseEvent.CLICK, myRequest);[code]...............................................
A user is reporting that a certain screen of our Flex app times out in Google Chrome and IE. I can reproduce this problem, but I don't know what is causing it. I cannot reproduce it with Firefox.
I was wondering if there is a way to temporarily disable this feature in Chrome because I know that in Firefox(at least in v3.6) when a Flex/Flash app executes for too long I get a stack trace from the Flash runtime pointing me to the problem. example:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at TimeoutTest/___TimeoutTest_Button1_click()[/TimeoutTest/src/TimeoutTest.mxml:5]
I think that Chrome is hijacking this process and denying me that information, so I would prefer to prevent this behavior for now to see if the runtime will detect the timeout and provide a similar trace.
I'm trying to make a game where the guy kills rats that appear randomly as the scenery moves down, however every time I shoot the rat and remove the rat child, it throws an error that my actionscript is pointing to an inexistent rat. Hence my problem... is there a way to add many instances of the same class with AS3 at random intervals and remove them when it's shot with the bullet?
View 1 RepliesI am designing a game. In one chapter, I want the user to
right click and keep > to zoom in middle click > to reset the view This code works fine.
HTML Code://my movie fps=80 and my_mc is placed on the main stage import mx.transitions.Tween; import
[Code]...
I have several thumbnails in my portfolio that dynamically load a .png file into the Loader component called myLoader.Followed the tutorial from Kirupa. Simple enough.
Code:
on(release){
myLoader.contentPath = "1-0.png";
}
When I (user) goes to click on a different client to view different work, artwork from the current client is still loaded, or being shown. I have the same myLoader Loader spread through the frames.I tried to put this
Code:
on(press){
unloadMovie("myLoader");
}
on each client button to clear the Loader before you go to each section, but that makes it disappear all together, than when you go to click a thumbnail, nothing happens because the Loader is gone.Is there a way to unload the .png files w/o killing the loader? Should I use a separate loader for each client? or will that just get messy.
I've got several objects on a stage, each is an instance of a different class. Inside each of those classes is a timer, set to loop (basically refresh) every 5 seconds.Even after removing the instance from the stage and setting it to null, the timers continue in the background. Is there some way I can stop and remove all the timers with an object when I null it, or do I have to do that manually before removing the object?
View 7 RepliesI'm working on an iPhone game using AS3 and I've got it working pretty well on the iPhone 3G. I intend to compile it with AIR 2.7 (or 3.0 when it drops), but for testing purposes, I do everything on my 3G. Here's the problem,I get a solid consistant 24fps until one of my objects moves offscreen - even partially. If my "character" even goes a few pixels past the edge, frame rates drop tp 9-10 fps. I've had a few people already suggest not allowing anything to move offscreen, but that's not feasible. I've gone through my code to make sure there isn't a programmatic reason this happens, and I've created a seperate project specifically to test this - with no game logic, simply moving an image across the screen, frame rates bottom out once content goes over the screen edge. I've tried using masks, I've tried using scrollRect, I'm using cacheAsBitmap, and there is no scaling, only x,y translation.
View 2 RepliesI'm developing a game in as3 for iPhone, and I've gotten it running reasonably well (consistanty 24fps on iPhone 3G), but I've noticed that when the "character" goes partly off the screen, the frame rate drops to 10-12fps. Does anyone know why this is and what I can do to remedy it?
Update - Been through the code pretty thoroughly, even made a new project just to test animations. Started a image offscreen and moved it across the screen and back off. Any time the image is offscreen, even partially, the frame rates are terrible. Once the image is fully on the screen, things pick back up to a solid 24fps. I'm using cacheAsBitmap, I've tried masking the stage, I've tried placing the image in a movieclip and using scrollRect. I would keep objects from going off the screen, except that the nature of the game I'm working on has objects dropping from the top down (yes, I'm using object pooling. No, I'm not scaling anything. Striclt x,y translations).
When I am debugging broken code, after a while the browser announces that the Flash plugin has crashed, and I can't continue debugging my code. Can I prevent the browser from killing Flash?
View 3 RepliesI'm trying to kill a particle effect I've made for this animation upon a button event. Here's my script as it appears at the keyframe before the animation moves on:[code]When either of the buttons are pressed and the animation moves on, I want to remove the smoke children I've created at the top.
View 2 Repliesi've tried to simulate a pencil tool, for drawing above a imagem, but the drawing is below the picture. How fix it?
[Code]....
Basically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?
Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.
I cannot get this to work. Without the "var drawing", "var drawing being true or false" and the "if statement", it works fine. But I need to add the "var drawing" so that you can only draw if you turn it on by pressing the "draw_btn" button. Note, I do not get an error, the script "apparently" contains no errors. Here is the code:
ActionScript Code:
var drawing = false
_root.createEmptyMovieClip("myLine", 0);
[Code].....
I've created a drawing tool which allows the user to draw on the canvas, the problem is that if I try to draw over a movieclip nothing happens. Is there a way I can allow for the user to draw over movieclips? For example if I had a background of paper?
Here's the code I'm using for it:
// This code is for drawing the lines on the page
//1.
var drawingLine:MovieClip = new MovieClip();
addChildAt(drawingLine,0);
[code]....
Why can't (or better yet) you kill client stream from server side - I seen some code that FME may call on server side like s= stream.get(streamOBJ.name); s.play(false); delete s; application.gc(); // over kill but still did not work
View 2 RepliesI need to draw on stage about 40,000 4x4 squares each a different color. The color is determined by an xml file. I have this working in as2 and have converted it to as3 the problem is the amount of time it takes to draw is causing cs4 to time out. I have extended the script time out to 60 seconds. In cs3 as2 it would draw the squares in about 15 seconds. I was hoping as3 cs4 would improve performance but seems to be the opposite. I have tried several methods such as adding children and various drawing variations. the bellow seems to work the best, but is still causing flash to crash.
ActionScript Code:
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Shape;
[Code]...
Does anyone have the code for drawing lines (with smoothing) in an onMouseDown click event?
View 1 RepliesI have an app that allows the user to draw and create temporal objects (sounds and animation).I want the user to be able to SAVE and PUBLISH their output as an SWF file they can download to their computer. I have no problem with the drawing and animation aspects, but I'm stumped on how to begin coding the output. Do I need to call some remote actions (JSFL) on the server to create the SWF? How would be the best way to pass the data?
View 2 Repliescreating a drawing pad in Flash that will let a user (from my website) draw an image(also have different shapes and colors) then be able to click on "save". Now here's the tricky part, When a user clicks on save, I need it to be saved as a .jpeg file then have that image sent to my email for review
View 3 Replieshow to replicate the "add anchor point" tool using AS2? I have managed to use the API to draw a square with four anchor points, but am not sure how to add extra anchor points. What I want is that these extra anchor points are added when then user clicks on a line.[URL]
View 2 RepliesI want to program a program that draws a Pythagoras tree. The only programming language I know is C but I tried it in that language and it was horrible. Someone recommended Flash (AS3) to me so I am trying it in that now, but I only started yesterday so that's why I am posting this in the newbies forum. If this belongs in the math forum, then please move it there.
Anyway, I got to the point where I can draw the leftturning branch of the Pythagoras tree, but I don't know how to draw the other branches. The number of "houseshapes" a square with a rectangular triangle on top increases with every step according to the formula 1 x 2^(n-1) (First step is n=1). I created a function that draw this houseshape, called drawHouse() and it takes as its arguments the co-ordinate of the lower left corner of the square part of the house, the length of the side of the square part of the house and the current rotation angle. Rotation angles are always multiples of 45 for now, but I might try to expand it to other values later, but for now I hardcoded a lot of stuff that assumes the 'roof' of the house is a rectangular triangle.
how do I store the 2 new x and y co-ordinates that I can calculate after drawing the houseshape, for drawing the next houseshape, and how do I store the angles? Do I need 3 separate arrays for x, y and angle? And how do I then call the houseshape function for every x and y co-ordinate and angle in these arrays? Code is attached.
i'm trying to animate the drawing of a picture with my wacom tablet, but the only way that i know how is to start with the full drawing and erase frame-by-frame backwards, which takes a lot of time and can look choppy.
View 1 RepliesI am very new to flash and only know the basics, but would like to put together a flash animation similar to this website [url]...
View 3 Replies