ActionScript 3.0 :: Clarification Of Sprite.clear() Usage?
Aug 13, 2009
My understanding is that calling clear() on a sprite object will wipe the screen clear of previous drawings for the next draw. But my code below renders nothing to the screen when there is a clear() called.
Code:
var sp:Sprite = new Sprite();
addChild(sp);
var g:Graphics = sp.graphics;
[Code].....
View 3 Replies
Similar Posts:
Jan 23, 2009
deleting, 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]...
View 1 Replies
Aug 6, 2009
Does anyone know if we have to specifically remove event listeners that are added in a custom class that *only* listen to events dispatched from within the very same same class?
For instance, if I have a parent class that instantiates a child class that builds a simple UI which contains a few buttons that are only listened for in that child class, do I have to worry about removing them before removing the child from the display list & setting to null (on the parent-level)?
View 3 Replies
Jul 30, 2011
I'm working on a game whose background has many layers that each scroll at different speeds.
Inside each layer I have a Sprite, I've started using graphics.beginBitmapFill, but what I've found is that the graphics.clear() function doesn't actually clear the contents set by the previous call to graphics.begin.BitmapFill. Each frame, I adjust the matrix to shift the layer as needed. Then, I call graphics.clear() and graphics.beginBitmapFill() with the adjusted matrix. Since my layers have alphas in the bitmap, I can see the contents that was drawn the previous frame.
View 3 Replies
Aug 24, 2010
I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.
View 2 Replies
Jan 1, 2012
[Code]...
doesnt clear the line when mc1 moved ? How solve tihs problem?
View 1 Replies
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
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
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
Jul 6, 2011
I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:
package
{
import flash.display.Sprite;
[Code]....
I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.
View 3 Replies
May 27, 2008
[Code]...
Then the numericStepper is drawn as if it is squished to 20% its normal height. If I pre-set mySprite width and height before adding the numericstepper, the trace output is 0,0 after adding it and it is not displayed at all. Is there some way I can make the sprite only adjust to correctly fit the numericStepper OR resize it afterwards without distorting the numericStepper component?
View 2 Replies
Sep 23, 2011
Both of sprite.width and sprite.scaleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?
View 2 Replies
Jun 19, 2009
It has been a great resource of the years. No my problem. I am trying to dynamically resize a sprite that has a line drawn into it. Here is my code:
[Code]...
View 4 Replies
Aug 15, 2010
first i have 2 sprite.. it`s mcproduct sprite and mcproductpane sprite . mcproductpane is a parent of mcproduct sprite.. so inside mcproductpane there a several mcproduct sprite.this is a script of mc prodcut
PHP Code:
[Code]...
The problem is i want to set a button in here(mcproductpane sprite), this button will unload / make dissappear an image that i load using loader class in mcproduct sprite..how can i make this happen?when i want to make a button in mcproductpane sprite which the function of the button it`s to unload/make an image that i load using loader class in mcproduct sprite disappear.
View 1 Replies
Feb 3, 2010
Everytime I google this question I see confusing information about masks and blends, none of which seems to directly apply to what I think should be an easy thing... There are three Sprites involved here...the lowest layer sprite is pretty much a background. I want to overlay a translucent Sprite on top of the background and then I want the third, top-most Sprite to act as a hole, so that the area inside the third Sprite is completely transparent, so that the background sprite is completely visible. How would I go about doing this dynamically (i.e. dynamically drawing the masking sprite and hole using the Actionscript graphics calls)?
View 4 Replies
Feb 2, 2009
Is it possible to set the height of the sprite depending on the height of an textfield inside that sprite? I'm creating a box with a textfield inside it, but I want the box to be sized depending of how much text it is in the textfield..
View 9 Replies
Feb 22, 2011
I'm looking at finding a way of recording the amount of times a swf is loaded or a button pressed with the aim of giving a client feedback about how their product is used.Basically I am creating a touch screen app for a client which will contain a couple of hundred images and the client would like to keep track of which images are loaded in and how many times.
I looked at Mochibot which seems good however I don't think this app I am building will be connected to the Internet. So that's not a viable option. So is it possible to output something locally? Which will get added too every time the app is used. Even if the computer and app are restarted?
View 2 Replies
May 25, 2010
Currently when I load my presentation that I have just recently created and testing I'm getting a HUGE spike in my cpu usage.
I'm running an i5 2.4, and it's nearly taking up 100%, a friend of mine is running a core 2 duo and it's taking up 100% of the cores.
What is a proper way to optimize for these occurances? I don't have any preloaders up and running yet.
Here is the link to the site.
[URL]
View 1 Replies
Jun 15, 2010
I'm user of relatively weak computer (pentium IV 3.0 with hyper-threadingiem) but with a bit newer graphic card - asus radeon HD4650I'm not big new games fun, I'm useing my hardware most to internet access so I would rather not to buy new computer in the near future. But also I would like to have possibility to watch flash movies fluently on full screen (eg. youtube, video streeming). Unfortunatelly, till now, it was pretty weak. I got hope that afther new flash release (lately), which should use computing power of graphic card and making CPU work lighter.
Unfortunatelly, afther flash update (10.1) I haven't noticed any changes - everything work in the same way (not fluently) as at old flash. CPU usage is still ca.100% and GPU usage is 0% (I can see it in control panel) What is wrong? Is it this version of flash what should use GPU or it is not yet? Maybe I should configure something more? Or is it possible that I made something wrong? I've tried few times, made lots of work and combinations (instaling and reinstaling different versions of flashs, graphic card drivers, browsers changing etc) and still nothing.
View 1 Replies
Apr 7, 2011
I have a question concerning CPU usage for games. What do people consider as an average or 'acceptable' amount of cpu usage for a game I've created a few different games, some which are more database driven have a very low cpu usage and small size.. others I've seen go up to 80% cpu usage..
I do try to keep a careful eye on this (I mean 80% of one core, of which I have 8.. I'm not sure how this will reflect on a single core/processor machine) but it does really concern me because as soon as I add an 'enterframe' function, spin something around or create a fair size animation it piles on the intensity to the cpu.. are there any professional tips anybody could offer me please ? I really want to make the web a better place for others by not overloading their computers
View 1 Replies
Feb 25, 2011
Is there some way to get the cpu usage in flash or adobe AIR?
I'm using ActionScript 3.0 and flash CS5.
View 1 Replies
May 8, 2002
i don't understand the usage of prototype.
View 4 Replies
Sep 3, 2009
I am making a websites with fairly large videos in the background.The site is extremely heavy for the cpu and I was wondering if any of you guys know a trick on how to make flv streaming less heavy.Here are all my specs :
Large flv (920 x460), with alpha channel (transparent background), Max data rate:300kbs,
codec : On2 VP6 encode alpha channel, framerate : same as source.
Using progressive download
Video plays in a flvplayback instance nested in a swf that is loaded and added to the stage by an other swf.
Embed in the html page with swfobject, wmode = opaque.
Movie playing at 31 fps.
View 1 Replies
Mar 23, 2011
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at grid/ball_movement()// my function in enter frame event
The code I wrote in ENTER_FRAME is
[code].....
View 3 Replies
Mar 24, 2011
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]
View 1 Replies
Feb 25, 2009
I would like to use the mouse wheel with a quiz I've been making.I have it set up so when you roll the mouse up it goes to the next question and when you roll it down it goes back to the previous question.It isn't working as I would like though, It doesn't scroll through increments of 1 - theres 50 questions in the test and its scrolling through them like this 1,2,4,8,16,32,FinishedIf anybody knows a way I could use the mouse wheel to scroll through the quiz.
View 2 Replies
Jan 22, 2009
I've many unicode russian (cyrillic) fonts installed on my mac. When i type message like "T" type-tool - they show russian letters. When i embed it in Library like Font class, 50% of my fonts doesn't show russian letters.
View 1 Replies
Feb 13, 2010
in the "Interactive 3D Video Flip" tutorial i take the cod and applied to my stuff I noticed that when the page was rotated the Flash player consume 40-50% from my CPU , how it's possible? the animation it's finish but the CPU it's 40-50% used . tested in mozilla and IE and from Flash ( when i test the movie) Pentium 4 and athlon 64 X2 tested!!!.. windows 7 last version of flash player 10.045.
[Code]...
View 2 Replies
Nov 29, 2010
how the post_param is used in SWFUpload. i need the value for name='batchid' loaded when i submit. this is what the example doc shows
post_params : {
"post_param_name_1" : "post_param_value_1",
"post_param_name_2" : "post_param_value_2",
[code].....
View 2 Replies
Mar 4, 2011
System.totalMemory gives the total memory used by the flash player and not one particular application. Is there any way I can get the flex application's memory usage in code/actionscript?
View 3 Replies