Flash :: Flex - 3D - AS3 - Convert Degrees Of Rotation To Visible Height

Nov 5, 2009

I need to know what the visible height of a display object will be after I change it's rotationX value. I have an application that allows users to lay out a floor in 3D space. I want the size of the floor to automatically stretch after a 3D rotation so that it always covers a certain area. EDIT: I guess what I am really trying to do is convert degrees to pixels.

On a 2D plane say 100 x 100 pixels, a -10 degree change on rotationX means that the plane has a gap at the top where it is no longer visible. I want to know how many pixels this gap will be so that I can stretch the plane. In Flex, the value for the display objects height property remains the same both before and after applying the rotation, which may in fact be a bug.

EDIT 2: There must be a general math formula to work this out rather than something Flash/Flex specific. When viewing an object in 3D space, if the object rotates backwards (top of object somersaults away from the viewer), what would the new visible height be based on degrees of rotation? This could be in pixels, metres, cubits or whatever.

View 5 Replies


Similar Posts:


ActionScript 1/2 :: Inconsistent Rotation - 270 Degrees Of Rotation Disappear?

Apr 21, 2009

Program A has a cannon that aims to line up with where-ever the mouse is pointing, in 360 degrees, and fires when the mouse is is clicked. Program B has an eye instead of a cannon that should in theory do similar functions when the capslock key is toggled, but instead only has a 90 degree range of motion from the Right of the eye toward the bottom (quadrant 4 only). Where did the ther 270 degrees of rotation disappear to?

[Code]...

View 4 Replies

ActionScript 3.0 :: Rotation Troubleshoot: Where Is 270 Degrees?

Oct 19, 2010

I am rotating an object by incrementing in 90 degrees,however after 180degrees it rotates to -90...then it can't quite make it's mind up if it should go to -180, or 0, which should be the same thing? (except it messes up my if statements down the line)(by that I mean, sometimes it will go back to 0, and sometimes it will switch to -180??)Where is 270, and for that case, 360?

View 2 Replies

Professional :: Rotating Mc 360 Degrees Using The 3D Rotation Tool

Nov 30, 2010

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.

View 9 Replies

ActionScript 3 :: Calculating Degrees For MovieClip Rotation

Sep 6, 2011

I've a movieclip representing an arrow (with registration point in its middle). When I click a button, the arrow must point to a certain movieclip on stage. I use this code to execute the Tween:
TweenLite.to(arrow_clip,1,{rotation:degrees});
But I can't understand how to calculate the degrees. I tried the following with no luck:
var degrees =Math.atan2((clip.y-arrow_clip.y),(clip.x-arrow_clip.x))*(180/Math.PI);
I found the following is working but I can't completely understand why:
var degrees = -(Math.atan2(arrow_clip.x-clip.x, arrow_clip.y-clip.y))*(180/Math.PI);

View 3 Replies

ActionScript 3.0 :: Tween Rotation 180 Degrees On Each Button Click

Mar 30, 2011

I have set up a motion tween using the flash tween class to rotate an image 180 degrees. However, if I should want to work wit hthe image from that point (say click the button again and have it rotate another 180 degrees back to its original position) I can't. It will simply run the tween again because my function specifies to go from 0 to 180. How I can use the tween class to rotate this image 180 degrees on each button click?

Code is below:
import fl.transitions.*;
import fl.transitions.easing.*;
import fl.transitions.Tween;
rotation1_btn.addEventListener(MouseEvent.CLICK, rotateThePicture);
function rotateThePicture(event:MouseEvent) {
//IMG11_mc.rotation += 180;
var PicRotation:Tween= new Tween(IMG11_mc, "rotation", Strong.easeInOut, 0, 180, 5, true);
};

View 2 Replies

Flex :: Change S:VGroup Height When Child.visible Set To False

Nov 12, 2010

I have a code similar to this:

<s:VGroup>
<s:HGroup verticalAlign="middle">
<s:Label text="label" />
<s:TextInput id="rmName"/>

[Code].....

I want that the s:VGroup container has the height only of its visible children. In this example there is a free space even the visibility mx:HorizontalList is set to false. Every time I change the visibility of the child element I want that the parent (s:VGroup) will change his height. How to do this in flex?

View 1 Replies

Flex :: 4 - Move All TitleWindows Instances Within The Visible Area After Application Change It's Width / Height?

Jun 8, 2011

Is there a nice and not much processor consuming way to move all TitleWindow instances within the application visible area when the application been scaled - change it's width or height ?

View 1 Replies

ActionScript 3.0 :: Convert Slope To Degrees?

Jul 7, 2011

