Actionscript 3 :: BitmapData Constructor Default Seems To Conflict?

Aug 8, 2011

Following on from an answer I gave here: AS 3 | Cloning Png image data

I knew that to get a transparent BitmapData Object it was necessary to specify a background color of black, but until I was called out on it I never bothered to check why. Having checked, I wonder if there is a reason I don't see for what seems like conflicting default arguments to the BitmapData constructor? First, here is the constructor as defined in the documentation:

public function BitmapData(width:int, height:int, transparent:Boolean = true, fillColor:uint = 0xFFFFFFFF)

the default value for transparency is true.Now consider what the docs say about the transparent parameter:

transparent:Boolean (default = true) — Specifies whether the bitmap image supports per-pixel transparency. The default value is true (transparent). To create a fully transparent bitmap, set the value of the transparent parameter to true and the value of the fillColor parameter to 0x00000000 (or to 0). Setting the transparent property to false can result in minor improvements in rendering performance.

It seems to say that this parameter is useless unless you set the fill color to black. So why then is the default fillColor value 0xFFFFFFFF?If a developer wants the performance gain of no alpha channel, it must be explicitly specified:

var bmd:BitmapData = new BitmapData(width,height,false);

And if a transparent BitmapData is required, that too must be explicitly specified:

var bmd:BitmapData = new BitmapData(width,height,true,0x000000);

So at no point can we rely on the shortest constructor form, without accepting a performance hit, and I can't understand why.Surely either the fillColor should default to black:

var bmd:BitmapData = new BitmapData(width,height); // transparent BitmapData

or transparency should default to false:

var bmd:BitmapData = new BitmapData(width,height); // faster, no-alpha BitmapData

View 1 Replies


Similar Posts:


ActionScript 3.0 :: 1203: No Default Constructor?

Sep 12, 2007

Base Class

[code]...

To work, I need to uncomment this constructor, or I get that error (1203:...)Why Base classes on AS3 doesnt directly inherity parent constructor? Why I must have to redefine it?

View 8 Replies

ActionScript 3.0 :: No Default Constructor Error Despite Call To Super()

Mar 15, 2010

I'm having a problem using superclass constructor with arguments. I've searched all over for the solution and found some really useful advice. Problem is i;ve followed it and it doesn't work... not for me anyway. So i've learned that you need to callthe super constructor in the subclass' constructor to avoid this error. problem is, this code still gets the same error....

[Code]...

View 1 Replies

ActionScript 3.0 :: 1203: No Default Constructor Found In Base Class Src:LoadWebPage

Feb 4, 2009

already searched for this kind of thread here but didn't get any answer that suited me.
It comes like this, I made this class (LoadWebPage)to basically remove the old Swf and load a new one. I've associated this class to my menu Btn's.

[Code]....

And I'm getting that 1203 error saying that my class doesn't have a default constructor.

View 5 Replies

ActionScript 3.0 :: Use The BitmapData Property Of A Bitmap And Pass It To The Constructor Of A New Bitmap Object?

Aug 20, 2009

I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?

My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:

Code:

var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);

LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),

View 4 Replies

ActionScript 2.0 :: Flash 8 BitmapData - Getting Error : The Class Or Interface 'BitmapData.loadBitmap' Could Not Be Loaded?

Jan 31, 2007

I'm using Flash 8, with this code in the first frame:

import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....

When I publish the file, I'm getting the following error message in the Output panel:

**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");

Total ActionScript Errors: 1 Reported Errors: 1

View 8 Replies

ActionScript 3.0 :: Error #2015: Invalid BitmapData At Flash.display::BitmapData()

Oct 14, 2009

I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
 
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()

[Code]...

btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..

View 10 Replies

Actionscript 3 :: Quickly Rotate The Pixels That Make Up BitmapData Without Using BitmapData.draw()?

Dec 29, 2011

I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.

View 3 Replies

ActionScript 3.0 :: BitmapData.hitTest - What Angle Or Coordinate Of The BitmapData The Collision Happens?

Sep 1, 2011

how to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.

View 2 Replies

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

Jul 15, 2009

I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?

View 2 Replies

ActionScript 3.0 :: BitmapData = New BitmapData(); Eating Up Memory?

Dec 22, 2011

I've made a mobile version of my software, with low-res images and such, and I can now fully buffer all my content (including a 360 frame animation which is buffered to memory). Problem is, that everytime I update the view, more memory is used.When I write image = new BitmapData();, does it store the previously created BitmapData's in memory? Do I have to flush the memory somehow before I draw my second picture in BitmapData?Example:

ActionScript Code:
// In this example I draw using the same bitmapData several times, also
//overwriting the first image. Do I have to somehow delete the data first, to

[code].....

