I have a code, that draws a horizontal line, then it turns into a slope, and at the end of the slope it draws a circle. Here's a code:
Code:
var xspeed:Number = 1; // defines increments for x of slope
var yspeed:Number = 2; // defines increments for y of slope
var hspeed:Number = 5; // horizontal line increments
[code]....
Create document 800x700 and put this code into main timeline. Now test movie As you can see, everything works great. But there is a problem. The circle is being drawn at 0 degree angle. But I want the circle to match the angle of the slope, so it looks like the slope and the circle are both at the same angle.
I am a bit new to using blitting for graphics. But I have worked up a few demos myself, and I have been reading a lot of information on the methods used. One common theme I have been seeing though is that all of them brute force rendering; drawing the farthest back object first and stepping through all other objects. even drawing objects that are going to be completely overlapped. The reason all of them say this is that any kind of testing to see what should be drawn actually takes more time than just drawing everything with no checks. Is there any kind of way to detect what should be drawn, that will run faster than just drawing everything?
Am currently working on a tool created by a colleague of mine and would like to improve performance. Basically, it's a tool for drawing on screen and uses a combination of Sprites and the Graphics class to draw a line segment every time the mouse is moved when the mouse button is down. Here is the drawing bit:
// on MouseMove protected function drawLine(e:MouseEvent):void { if (currentTool.thickness > 0){ //pen var line:Sprite = new Sprite(); line.graphics.lineStyle(currentTool.thickness, currentColour); [Code] .....
As you can see, it checks if the line 'thickness' property and draws if it is and erases if it isn't. I did think of using a technique similar to blotting here where it'd draw to a bitmap but I'm not sure this'd give the performance boost I want or if, indeed, there would be any way to have an eraser function. The drawing itself works nicely - this isn't the problem, it's the performance of the subsequent 'drawn' sprites.
In flash, if you have a complicated graphic (like a complex diagram) that doesn't change much and you want to move/zoom/rotate it around, then does Flash perform better if you convert all graphics into symbols? Or does making symbols slow things down?
Background: Sometimes, you do things for so long, you can't remember why you started in the first place. Whenever I import graphics in flash (like from Illustrator, for example), I select everything, press cmd-B (or ctrl-B on Windows) repeatedly, "breaking apart" everything until I can't, anymore. Then I press F8 and create a symbol.
That's just what I've done for like the last 10 years. It's to the point where I don't even think about it, anymore. I vaguely remember doing this after learning that performance improves when you break apart graphics to create a symbol.
Now, I have a problem: I'm translating/rotating/scaling a massively complex, static diagram and it's too sloooow. I'm trying every technique I can think of to speed things up—every little bit counts.I've read this link and lots of others but I haven't come across the topic of creating symbols.
Summary:should I go back through and make everything a symbol? Should I go through and make everything NOT a symbol? Which is faster?
I have a code, that draws a horizontal line, then it turns into a slope, and at the end of the slope it draws a circle. Here's a code:
Code: var xspeed:Number = 1; // defines increments for x of slope var yspeed:Number = 2; // defines increments for y of slope var hspeed:Number = 5; // horizontal line increments
[Code]....
Create document 800x700 and put this code into main timeline. Now test movie As you can see, everything works great. But there is a problem. The circle is being drawn at 0 degree angle. But I want the circle to match the angle of the slope, so it looks like the slope and the circle are both at the same angle.
I've seen the BitmapData object used for graphics a fair bit, especially in games. Many of these cases have done things in somewhat fundamentally different ways, and I was wondering what the best way generally is.
Method 1: Each animation frame is kept in a separate BitmapData object using an array.
Method 2: The animation is kept in a strip using a single BitmapData object and using the "sourceRect" parameter of copyPixels.
The draw and hitTest methods appear not to provide any "sourceRect" parameter. Most of the code I have seen using method 2 has worked around this by copying the bitmap frame into a temporary bitmap for these methods. This seems like quite a large processing overhead to me. Using method 1 this is generally not a problem, unless hitTest needs to be used with scaling and/or rotation, in which case a temporary transformed copy is still needed it seems as hitTest doesn't except a transformation.
I'm thinking method 1 is the better choice since it avoids having to make temporary copies for the most part, and I don't think it would waste much memory (just the duplicated width, height, etc values?). Is this generally true or is there a reason lots of people seem to do things the second way?
Also is there a better way to use hitTest for bitmaps that have been scaled, rotated, etc?
I've got a custom AS3 scrollbar that I need to modify. The scroll thumb (the draggable part of a scrollbar) is currently just done by drawing a rectangle. But I need it to look more like a real scrollbar. Not sure how to modify the below code to import/use a scroll thumb image:
scrollThumb = new Sprite(); scrollThumb.graphics.lineStyle(); scrollThumb.graphics.beginFill(0x0066ff);
I have created some graphics directly in Flash Cs4 using the drawing tools, making them 'drawing objects', yet they are pixelated when viewed in browsers. Within Flash they look crisp, but not when exported.
I have a program that dynamically draws a polygon wherever the user clicks on the screen. (using lineto, moveto) However this polygon is always behind the other symbol objects on the screen even though its added last in the childlist. Is there an issue with depth when drawing symbols vs. drawing with lines? How can I ensure my dynamic object will display in front?
I'm trying to understand how the Flex framework draws objects (Button, Label, Image, etc.). The Button class seems to draw itself by addChild()ing its ProgrammaticSkin. However, where in the framework is the Graphics object being passed around in the hierarchy to achieve the drawing. I want to get to the level of 2D API.
I'm working on a game, and to keep performance good, instead of addChild'ing 50 new sprites to the stage every second, I decided to have each player draw to their own bitmap, and then to the 'master' bitmap. This introduces an issue though: the second player would override all data the first player has put into to bitmap...My basic debugging proof of concept:
I was wondering about MC and hey can help to lag a game out. I set up an advanced class system so i don't have to use MC to simulate walls, all i use isthe x,y,width and height. Well anyway since i don't need MC anymore I was wondering if there is a way to attach Graphics instead of MC cause a Graphics file size is relatively small than that of a graphic, I think. If anyone could tell me thats true and show me a way to attach graphics that would be nice. I haven't tried it yet but maybe if I exported the graphic from the library imihgt be able to call its name, but it doesn't have an instance name so im stuck.
There is no maintainAspectRation property for video object.Then how to improve the quality of video when even we resize the video dynamically.It has to maintain good quality.How to achieve this.
I am working on a flex application. The application occupies 100% of the browser screen, but it is slow to load. How should I improve the performance, what are the best techniques one should follow for improving the performance of a flex App. I did try some stuff though, I am not using relative layout instead i am using absolute layout and putting the buttons/images etc at exact places in a Canvas, still i feel it is slow. Can I profile the App or flex code to see where exactly the app is taking the maximum time to execute.
I'm playing around with Flash CS4 trial and tried to 'compose' a 3d Box by putting 6 MovieClips as the side elements of the box in one clip which represents the whole box. (only using the Flash Tools, no Actionscript). Within the BoxClip (after doubleclick on the BoxClip on stage), all sides look right, each side is positioned with the correct angles and coordinates. Outside the BoxClip, back on root stage, the box sides are not parallel anymore, the angles are not 90 degrees, there is no 'box' actually. So I guess, one of the problems is the 3D Center point of the objects which is absolute to one point in coordinate space. The other problem is the faulty '3D' display in Flash, that is, changing from inside to ouside a clip changes the view also. So far, the Flash GUI seems quite useless for doing some '3D'. How to improve the workflow?
The quality of sound when playing my flash file on the timeline in flash CS4 is excellent, however when I go to test movie the sounds quality becomes awful, like its being played in a tunnel on terrible speakers, my sound files are .wav files, am I missing a process I must do to ensure the quality of sound is carried through to the final published animation?
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 have two FMS 3.5 streaming servers... Both have Windows Server 2003 x64 with 16 GB of RAM..I'm streaming from a common storage and my Application.xml file is like this:
I am using Helvetica Neue 43 Light and it looks great as Dynamic Text without embedding the fonts. It is nice and bright, sharp edging, etc.
I notice though, that on other computers, the Helvetica Neue font is displayed as Times. I am presuming because these other computers do not have Helvetica Neue installed on their computer system.
If I embed the fonts, it looks the same as static text or text that I have broken apart. The fonts are thicker and has blurry edges.
Is there any way of getting around this and have my Helvetica Neue looking sharp and crispy like dynamic text without embedding the fonts.
I am using the Open source PurePDF library in my Flex AIR application. The problem is performance:It takes 100% CPU usage and too long to generate a PDF.
I have done some analysis on it and find that the text writing in pdf is expensive. That's why I need to know how I can improve the performance. Are there any fonts for which pdf generation is less expensive, or is there some setting or tip that can make this process somewhat better in terms of performance? secondly in case of images the ImageElement generation is very expensive when writing that element to PDF. Is there any way to reduce the processing?
I found a way to reduce the ImageElement generation processing by resizing the image using flex and by then passing the small image's bitmap data to the image element. It works fine, and i have reduced the time of execution to a good extent. is there any way to tell PDF to work in chunks or divide the work in such a way that it may take more time to complete but won't block the GUI while the PDF is being generated?
Been reading up on the flash transition object. I came up with this way of fading out one clip and fading in another and having them loop forever using the transition objects but it's very dirty coding and not very flexible.
Is there a way to clean it up so that I can add as many clips as I want without having to write more code, just by adding more movie clips to the stage?
I would like to know if anybody could help me to learn more on improving SEO for flash websites as it is not as good as for html websites (if i am not mistaken).I have heard something about xml that can be used to improve your SEO for all your flash websites.
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);
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);
I have a program that is decently complicated in one area and the rest is simple. The complicated stuff is data crunching, pretty much. Would I get an increased performance by doing the data crunching in a second app and just having it send the couple bits of info I want from it to my other app that would be the front end of the program? Or is this a dumb idea? I know air doesn't by default multi thread, so I was just trying to think of a "work around."