I'm having trouble with this mainly because Flash's Math.atan() doesn't give the same results as my TI-83's tan^-1 function.

If I have a line with a positive rise and run for the slope and use tan^-1( (the slope) ) on my calculator, I get a value between 0 and 90, with 0 being a horizontal line and 90 a vertical line. A negative numerator with a negative denominator for the slope puts it in quadrant 4 where tan^-1(slope) gives 0 to -90 values, again with 0 being horizontal and -90 being vertical.

Putting the slope of the blue line into tan^-1() would give a value of about 80 degrees, while the red line would calculate to about -50 degrees. The rotation property Flash uses rotates objects clockwise and can range from 0-360. Using the -90 to 90 values and figuring out if the rise and run of the slope are positive or negative, I can determine which quadrant the line is in and calculate the degrees.

However, this so far is not possible for me because Math.atan() gives odd results.

A practical application for this knowledge would be a player in a game throwing spears from (0,0) to the mouse x,y. The slope would take care of the trajectory of the spears, however if your spear sprite is a spear flat and facing toward the right, you need to rotate it appropriately from 0-360.

View 1 Replies

ActionScript 2.0 :: MovieClip -ve Rotation-Height Is Not Assigning In Flash 8?

Nov 3, 2010

Here i ve create 2 movieClips outer,inner (outer.inner) .Am rotating outer movieClip to 90 degree. and am giving -ve rotation to inner movieclip.Then am loading images.jpg to inner movieclip ans setting width,height. Here height is not changed.ie .,value not taken to assign 4.If i trace am getting Wid:4 Hei:42.5

Code:
outer._rotation += 90;
outer.inner._rotation = -90;

[code].....

View 3 Replies

ActionScript 2.0 :: X, Y To GPS - Convert A Decimal Value (like 10.25) Back To Degrees And Hours?

Apr 18, 2006

if I have a map of say, Wisconsin, and I know what the Latitude coords (degrees, hours, minutes) of the top and bottom of the map, and I know how many pixels tall the map is, then I should be able to convert, with math, degrees:hours:mins to pixels. (same thing with longitude, but lets just focus on one way first)

I would first find out how may hours (minutes would be over kill for my app) there are to a pixel. Thats pretty easy. But this gives me a decimal number. How do i convert a decimal value (like 10.25) back to degrees and hours (in other words, how do i make .25 a "60" based value)? Ultimately, i want the user to be able to input coords in the form of degrees, hours, mins. Then convert that to X, Y (to place a marker on the map).

Has any one had experience with this or know how to do this?

View 3 Replies

Flash :: Alternatives To Colin Moock's Approach To Visible Width/height Of DisplayObject?

Jan 12, 2010

Has anyone got any alternatives to what Colin Moock has coded to GET VISIBLE WIDTH/HEIGHT OF A DISPLAY OBJECT in ActionScript 3? That esp. in perspective of DisplayObjects that have 3D transforms applied and visible dimensions of which you need to consider for a calculation.

View 2 Replies

Actionscript 3 :: 360 Rotation Degrees To 2d Object From 3d Papervision Object

Mar 11, 2010

I have a papervision camera of which turns using keyboard input, I have a radar of which I would like to orientate to direction when the camera turns.I have it all working apart from mapping my (camera) DisplayObject3D.rotationY to RadarInterface.rotation correctly.The camera (or any 3d object) works with values I'm finding hard:Clockwise: 0 to 89, 89 to 0, -0 to -89, -89 to -0 doing a complete 360.So if I were to turn 180 degrees I'd go from 0 to 90 and back down to 0 again.

View 1 Replies

Professional :: Publishing A Flash Video: Player Not Visible - Height And Width Referenced 3-times In Html?

Mar 5, 2010

When I publish my FLV video using Flash CS3 and the "SkinUnderAll" option...the player controls are not visible unless I change the height & width in the html file Flash created.But, Flash shows the height & width 3-times in the html.
 
Question-1: Why 3-times? What does each of the 3 Height & Width references do?
 
Question-2: How should I modify the code to be able to see the entire video and the player controls?

It seems if I change all 3 everything just gets bigger and bigger.
 
1 - I import it into Flash CS3 on a PC w/XP Pro using... File | Import | Video take all the defaults and choose "Skin Under All" as the player option.
 
2 - In "Properties" panel at bottom of screen Flash shows the video as 640x480
 
3 - I then click File | Publish to publish the video. Flash creates all my files for me.
 
MyVideo.fla
MyVideo.flv
MyVideo.html
MyVideo.swf
SkinUnderAll.swf
AC_RunActiveContent.js
 
4 - I then put the folder with the files on my website.
 
5 - The video plays but the player controls are not visible.
 
6 - I see the Height & Width referenced 3 times in the html file Flash created for me (and none are 640x480, they are 550x400 !)
 
7 - I try changing the 550x400 to 640x480 in all three places... no good. Even at 1000x1000 the entire player is not visible. Everything just gets larger.
 
What are each of the 3 references to Height and Width in the html file Flash Creates and which should I change to simply show all the player controls?

View 2 Replies

ActionScript 3.0 :: Calculate Width And Height After Object Rotation

Jul 31, 2009

I am tweeing a bunch of rectangles randomly on stage.

Code:
TweenLite.to(thumbArr[i],1,{
x:Math.random () * (stage.stageWidth - thumbArr[i].width),
y:Math.random () * (stage.stageHeight - thumbArr[i].height),
rotation: Math.random () * (60) - 30});

the problem is that after I added random rotation (between -30 and 30 degrees), the corners of my rectangles are still sticking out of the stage at the end of the tween.

If I trace objects width and height after the rotation I get the new values but this still doesnt help me because I am tweening to that rotation.

Code:
mc.rotation = 20;
trace(mc.width);
trace(mc.height);

View 5 Replies

ActionScript 3.0 :: Wall Rotation - Resetting Width And Height

Dec 20, 2010

I have this code:
wall.rotation = sp.rotation;
wall.width = sp.width;
wall.height = sp.height;

When I then trace the width and height of both wall, and sp, they are just not the same. Width is the same on both objects, but height is not. height just stays the same. I see that the order in which I set height and widht matters. I don't get this. How do I just set the width and height separately?

View 2 Replies

ActionScript 3.0 :: Calculate Width And Height After Object Rotation?

Jul 30, 2009

I am tweeing a bunch of rectangular shaped objects randomly on stage.

Code:
TweenLite.to(thumbArr[i],1,{
x:Math.random () * (stage.stageWidth - thumbArr[i].width),
y:Math.random () * (stage.stageHeight - thumbArr[i].height),
rotation: Math.random () * (60) - 30});

the problem is that after I added a random rotation between -30 & 30 degrees they still stick out of the stage a little.how could I calculate width & height of the these objects based on their final rotation so they dont stick out of the stage?

View 6 Replies

ActionScript 3.0 :: Height / Width Of Bounding Box Of Visible Area?

Jun 23, 2008

In many cases the pieces have artifacts outside of their visible area. For example, a piece can have a picture of a dog's face, but one of the long ears is off to the side, outside the visible region of the piece. The path data is extremely detailed, so our designers didn't crop it off. They used a mask (at least I think it's a mask, I'm not a graphics guy and know little about that stuff) and this makes it invisible in Flash, when we turn them into movie clips. Also, in Flash when I look at the width and height of the piece, it does reflect only the visible area.However, in ActionScript when I try to get the width and height using, for example

Code:

pieceObject.width

I get the width of the piece including the part that is hidden, i.e. a larger width than the visible area.Is there a way in AS 3.0 to get the height / width of the bounding box of visible area only?

View 6 Replies

Bind A Flex Component's Height To Height Of Browser Window?

Nov 10, 2009

I want to constrain the height of a flex component to the height of the browser viewport.

The component's children are populated from a database table using a repeater, and are basic checkboxes. There are enough of them that the flex app ends up being about twice the height of the screen, which means some of the rest of the layout goes crappy on me. How can I force the component that contains these to limit itself to the size of the viewport?

View 4 Replies

Flex :: Setting Spark List Height To Its Content Height?

Apr 1, 2010

How to set a Spark List height to the height of its content?Tried this:

var lastRow:IVisualElement =
myList.dataGroup.getElementAt(myList.dataGroup.numElements - 1);
myList.height = lastRow.y + lastRow.height;

It works in case of a single item, but lastRow is null in case of more items.

View 5 Replies

Flex :: Layout - Set Height Of Accordion To Height Of Tallest Child

Apr 5, 2010

By default the height of an Flex Accordion container is the height of the initially selected child. I'd like to be able to set the height to the tallest child so that no resizing or scrolling is necessary when other children are selected. I do not want to use the resizeToContent property. I want the size of the container to stay constant no matter what child is selected.

My current thought is to extend the accordion class setting the creation policy to "all" and then override the measure function to loop through all the children and find the tallest one and use that for the height. This seems a little kludgy though, so I'd like to know if there is a better approach. Ultimately my question is: is there a way to set the size of an accordion container such that the container never resizes and scoll bars are never necessary to display any of the children?

View 1 Replies

Actionscript 3 :: Flex Matrix Rotate Image N Degrees?

Jan 24, 2010

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);

[Code]...

View 1 Replies

Flex :: Make Height Of SWF == Height Of Content?

May 26, 2009

I am going to embed a Flex app on an html page. The html page is already going to have a scroll bar to scroll up and down. The contents of the flex app are very dynamic, and I don't want to have an extra scroll bar when there is already one. So is there a way to make the height of the swf match the height of the contents of the swf?

View 2 Replies

ActionScript 3.0 :: Lines Visible In Flash Player, But Not In Flex?

Aug 12, 2009

I've made an animation showing the constellation Orion in 3D (see attached swf). As you can see, it's working properly, displaying stars and lines connecting those stars. The depth scaling is ok. The animation also responds to mouse movements as it should.The problems occur when I embed the swf in Flex using Flex Builder (I posted this question on the Flex forum as well, but I suspect the problem is more AS related than Flex 3 related): the stars of the constellation are visible, the animation responds to mouse movements, depth scaling is OK...but the lines connecting the stars aren't visible. Feel free to make the comparison for yourself.So any suggestions how I can make the lines visible? Can they be exported for Actionscript in the same way the movieclips are?Geography and sciences teacher (not a professional programmer alas)I used Flash CS4 professional version 10.0.2 , Flex Builder 3, IE8, Flash Player 10

import __AS3__.vec.Vector;var balls:Array = new Array();var marks:Array = new Array();var numBalls:uint = 10;var fl:Number = 400;var vpX = 300;var vpY = 300;var commands:Vector.<int> = new Vector.<int>(50,true);var data:Vector.<Number> = new Vector.<Number>(100,

[code].....

View 1 Replies

Flex :: Flash Printing Only Prints What Is Visible On A Canvas

Jul 18, 2011

I am building a very basic report writer for an AIR application that I am developing. I am using the Flash PrintJob class to output the contents of my report (in which pages are stored as Canvas objects in a ViewStack object).The problem is, only the content that I see in the report preview screen gets printed.Is there a way that I can print what the Canvas object contains not just what is visible? Here is a code snippet that I am using:

protected function doPrintReport(event:Event):void
{
var pj:PrintJob = new PrintJob();

[code]......

View 1 Replies

Flash :: Symbol's Height (in Code) Seem Different Than Its Height (in Design)

Jan 11, 2011

I have a bit of graphical content inside a symbol that I've created in Flash CS5. Let's call it FunGraphics_Art, it's set to export, and it extends MovieClip.When I edit the symbol in Flash and I hit control-A, the properties panel tells me that all of the content has a height of 72 pixels, positioned at 0,0.The content consists of a few (classic) textfields, and a couple of Checkbox components and a few bits of vector art.All the content is on a single frame, no layers.So far, so good. I export my art as a .svc and am able to use it all in code just fine. However I then add the following bit of code to my .as file..[code]Somehow, there's something strange going on that's causing Flash to think my exported symbol is about 75 pixels higher than it actually is. I've looked around for invisible "blank" textfields, but haven't found anything yet.

View 2 Replies

Actionscript 2 :: Flash - Set Container's Height To The Height Of The Textfield

May 6, 2011

I've created a dynamic text field, and set autoSize to true, so it can grow was tall as necessary. I then want to use the _height value to size a container graphic (speech bubble). Here's the (simplified) code:

[Code]....

Returns 19.6 followed immediately by 35.2. It's as though reading txt._height causes it to recalculate, so it's correct the second time. I also tried the textHeight property, which also seems to get recalculated after _height is accessed. This sequence, for example:

[Code]....

View 2 Replies

Flex :: VBox Doesn't Add Child If All The Objects' Height Over The VBox's Height?

Jun 7, 2011

I have a VBox with fixed width and height, and I add image objects with fixed width and height. I find that if my objects' height exceed the VBox's height, it doesn't show the object. I tried validateNow(), but it doesn't work. The object is added, but VBox just doesn't display it, so it leaves a blank with a same height as my other object.

[Code]...

View 1 Replies

Flash :: Flex Dynamically Changeing Tree Node Height?

May 26, 2011

I want to have a tree node renderer which act as follow :Clicking on it change the node height.I have tried as follow : to create a custom class derived from UIComponentand then insert it inside the tree node renderer, but because of some reason it doesn't work as I expected.Here's the code :

package
{
import flash.display.Sprite;

[code].....

View 1 Replies

ActionScript 3.0 :: Rotation Center Is In Left Of The Image - Aren't 3D Rotation From Transform Panel

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







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