View 1 Replies

ActionScript 3.0 :: Using BitmapData.draw(stage) - Error #2123 Security Sandbox Violation: BitmapData.draw

Jan 9, 2012

I am having an issue with using BitmapData.draw(stage). I am getting the following error:

SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:

var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.

View 4 Replies

Flash :: JS Conflict In IE For Mac

Dec 18, 2001

If you have a Mac check this out:[URL] Notice that in IE the Flash just disappears when you mouseover the rollover images. Also note that the rollovers swap very slow. There is a conflict here I just can't figure out.

View 1 Replies

ActionScript 3.0 :: Mouseover/mouseout Conflict

Mar 6, 2009

I have an image that grows on mouseover and shrinks on mouseout, and I'm using the following script for the events:

[code]...

The problem is that while the image is growing or shrinking,if the mouse is on the exact border it simultaneously gets stuck on both the mouseover and mouseout fuctions, resulting in seizure-inducing loop. Is there any way to ensure that a function completes once it's started, or some other way to avoid the simultaneous over/out condition?

View 3 Replies

Two Flash Elements On Page Conflict?

Oct 14, 2009

I have two differnt flash elements on a new webpage we are working on.  One is simply animated flames on a logo, the other is a burning image transition script I just bought.

[URL]
 
Why do the animated flames stop when the image transition occurs?  How do I fix it?

View 1 Replies

Flash :: Conflict Between Fonts In Swc And External Swf?

Apr 25, 2011

I have an actionscript 3 based website that is loading font outlines dyncamically, from external font swfs, using a common technique.

...
var FontLibrary:Class = e.target.applicationDomain.getDefinition("font") as Class;
Font.registerFont(FontLibrary.fontClass);

Everything works fine until I attach assets from an swc containing text with the same font.At which point only the outlines from the swc are used. So for exampe, if the swc has a dyncamic TextField, containing the letters "abc" then only those letters will display in the website and not the entire alphabets that where previously loaded dyncamically from the font swf.

View 1 Replies

ActionScript 2.0 :: Sound Function Conflict?

May 5, 2004

How can I change the following so it won't conflict with sounds inserted manually in keyframes. Currently when this function is active, the loop sound works but the other sounds don't play..

Code:
soundTrack = new Sound();
soundTrack.attachSound("loop");

[code].....

View 14 Replies

ActionScript 2.0 :: Movieclip Conflict On Mouse Over?

Nov 30, 2005

Im wanting to make a Movieclip budge when my mouse tries to go over it.Sort of a scattering effect.Say on my stage I have a movieclip, which contains a picture of a square.When my cursor goes near Square movieclip, it scatters, and reveals some text which is on the stage

View 2 Replies

ActionScript 3.0 :: Conflict On Using The Same Base Class

Mar 30, 2010

I'm creating an application with an animated kid figure. All the kid symbols sit in a kidLibrary.Fla file, Each of these symbols have a class named "Kid" linked to it on its Properties >Base Class. This Kid class is responsible for setting the right color and hair type for each kid symbol instance. Every time i need to include one of these kid symbols i drag it to the current .fla file I'm working on. If I place only one kid symbol in the library of the file I'm working on, everything works fine!

Now here is the problem: When i place more than one kid symbol in the library, and then drag it to the stage, then one of the symbols works fine while the other one doesn't seem to access all the properties of the Kid base-class. The result is that only one symbol act perfect while the other one(s) not.

[Code].....

View 5 Replies

ActionScript 3.0 :: Keyboard Event Conflict?

Sep 8, 2010

I'm an artist, not a developer, but I work with various media. I am so~so with AS3 and JS and a total noob with PHP and databases.Anyway, I am writing a Class based on keyboard events and I am finding that if the keys are hit too fast the triggered events don't complete.I'll explain further:I have a picture broken into parts (a red background here, a blue stroke there, and so on). Each one of these elements is a Library Object, and they are all set to alpha=0, and each one in turn, is tied to a key on the keyboard. When the key is struck, the picture element goes to alpha=1, plays a sound, and starts tweening back towards alpha=0.

