ActionScript 3.0 :: Bitmap Has Higher Index Than Sprite?
Nov 10, 2009
I've just switched over to AS3, and I'm completely stumped with something.
I'm working on a project where I keep adding children to a MC already on the screen. There are two types of these children: Sprites that I use to draw lines using moveTo, lineTo, ect. Then there's sprites that have children inside of THEM that are bitmaps.
For some strange reason, the Sprites with the bitmaps on them always have a higher depth/index (AS3 terminology is still weird for me) than the normal Sprites.
Here's a diagram of my MC/children/children layers:
---------------=> (Sprites that draw lines)
(MC on Stage) =>
---------------=> (Sprites that hold bitmaps) => (Bitmap)
View 6 Replies
Similar Posts:
Mar 3, 2010
I'm working on a project conversion from AS2 to AS3.
In AS2, I used a mainMenu file and loaded a Navigation file at _level 999 (very top). Then I loaded and unloaded different modules on _level 5.I also loaded and unloaded an external Glossary file on _level 95.Now in AS3 I am using AddChildAt(1) for the Naviation file and AddChildAt(.1) and removeChildAt(.1) for the module files. The Glossary file only seems to work at Child Index 1, so I'm guessing it pushes the Navigation file to a higher index. Is there a reference that explains the Index properties of the Child and why sometimes I get an error when I try to add a Child of Index 2 or higher?
View 3 Replies
Feb 22, 2011
If I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?
View 1 Replies
Feb 4, 2012
I was wondering what's the best way to manage an images depth. Currently I have 2 layers. On the top layer I have a png image of a window. The inside of the window frame is transparent so you can see though it. On the bottom layer I have a png image of a background that you cannot see though. I used addChild(MyMovieClip); to put an image onto the stage. It is in front of the window. I used addChildAt(MyMovieClip, 0); and the image ended up behind the background. I used addChildAt(MyMovieClip, 1); and the image ended up in front of the window again.
[Code]..
View 1 Replies
Nov 22, 2009
if it is possible to covert a bitmap to a Sprite? I tried casting it to a sprite, but that does not work. The reason why is because if figured out that you can't use the addChild option on a bitmap.
[Code]...
View 2 Replies
Feb 4, 2010
how to addChild bitmap in Sprite. I have one bitmap image in my libary. Now, I want to add it into my "Sprite" display object. I can put my libary's bitmap into movieClip but I want to do in pure as3 .
View 2 Replies
Apr 14, 2011
I'm kinda new to AS3, I would like to know the difference between Sprite and Bitmap classes??
View 6 Replies
Aug 11, 2008
I've got a Sprite object that I would like to extract somehow into a Bitmap object in order to manipulate certain pixels. For example, if i have a diamond shaped Sprite, I would like to convert it into a bitmap
View 3 Replies
May 31, 2011
/*the point of this is to add a keyboardEvent to animate the image*/I am loading a bitmap image using this function:
var myLoader : Loader = new Loader();
var myURLRequest : URLRequest = new URLRequest("thesus.png");myLoader.load(myURLRequest);
function myOnComplete(event : Event) : Bitmap{ var loader : Loader =
[code].....
View 4 Replies
Jun 12, 2010
Following up from: http:[url]...I am trying to comeup with a function to print without creating a sprite, because that's what it seems to be causing my problem:
public function printScreen():void {
var pJob:PrintJob = new PrintJob();
var options:PrintJobOptions = new PrintJobOptions();[code]....
This is coming up with an: Error: Description Implicit coercion of a value of type flash.display:Bitmap to an unrelated type flash.display:Sprite. So how do you print a bitmap without creating a Sprite?
View 1 Replies
Jun 27, 2011
Maybe it is a bad habbit which still i have from Flash Professional, but : I am trying to add a simple Sprite or/and Bitmap on just created, empty application, and it just not hapening.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code].....
View 2 Replies
Feb 7, 2009
I have a PNG that is a child of sprite object. The PNG consists of a shape in the middle of a transparent background (the alpha value is zero). I want to change the color of the sprite, but I do not want to change the transparent background.
View 2 Replies
Mar 2, 2011
What I want to do is draw the outline of an object using the IDE to create my movieclip symbol...this object will be an enclosed region e.g a cloud. I then want to be able to fill the internal area of the object with a bitmap using actionscript.
I had assumed that I would be able to do this via graphics.beginBitmapFill but there doesn't seem to be a way to specify to draw the outline within the MC or to do a floodfill with a bitmap using a point of origin within an enclosed region.
View 2 Replies
Dec 13, 2011
I load a picture file by Loader and add Bitmap into sprite,like follows:sprite1.addChild(myBitmap);Now I want to get the myBitmap from sprite1,how can I get myBitmap from sprite1,what code can I use?
View 1 Replies
Nov 7, 2010
I wanna transform and distort my sprite which has bitmap childs from this ._ |_| To this .._ /__
View 3 Replies
Feb 25, 2010
I want to load an external image (dest) and display it on the stage, and i want to load another image (src) which will not be visible. When i hold the left mouse button on the image that appears on the stage, then a function that start copies the src image to the dest will be invoked. Actually i want to reproduce the scratch effect on an image that hides another underneath. here is my code [ the copypixels function is triggered on mouse_move event for debug purposes ]
package
{
import flash.display.Sprite;
import flash.display.BitmapData;
[Code]....
Although the two images are loaded into memory and the first one is shown on the stage, when the mouse_move events triggers the corresponding handlers the copy does not work.
View 1 Replies
Aug 9, 2009
can you create arrays of Bitmap and Sprite Objects? or Custom Objects?
if not, how would you typically create multiple Objects of the same type? just a loop with
var enemy:Sprite = new Sprite();
for(var count:int=0; count<10; count++)
{
enemy = new Sprite();
[Code].....
That way could be fine for many things, but theres other things I want to do.. such as, create an array of wav sounds.... and my program could pick and choose them, so they wouldnt need to load them on demand.. midi files too.
View 5 Replies
Nov 21, 2010
I'm making a game where the player moves around a map, where the player can walk and where they can't is decided by the color of the pixel they are trying to move onto, which I get using the Bitmap.getPixel method.
What I'd like to do though is when the map image is loaded process it into a sprite or something which I can then use the DisplayObject.hitTest methods on. So I have an array of colors whcih the user can walk on, is there way I could go through each pixel and build something that would let me do that?
View 4 Replies
Feb 21, 2009
is copyPixels not as speedy as it should be when Tweening large bitmaps ?
copyPixels does a wonderful job on images 500x500 or less, but on larger images, my motion is not as smooth.
all i'm trying to do is slide an image from stage.stageWidth to 0 (right to left).
View 1 Replies
Nov 22, 2009
Is there a way to detect the type of a DisplayObject with a switch case statement?I noticed that you can check if the displayobject compared to the type returns true or false.
Trace(mydisplayObj is Sprite); //return true or false
Trace(mydisplayObj is MovieClip); //return true or false
But isn't there an option to get the type of the displayObject directly?
like,
switch (typeof(mydisplayObj)) {
case Sprite:
break;
[code]....
View 2 Replies
Jun 19, 2007
I have a sprite that has a scrollbar that uses the scrollrect feature. The sprite has several bitmaps and textfields. When I print the outer sprite (The one with the scrollrect) all of the textfields outside the scrollrect are cut after the first line. In case anyone else is having problems with printing sprites with scrollrects using the bitmap printing option fixes and prints most of the stuff in the sprite. Excluding all textfields outside of the scrollrect. This however can be fixed partially by embedding your fonts.
So now the only problem left is printing multiline textfields that are outside the scrollrect. P.S. Imho the scrollrect should have nothing to do with the printed area of the sprite because the printJob.addPage has a printarea parameter.
View 3 Replies
Jun 22, 2011
So, for sending to individual streams we have to reference the connected netStream we want to send to in some way like this:
sendStream.peerStreams[0].send("MyFunction",param1,param2);
and I have to determine which peer I'm sending to by their ID such as "peerID1234"
I know that you can check the peerID of the stream by doing:
sendStream.peerStreams[0]["farID"]
how can I make my send stream function know to use the array index where the peerID is?
so basically it could be like:
sendStream.peerStreams[where peerStreams[]["farID"] == peerID].send("MyFunction",param1,param2);
View 1 Replies
Nov 14, 2009
I dont understand why a simple vector mc TWEEN ANIMATION isnt smooth.Here is an example. I use 30 FPS and I dont want to use 40 FPS or higher.
View 1 Replies
Jun 6, 2011
I have table named "highscore" like this:
nameQL scoreQL
piotr 50
And flash game with NAME and SCORE exported to PHP with this names.How to make this in PHP file:
IF (NAME exists in database (nameQL)AND SCORE> this.name.scoreQL){Raplace scoreQL with SCORE WHERE nameQL=NAME}
IF (NAME doesn't exists){Create new row with NAME and SCORE)
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
Apr 9, 2011
I have a movieclip with a prefilled content (some simple vector graphic in a movieclip), with the height of 40. I then apply a mask to it, with the height of 30. Now i would think that the MovieClip is 30 pixel high, but it turns out to be 40 pixel high. Is there some property im not setting or does the movieclip always assume the height of ALL the content within it? or what?
Actually in another clip, too, I have predefined 2 vector graphics (in two seperate movieclips), where the highest one is applied as a mask to the second graphic. The movieclip again assumes the height of the highest element. That might be logical, as it is the mask, BUT! when i then resize my mask (programatically) the height of the movieclip remains the same.Is there some way to recalculate the height of a movie clip? Or am I missing something?
View 1 Replies
Oct 21, 2005
I would like the volumen to be higher than 0 when the swf is loaded, so that music can be heard without the need of dragging the volume...I've tried to set the dragger in the middle of the slider but still the actual sound is 0 at start.
The code is as follows:
this.ratio = 0;
dragger.onPress = function() {
[code]....
View 4 Replies
Dec 23, 2006
If I have 2 movieclips, how can I know through actionscript which one is at a higher level?
View 2 Replies