ActionScript 3.0 :: Access The Rotation Property Of Bitmap
May 24, 2009
I am completely new to using Flash and AS, so I decided to start off with something that seemed simple enough, rotating an image. Turns out it's anything but simple. My initial idea was simply to have two layers, on one of which I had the image I wanted to rotate, and above that some other image that was transparent. I've had lots of problems with this but I have managed to hack my way through to some solutions. I would like for someone to confirm if I have understood these solutions correctly.
One problem was that I implement my images (which were BMP at first but now GIF) as Bitmap, and they sit in the library and on stage, so they're visible when I run my Flash movie. However I had problems figuring out how to access the rotation property of my Bitmap, and what I ended up figuring out is that apparently even if it's loaded on the stage and in the library, it can't be used by AS as such. So I ended up having to use Linkage and making a SkyClass, which I then use to make a Sprite, which I can then change the orientation of. But is that really how I have to access my Bitmap, even if I put it on the Stage designtime?
[Code]...
View 11 Replies
Similar Posts:
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
Dec 15, 2009
I've been developing an application which uses a lot of sprites to create a 'wheel of fortune'-like object. Since I use several filters, sprites, countless calculations, and various other tricks to draw it, it became painfully slow to try to spin that, as flash had to redraw everything every frame.
Needless to say, I took the bitmapData 'snapshot' approach - I drew the massive combined sprite to a bitmapData, removed the original sprites, filters, et al from the display list and nulled them, Threw the BMD into a Bitmap object, placed that in a container sprite so that I wouldn't have to continually use a matrix to rotate from the center when it registers at the top left, and started rotating the container.
Unfortunately, it seems that rotating the container with this 500x500 Bitmap in it is nearly as slow as it was when I hadn't snapshotted it and rotated the whole thing, filters and all. I have already played with the BitmapData's transparency, turned on and off cacheAsBitmap on various combinations of containers and the bitmap itself (hahaha), checked the Bitmap.smoothing property out, blah blah blah, the whole nine yards. Rotating a decently sized Bitmap (thus making pre-rendered/calculated frames a really bad idea) ... how do I make this run at a tolerable speed without eating my CPU and turning the fans on?
View 7 Replies
Mar 1, 2009
I've included the full class called Navigation.as. The class basically draws navigation elements on screen and displays them onMouse over and out. What's also neat is that it actually "rotates" them onto the screen. Now I'm using a font called "Minx" which is a bitmap font. However when the rotation occurs the image quality and the text ends up looking *really* blurry. It appears others have noticed this issue: [URL]. The issue is thus that when Flash converts the MovieClip to bitmap it's perspective distorts the quality.
View 1 Replies
Oct 22, 2010
So, you have a sprite, you draw some graphics, you set cacheasbitmap=true... I can't seem to access the newly created bitmap data, to access the dispose() method.
[Code]...
View 6 Replies
Jun 24, 2009
I recently installed Flash CS4. As I attempt to learn from different tutorials I've run into a problem I can't figure out. I've watched the video tutorial at: [URL] several times to try to emulate the rotating logo. The problem I run into is when he says to open the Motion Editor and to edit the Rotation Y and Rotation Z properties. When I open my Motion Editor there is no Rotation Y or Rotation X. There is only a Rotation Z property. I've played it over and over to try to discover what setting I've missed but don't see it. How do I see a Rotation Y property to be able to edit it?
View 2 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
Aug 18, 2009
Does anyone know if AS3 or FP9/10 enforces a minimum increment or resolution for the Sprite rotation property?It seems to only allow rotations in multiples of 0.25 degrees.For example:
var lines:Array = new Array();
for (i=0; i<2000; i++){
lines[i] = new Shape();
lines[i].graphics.lineStyle(.1, 0x000000);
[code]...
This draws the lines in groups at 0.25 degree spacing with gaps between them.
View 2 Replies
Sep 12, 2011
Im trying out some basic OOP.. and cannot understand where I am going wrong. It works within the timeline - but when I transfer to Packages It doesnt work where concerning the property of the bitmap. I have a 'MyClip' instance in the library. here is my bask Document Class package::
[Code]...
View 4 Replies
Feb 16, 2010
is it possible to get access to Flash's internal bitmap cache of an object when CacheAsBitmap is on ?
eg, something like:
var bmd:BitmapData = someDisplayObject.getCachedBitmapData();
if (bmd != null)
trace("stoked!");
else
trace("bummer. got to bmd.Draw(someDisplayObject) ourselves.");
View 1 Replies
Sep 17, 2009
is there anyway to access the internal bitmap representation of a movieclip that has its cacheasbitmap property set to true?It would be nice if I could create vector artwork that scaled to the size of the browser and then obtain a bitmap representation of it so that I could then manipulate it on a per pixel basis for some cool visual fx.
View 1 Replies
May 3, 2010
I'm writing a simple little test app consisting of 'main.as' and 'test.png', both within the same subdir on my harddrive. I'm compiling via command line with mxmlc, and testing via 'open with...' and Chrome. The code uses flash.display.Loader.load( "test.png" ) - but I can't access the loaded content (or even draw it to a bitmapdata!) due to security exceptions.
My goal is to get the image into something (preferably a bitmapdata!) I can draw to other bitmapdatas, as I understand this is fastest for gaming. I've tried all sorts of things, including creating a 'crossdomain.xml' that goes in the same dir as the above files (and doing the appropriate LoaderContext thing), tried various system.Security things and still no joy.
View 1 Replies
Mar 16, 2011
I know there are a number of posts dealing with this issue. But, I'm still not understanding it.I keep getting a "1120: Access of undefined property CSSloader." in the following script:
package as3.comp{
import flash.events.Event;
import flash.events.ProgressEvent;
[code]........
View 1 Replies
Sep 3, 2009
I need to access the property Access inside of my class. Actually I can do this in my FLA Reader.Access, but take a look in onComplete function, this function try call Access, but nothing happen.[code]
View 2 Replies
Sep 7, 2010
BTW the code i have below works, but when i try to have an animation sequence it doesnt work..menu is a movieclip i made then inside it are buttons like read for example in my code,,menu.read w/o animation works but when i place an animation to make it have a cool intro i get the error. [code]...
View 7 Replies
Jan 7, 2010
I have a movieclip and when I do 3D rotation from Transform panel, It rotates perfect, center is in the middle of image, and when I apply mc.rotationY, rotation center is in left of the image, aren't 3D rotation from Transform panel and mc.rotationY from AS same? what's up?
View 2 Replies
Mar 23, 2011
I'm trying to do some augmented reality projects with flartoolkit . I can now put simple 3d objects on my marker and it works fine , but I wanna give my project some events that the user can interact with. I'm trying to trace the rotation of the marker. there's a container:DisplayObject3D which my application uses to add the 3d objects , I traced this :"trace(container.rotationZ)" but it's just returning 0 . I studied another AR application's source code and it was using the rotation of it's container object without problem .and I think I should mention that I'm using the exercise file of seb lee delisle papervision3d course from [URL]. anyone has any experience with flartoolkit? the main functions of my my code is as below:
[Code]...
View 1 Replies
Aug 11, 2010
Is it possible to have the child movieclip rotate separate of the rotation properties assigned to the parent? so ultimately giving the child element it's own axis?I've customized Lee Brimelows (gotoandlearn.com) 3D carousel to spin on the x axis to make it a vertical carousel. I've also rotated that by 45 degrees on the y axis to see all the items, and wrote a snippet of code to hide the left portion of the carousel. The entire carousel is contained within the 'container' movieclip, and inside of that are my carousel items (as seen below), with the larger item being the item in focus.
On rollover of the item in focus, I want to rotate it so it faces the viewer (as seen below),basically removing the 45 degree rotation applied to the container.The problem i'm running into is when you rotate the container (changing the rotationX of the container), the axis basically rotates with it, so when i rollover the next item 'in focus', the following happens..(in the example where it appears how it want it to, the carousel is at a rotationX of 0, so it works fine)
View 2 Replies
Oct 23, 2010
i am working on a flash liquid website on AS3. The main fla file works with the website.as file where all the code adjusts all the movie clips on the stage. (middle, top left, top right, low left etc etc)This works fine...however.. when i add buttons and interactivity to move to another frames on the timeline inside the middle movie clip i get this stupid errorCannot access a property or method of a null object referenceI got this before and i know that flash doesnt read the instance of the button..
View 2 Replies
Jun 29, 2009
I have an app where I am wanting to use some movieclips when clicked on to remove the current movieclip and add a new movieclip. My problem seems to be that whenever I refer to the homeArtist_mc movieclip I get an error.
For example on line 50 in my actionscript I have
homeArtist_mc.buttonMode = true;
And I get this error
1120: access of undefined property homeArtist_mc.
Attachments: index004.zip (1.6 MB)
View 2 Replies
Dec 14, 2009
i have gave this action on the timeline but i m getting this error (Access of undefined property)
close_btn.addEventListener(MouseEvent.CLICK,connection);
function connection(evt:MouseEvent):void
{
[code]......
View 1 Replies
Nov 6, 2010
Here's the context of the problem, in which I will try to include as much information as possible while keeping the explanation brief.
I am trying to make a portfolio website (architectural design + concept art). Flash / programing are not my focus and this is my first go at learning the software. Due to the nature of the content and my (lack) of ability in AS3, I want the the coding to be really simple and still let the site look good. The way the site is currently structured:
1) Basic menu buttons that navigate to sections of the site (brings up a new page).
2) Example, clicking on <Graphics> takes you to a new page and a sub-menu animates in (simple motion tween for the buttons to cascade down). This animation is a movie clip placed on the main timeline.
3) On the screen is also a slideshow for all the images within <Graphics>.Instead of multiple small slideshows, I combined them all into one, so as to avoid complications with add / remove from stage. There are prev / next buttons that keep images within their sub section (ie 1->2->3->1). The sub-menu buttons are suppose to link to the start of each sub section, much like chapters on a DVD. (The slideshow is a movieclip sub-nested in the menu movieclip).
View 4 Replies
Mar 25, 2010
first of all I am completely new to AS3.I want to create a simple website, with 3 buttons.Once you click on the button, content should appear next to it. But i have trouble
programming even one button.Here is the script:
stop();
photography_btn.addEventListener(MouseEvent.CLICK, photoclick);
function photoclick(event:MouseEvent) {
[code]....
View 2 Replies
Jun 18, 2010
I name frame 50 "_foo" (in the IDE)
I can trace this._currentframe at any time (and get a number)
I can gotoAndPlay("_foo");
But how can I find out if the current frame IS "_foo" as the movie plays?
View 1 Replies
Jun 24, 2009
This works:
ActionScript Code:
var gc:Rectangle = (textField[11].getCharBoundaries(startIndex));
trace (gc); // returns (x=32.7, y=2, w=4.15, h=8.85)
[Code].....
There are some documented bugs in getCharBoundaries, but this seems fine as it will obviously retrieve the relevant values. I can't believe I have to pull out the x value using toString() and a RegExp
View 9 Replies
Nov 19, 2009
Getting: TypeError: Error #1009: Cannot access a property or method of a null object reference. at CatProcess()
Don't know why. When I run it, it's the userName_iBox that isn't being added to the stage so it must be to do with that but I can't see whats wrong with it.[code]...
View 2 Replies
Aug 13, 2010
I've got on main timeline (on frame 10) buttons, when I click one of them it goes to its currentLabel"". On curerntLabel at frame20 "racerButton" where I've got some tweening. At currentLabel "boardButton" at frame30 I load external swf.The problem I've got is when I press any button everything works fine. But when I first press button "boardButton" at frame30 the ext.swf shows up fine, but when next I click the button"racerButton" at frame20 the tweening doesn't work there and it gives me error.[code]when I press any button everything works fine except from bordButton to racerButton
View 0 Replies
Sep 17, 2010
I have one class which is assigned to dropBar MC:
ActionScript Code:
import src.DropDown;
var inheritanceDrop:DropDown = new DropDown(dropBar, 1);
[code].....
View 5 Replies
Feb 4, 2011
i keep getting that error and cannot figure why. This is my code:
Code:
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
[code].....
View 2 Replies
Oct 28, 2011
I am working on a piece of code and I am getting bizar Access of undefined property name errors. I am posting my code below. About half way through the function, references to "name" become undefined.
Code:
private function getIcon(_name:String):int{
//5 is min length valid name can be y.xxx
if(_name == null || _name.length <5){
[code]....
In all the code past this method, all the variables and class names are showing as undefined.
View 4 Replies