Code:
public class TypedImageV4 extends MovieClip {
public function TypedImageV4() {

[code].....

View 8 Replies

ActionScript 3.0 :: Conflict With Imported Classes?

Sep 21, 2010

An unashamedly naive question, I'm afraid, from someone trying to get to grips with as3 classes... I have a movie clip (a car) on the stage that's linked, through the 'Class' field in the symbol properties dialogue box, to a class which allows it to move. This works fine, until I attempt to set up collision detection for a movieclip representing the track, by importing a CollisionDetection class; then, the car movement class does not appear to be imported at all. Neither does it appear to work when I include any import statement on the main movie's timeline.

View 2 Replies

ActionScript 2.0 :: MC Conflict - Attach Graphics

Apr 9, 2005

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.

View 2 Replies

ActionScript 3.0 :: Drag And Drop Conflict With Mouse?

Aug 8, 2009

What i'm trying to do is make a drag able square and use a different cursor that I made to do so. It worked fine until I added the code for the cursor.[code]...

View 1 Replies

ActionScript 3.0 :: Code Conflict With Document Class?

Aug 14, 2010

the first code (which I put into a frame) is somehow in conflict with my document class.I get these error messages:

1046: Type was not found or was not a compile-time constant: URLRequest
1180: Call to a possible undefined method URLRequest.
1180: Call to a possibly undefined method navigateToURL

But when I only use that code and unlink the document class it works. So there must be somehow a conflict between the two, but I have no idea how to integrate this code into my document class -I already tried it but the error messages keep coming, probably I didn't do it right.

code in frame:

Actionscript Code:
btn_contact.addEventListener(MouseEvent.CLICK, contactClickHandler);function contactClickHandler(event:MouseEvent):void {    var url:URLRequest = new URLRequest("../Subpages/SubpageContact.html");    navigateToURL(url, "_top");}

[CODE]....

View 1 Replies

Professional :: Transparent WMODE And OnClick Conflict?

Feb 1, 2010

I have a flash project that when published with the "Transparent Windowless" Window Mode setting under File, Publish Settings, under the HTML tab... the following Action Script 3 code causes the link to be blocked by the IE 7 and 8 pop-up blocker when I use the "_blank" target and embed the flash movie on my page in Dotnetnuke, however if I use the "_self" target the link opens fine in the same window. If I publish the Flash project using the "Window" Window Mode the link opens in a new window with the "_blank" target without a problem. I need the Transparent setting because I have a menu bar on my page the drops down over the Flash and the menu goes behind the Flash movie unless it is published using the transparent setting.

[Code]...

View 2 Replies

ActionScript 3.0 :: An EnterFrame Event And A Timer Conflict?

Apr 15, 2010

I have a hitTest on an enterFrame event that adds a movieClip.I then want the movie clip to be on a timer that changes it to another movieClip.As you can imagine, there is a conflict because the hitTest always finds the original Mc an so over-rides the timer.I know this is a logic problem but I cant seem to figure it out.I am pretty sure I am thinking about this the wrong way.here is some of the code:

//this is the hitTest
this.addEventListener(Event.ENTER_FRAME,leftPillarHit);
function leftPillarHit(ev:Event):void {

[code].....

View 1 Replies

Professional :: Massive Internet Explorer Conflict

Jul 8, 2011

I got this website at work which I've just updated.It was working pretty well, yesterday I showed it to a friend.And it was working perfectly. This morning, I hear sound but all i get is a black screen.It works on every other browser (chrome, firefox, SeaMonkey, etc.) but in Internet Explorer, black screened.If anyone can,I need a quick solution, my bosses are freaking out and that is kindda out of my league as for "trouble shoot".Why something that was working not even 12 hours go goes awry on me today?

View 2 Replies

Actionscript 3 - Flash TouchEvent And MouseEvent Conflict?

Jan 8, 2011

I have 2 controllers on my stage, one behaves like an analog controller (A) for left/right up/down etc, controlled with a TouchEvent. The firing controller (B) is bound to another TouchEvent.problem is TouchEvent seems to be much slower than using say MouseEvent.MOUSE_DOWN for controller (B) which results in a much faster firing mechanism. If I am using TouchEvent to control (A), and MouseEvent.MOUSE_DOWN on controller (B), (B) will not fire unless I release (A) meaning I cannot move and shoot at the same time which is frustrating, but I can use a MouseEvent for controller (A) and a TouchEvent for controller (B). how I can stop the conflict?

View 1 Replies

ActionScript 3.0 :: External Classes Version Conflict?

Jul 7, 2009

Scenario:swf B compiles with class Vo in it and displays it's values swf A compiles with a revised version of Vo in it and loads swf B

Result:
swf B shows swf A's revised Vo class properties and not the version it got compiled with even though nobody told swf B to change it's Vo properties.

Has anyone encountered these kinds of situations? How is everyone dealing with this?

[EDIT] Since the forums still seem to be broke, you can grab my sample files here. Compile B.fla and then change class Vo version property and you'll see when you compile A that B display's the new Vo version. Link to Files

View 4 Replies

ActionScript 3.0 :: Duration & Last Timestamp Conflict On .Flv File

Dec 9, 2009

I have a video, it's 3:11 but it will only play until 2:41 then it will stop...... but when I fast forward to 2:42 or 2:43 it will play till the end..... how do I fix this file so it will work..... what do I do.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved