Actionscript 3 :: Rotating An Image, By 90 Degrees, That Was Loaded From Url?
Nov 10, 2010
I got an error saying "Attempted access of inaccessible method rotation through a reference with static type flash.display:Sprite.ssd.rotation(90)}" I just want to know how to rotate my image by 90degrees when I double click on it.
var shootingstar:Loader = new Loader();
shootingstar.load(new URLRequest("http://i51.tinypic.com/m8jp7m.png"));
shootingstar.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
var ssd:Sprite = new Sprite();
I am trying to rotate this text 90 degrees. I've read that you're supposed to embed the text....and I've tried that and the text just vanishes. I've also tried to set my own text format, but the problem persists.
Code: var tf:TextFormat = new TextFormat(); tf.font = "Verdana14B"; tf.size = 14;[code]...........
I need to get a certain object to rotate by set degrees (my navigation for this project is organized on a wheel--6 sections on the wheel), and I would like to have buttons that tell this object to smoothly rotate by set degrees (intervals of 60 degrees in this case).
What I have in mind are 5 buttons that control the rotation: 1. 120 deg. ClockWise 2. 60 CW 3. 60 CCW 4. 120 CCW 5. 180 CCW
I've created some code that rotates an arrow up or down when the user clicks on it, depending on whether the timeline is on frame 1 or 5. The problem I am encountering is that rather than rotating visually, it just flips to the correct degree (in this case, 0 or 180).
Code: function turndown():Void{ for(i=0; i<16; i++){ this.upDownMC._rotation += 11.25; }} function turnup():Void{ [Code] ......
getting a certain object to rotate by set degrees (my navigation for this project is organized on a wheel--6 sections on the wheel), and I would like to have buttons that tell this object to smoothly rotate by set degrees (intervals of 60 degrees in this case).What I have in mind are 5 buttons that control the rotation:1. 120 deg. ClockWise2. 60 CW3. 60 CCW4. 120 CCW5. 180 CCW
I'm new to Flash and I'm having trouble rotating my mc 360 degrees using the 3D Rotation Tool. I can rotate it 180 degrees, right side coming forward, but when I attempt to rotate it back to its original position, it doesn't continue the rotation in the same direction (right side coming forward). So instead of apearing to rotate completely, it looks like it rotates half way, stops, and rotates back (left side comes forwards). Probably an easy solution, but as I said, I'm new.
when I rotate my avatar. So while "this.rotation = 270" rotates it the correct amount, it registers as being rotated by -90 degrees. Thus, if you type "if(this.rotation == 270)" it won't ever be used.
My character movement has been working all day, now I changed the rotation because I added eyes to my character. Soo... Apparently rotating my character by 270 degrees and then hittesting my LevelArray doesn't bounce him back the way it should, and does, if the rotation is at 90 degrees.
Here is my code:
Code: public function enteringFrame(evt:Event) { if (elementStatus == 0 || elementStatus == 2) {// No collision
[Code]...
Again, the other movements work, and the left movement works too, only when hitting the wall from the left it stops. Hitting the wall from all other sides is fine.
i am terrible at explaning things but i'm going to try my best.for example. I have a rotating turret that will follow the mouse 360 degrees.so i wonder if it is possible to go inside the turret ("mc") and stop at frame (2);when the turret reaches 170 degrees.
rotating an object based on 90 degrees. For example, I only want the characters rotation values to be 0, 90, 180, or 270 based on the angle between the mouse and an object. I used to know a formula that worked right into the atan2 method, however sadly I had forgotten it
how to rotate an image loaded using CameraRoll on an AIR for iOS app. This code below works fine (displayImage() is called when CameraRolls media event returns completed, and imageArea is the scrollPane where the image is shown.
function displayImage():void { var image:Bitmap = Bitmap(imageLoader.content);
[Code].....
With the second version the image seems to load because the scroll bars expand to the size of the image I choose, but I don't see anything on the stage.
how to rotate about the center an image loaded dynamically through AS? I've already asked this question, no one answered, I searched, searched some more, looked through my fairly voluminous collection of example flas and have come up with nothing.The following code does rotate a mc about its center, but only (apparently) if the mc contains something when the swf loads.
Code: onClipEvent(load){ this.rotation_speed = 2; function origin(){[code].....
How can I rotate an Image eg. 180 degrees clockwise using the Matrix. I can use the following code to rotate the image 90 degrees, but it is incremental, meaing
var matrix:Matrix = new Matrix(); matrix.rotate(Math.PI/2); matrix.tx = imgControl.content.height; var bitmapData:BitmapData = new BitmapData(imgControl.content.height, imgControl.content.width); bitmapData.draw(imgControl.content, matrix); imgControl.source = new Bitmap( bitmapData);
I have spent hours trying to figure out how i could rotate a loaded movie through the centre axis rather than the set point set by flash in the left corner.
Background info: I am using ActionScript 2.0 and Flash CS5I was working on a game and I used photoshop to save a little gif image. I imported it into flash, "broke it apart", turned it into a movie clip, and put this bit of code on it. It rotates the image when the mouse is moved around it.
Code: onClipEvent (enterFrame) { // find x and y differences
I have a disc I am rotating with the mouse with event.MOUSE_MOVE, like a jog wheel on some audio equipment. Everything almost works as expected, but the problem I am experiencing is that the disc always jumps to the point where the user clicks on the disc. I need the point on the disc that the user clicks on to remain under the mouse while the user spins the disc but I can't seem to come up with the correct math to make it happen. Here's the code i am using:
var xd = (_knob.x - _stageRef.stage.mouseX); var yd = (_knob.y - _stageRef.stage.mouseY); var radAngle = Math.atan2(yd, xd); _knob.rotation = int(radAngle * 360/(Math.PI * 2) - 90);
_knob is a vector circle wrapped in a movieclip, with the circle centered on the movieclip's reg point. _stageRef represents the main stage.
I found this code online and he achieved a particular movement I want to use. Unfortunately, he's using numerical values instead of text. I followed all of his instructions, but I tried to replace the Vector with an array, and received an error. The error I have been receiving is "1199:type parameters with a non-parameterized type." That's because I added an array value instead of an vector, which this guy has done. What he has in his tutorial is correct with numerical values. Also he created a .as class called Item.as. Here is the AS code that is in the main timeline in a new layer called actions of my .fla file called rotate.fla:
//Save the center coordinates of the stage var centerX:Number=stage.stageWidth/2; var centerY:Number=stage.stageHeight/2;
I am designing an image gallery to show project screenshots for a portfolio. The horizontally scrolling screenshots technique is nice, but I want to do something similar in 3D space.
When the user clicks on the screenshot buttons for the selected project, I want the appropriate image to rotate around an imaginary center, increase in scale, and fade in to full opacity.
At the same time, the other images need to rotate around the same center point and scale down while the alpha decreases. The Screenshot furthest away from the viewer would have the smallest size and lowest alpha setting. Here's a couple things that might throw a wrench into the works. I need to keep all the images facing forward (instead of rotating as if they were on a cyllinder). Also, not all of my projects have the same number of screenshots. Can I do all this with actionscript?
I am designing an image gallery to show project screenshots for a portfolio.The horizontally scrolling screenshots technique is nice, but I want to do something similar in 3D space.When the user clicks on the screenshot buttons for the selected project, I want the appropriate image to rotate around an imaginary center, increase in scale, and fade in to full opacity.At the same time, the other images need to rotate around the same center point and scale down while the alpha decreases. The Screenshot furthest away from the viewer would have the smallest size and lowest alpha setting. Here's a couple things that might throw a wrench into the works. I need to keep all the images facing forward (instead of rotating as if they were on a cyllinder). Also, not all of my projects have the same number of screenshots. Can I do all this with actionscript?
I have 2 images, a base and a top. I want the top to rotate to face an object but the base to remain constant. I can get close but when the top rotates it is rotating around the corner of the rectangle it is placed inside of rather than the center. Here's the AS code for the object.....but the important elements are bolded.
public class Turret extends MovieClip{ private var _root:MovieClip; [Embed(source='mortarbase.png')] private var mortarBase:Class; private var mbase:Bitmap = new mortarBase(); [Code] .....
I am in the midst of finishing up a design application where you can upload images and colors. I use the greensock transform manager. I am taking anything a user does and recording it so I can recreate what they made on larger scale behind the scenes (to be exported for printing purposes)
The problem I am running into is with rotation and moving x and y values. The transform manager does everything relative to a center point, but when i recreate the image object the registration point is at the top left. I have found how to rotate around the center of the object using the transform matrix, but I can't seem to move the x and y correctly because these values change when you rotate. I want to just move the image to the left or right relative to the center. How could I go about doing this.
Here is how I rotate.
private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) { var m:Matrix=ob.transform.matrix; m.tx -= ptRotationPoint.x;
I am having a quality issue when rotating images dynamically loaded into movieclips. I am not resizing them. I am only rotating them. I have tried applying smoothing to the bitmaps, but that has not helped.
It seems that after sometime working on this i have been able to come up with something which works the way i want it too, however there's this small problem. When i hover really fast over my buttons, it feels like flash just has a meltdown and stops running the function i have inside my button onRollOut.
So i got 5 frames with names "marine", "architectural", etc
In the first frame "marine" there is the following code (i've only included 1 of the buttons, but there another 4 with identical code where appropriate):
Code: stop(); //enter current[] and goto[] //current[marine][2] -> next[architectural][3]
I have the 3D rotating cube. Each panel of the cube is an image pulled in through actionscript. When you click on one of the panels, the cube straightens itself to show only the face you've clicked on. This is all great. However, I want to be able to click on that face again and have it link to a URL. This is where I get lost.
I feel like I'm ALMOST there - I've gotten it to work so that I can click the panel and it links to a URL, but right now every panel links to the same link. I haven't figured out how to make each panel link to its own separate URL. Here is the portion of code in my .FLA where I've added the linking action:
Code: setupFaceAction = function (cube) { for (var i = 0; i<cube.faceArray.length; i++) { var face = cube.faceArray[i]; face.onPress = function() { if (!cube.fading) { [Code] .....
This is the line I added to make it link when you click the panel after it's facing forward: Code: cube.getURL("[URL]", "_self");}
So I assume I need to set up some sort of array so I can have multiple links that correlate with the appropriate image. To make it clearer, I've attached all of my files, so you can see all the code. You'll find actionscript in the .FLA and two external actionscript files. I think "cube.as" may be where I need to do the work.
EDIT: It seems that after sometime working on this i have been able to come up with something which works the way i want it too, however there's this small problem. When i hover really fast over my buttons, it feels like flash just has a meltdown and stops running the function i have inside my button onRollOut.
So i got 5 frames with names "marine", "architectural", etc
In the first frame "marine" there is the following code (i've only included 1 of the buttons, but there another 4 with identical code where appropriate):
Code: stop(); //enter current[] and goto[] //current[marine][2] -> next[architectural][3]
I'm making a small Flash game, which is rotating rings in an image to create a coherent picture. Think of the puzzles in Assassins Creed.I have three scenes set up, one with the puzzle, one with a fade to white transition, and one with a congratulatory screen.
I have this code to check if the orientation of the rings match, but I'm really new to actionscript so I'm not sure if it's right or not.
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?
Some images I load dynamically are too big so I would like to scale them to fit the stage.
[Code]...
this returns 0. Why does it return 0 when the image loaded is obviously much larger then 0 pixels. How do I change the width and height of imgCont to a specified dimension.
I have my main swf (swf1), that loads another swf(swf2). At some point, swf2 loads an external image. What's the best way for swf1 to align the loaded image from swf2??
How should I go about cloning an image loaded form the server and adding it to the end of the first image loaded? Would I use bitmap clone? My attempts with this failed[URL]
Code: //Creates new image loader var imageLoader:Loader;