ActionScript 3.0 :: DisplayObject Coordinates?

Jul 18, 2010

I have found some weird behavior, try this:

Code:
var test_x:Number=0.0000354;
var spr:Sprite=new Sprite();

[code].....

View 2 Replies


Similar Posts:


Flash :: Check If DisplayObject A Is A Descendant Of DisplayObject B?

Oct 26, 2010

I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it.

[Code]...

View 2 Replies

Actionscript 3 :: Convert Global Coordinates To Local Coordinates Of A UIComplenent In Flex Project?

Dec 19, 2011

I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point

uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue

var lp:Point = new Point(e.localX,e.localY);

I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2

var lp2:Point = new Point(e.localX,e.localY);

now surprisingly it was giving correct values as expected and I went back and changed the code as

var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);

now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.

View 1 Replies

ActionScript 2.0 :: Converts 3d Coordinates To 2d Coordinates - Difference Between MoveTo And LineTo?

May 21, 2007

I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:

transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....

I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:

red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);

View 4 Replies

ActionScript 3.0 :: Converting Papervision Coordinates Into Cartesian 2D Coordinates?

May 3, 2010

Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.

View 2 Replies

ActionScript 3.0 :: A DisplayObject Becomes NaN?

Apr 8, 2010

I've come across a pretty bizarre bug in my code when working with level generation in a side-scrolling platformer I'm trying to make... I've been desperately trying to debug it for the past 2 days! I have a movieclip (exported for AS) called Section1, that contains the first section for a level. It's basically a huge movieclip containing other movieclips; this Section1 movieclip contains the graphics for the level, as well as collision detection (the graphics are .pngs converted into movieclips, the collision detection is transparent rectangles converted to movieclips). FYI, it's a BIG movieclip... roughly 3400 pixels wide.

So, since it is the 1st section of a level, I have it spawn at the beginning of the game. However, I need to access all the platforms, walls, and graphics inside section1 from inside AS. So, here's the code I am using to do this:

public var s1:Section1;
public var platforms:Array, walls:Array, levelGraphics:Array;
...
// in Main's constructor now:
s1 = new Section1(2236, 8);

[code]....

Initially, it works... I've traced the data in the arrays in my update method (run every frame), and I can see that the arrays contain displayobjects... for a split second, that is. Seemingly out of nowhere, the values for all the elements in the arrays become NaN! I think to myself... of course these DisplayObjects are "not a number"... they're displayobjects! Of course, this renders my arrays useless, since I can no longer access the data I need to do collision detections!

View 5 Replies

IDE :: Set DisplayObject Rotation In IDE?

Oct 13, 2011

I can rotate it, or modify>transform>rotate +/- value

but what is the manual equivilant to simply object.rotation=0;

View 4 Replies

ActionScript 3.0 :: DisplayObject Is Not Created

Sep 4, 2008

I have 2 sprite which I create near the beginning of my video application. A bg and screenOverlay. On the first load of the file all is good but when I navigate away and then return to the swf my bg and screenOverlay do not get added to the displayList. I have a example up here at [url]...

View 9 Replies

ActionScript 3.0 :: Copy DisplayObject?

Feb 8, 2010

I have array with DisplayObjects and I need exactly copy of my current array with same DisplayObjects but each DisplayObject should not have direct and indirect relation with my current array. Do you have any clue about this coping display Object.

View 2 Replies

Actionscript 3 :: DisplayObject Not Being Displayed?

May 19, 2010

I have this class:

public class IskwabolText extends Sprite {
private var _tf:TextField;
private var _tfmt:TextFormat;

[code].....

View 2 Replies

Flash :: Can't Add Module As DisplayObject

Jun 5, 2011

I'm trying to load a module and add it to a mx:box object called "mod". [code]...

View 1 Replies

AS3 :: Flash - Add A Border To A Displayobject?

Jun 29, 2011

I know how to draw a rectangle and add it to a DisplayObjectContainer,but do you see a simpler method to directly add a border to a DisplayObject? DisplayObject don't seem to have addChild(), so I would have to add it on the parent, which is not perfect in my opinion...

View 3 Replies

Actionscript 3 :: Take Glow From DisplayObject And Put It In Another?

Oct 18, 2011

I have a grid of DisplayObjects that when I put a glow on any of them, the glow overlap the other objects.

I was wondering if I could take the glow created by a DisplayObject and put it another, so I can attach it to a container that's behind all the objects?

View 2 Replies

Flex :: What Does UIComponent Add To DisplayObject

May 19, 2009

I am trying to understand the interaction between Flex UIComponents and (Flash?) DisplayObjects... But it's not clear to me what the UIComponent class "adds" to DisplayObject. So, what can a UIComponent do that a DisplayObject cannot?

View 2 Replies

ActionScript 3.0 :: About Var Declaration And DisplayObject

Dec 31, 2009

ActionScript Code:
mc.addEventListener(MouseEvent.CLICK,clic);
function clic(evt:MouseEvent){
var clip:MovieClip=evt.target as MovieClip;
removeChild(clip);
}

1) Why it's also possible write removeChild(DisplayObject(clip)) and for what? In which case it's necessary?
2) if I write var clip=evt.target it's works too but if I write var clip:MovieClip=evt.target it doesn't work. Why? It's a movieClip that should go in the variable var.

View 4 Replies

ActionScript 3.0 :: DisplayObject's Unique ID?

Aug 16, 2010

I am trying to store data in an object about different objects, but right now i am using their names. This was working at first but if I have 2 movieclips of the same class (from the library), then their children will both have the same names and this messes with my data storage.

View 5 Replies

ActionScript 3.0 :: 3D DisplayObject Error?

Apr 8, 2009

I'm trying to get the same effect as thiI'm almost ready to complete it but I get this warning and my script crashes."Warning: 3D DisplayObject will not render. Its dimensions (4278, 3977) are too large to be drawn."To make this kind of effect I use the rotationX function and when I zoom in I tween the "z" property. I dynamically generate all thumbnails and show them as a grid using some XML data.

View 2 Replies

ActionScript 3.0 :: DisplayObject Error?

Dec 27, 2009

i'm looping though a display object and trying to reset some button. the issue i'm having is i'm getting and error:1119: Access of possibly undefined property menuText through a reference with static type flash.displayisplayObject.on the line where i try and target obj.menuText below. the weird thing is that this same code works when the actionscript isn't in a document class. i think i'm importing all the classes i need. also in the document class i had to add the MovieClip(obj) as pointed out below or i'd get an error similar to the one about.why moving this into a package is causing this?

public function resetMenu() {
//Loop through all of the menu itemsd
for (var i:int=0; i<menuHolder.numChildren; i++) {

[code].....

View 2 Replies

ActionScript 3.0 :: Removing A DisplayObject

Sep 15, 2010

I'm loading in an external swf with the code below (which works great), but occasionally I need to clear out "gameHolder" with a call of "removeChild(gameHolder);" but it doesn't work. I believe it is because the contents of "gameHolder" is a displayObject instead of a movieClip.

Code:
function load_game()
{
var mLoader:Loader = new Loader(); [code]....

View 2 Replies

ActionScript 3.0 :: DisplayObject Being Orphaned From Parent?

Feb 25, 2009

Firstly, I've created a global variable called mc to store a movieclip instance:[code]Later on inside a function, I've created a new instance of my movieclip and added it to the stage.[code]Now, this is working fine most of the time. But at one particular point in my program, after many other things have happened, when trying to remove this movieclip it throws the 'display object must be a child of the caller' error.So, I'm thinking if mc isn't a child of the stage, what is it a child of? Tracing mc.parent returns null - so it seems to be telling me that the parent (which was definitely the stage when it was created) has wandered of somewhere and abandoned my movieclip!I have no idea how this has happened, and as the whole program is several thousand lines long I can't post it here. So, does anyone have any idea what might cause a display object which is added to the stage to become orphaned like this?

View 1 Replies

ActionScript 3.0 :: Stop And Play DisplayObject?

Nov 9, 2009

My friend and I are working on a flash project in actionscript 3, and we are trying to interact with the timeline of a DisplayObject (such as stopping, playing, gotoAndStop/gotoAndPlay), the same way you would if it was a MovieClip. None of the regular commands to navigate the timeline are working on it. Is there any way that we could treat it as a MovieClip or inteact with it as if it was one?

View 7 Replies

ActionScript 3.0 :: Detect A DisplayObject Has Been Mirrored?

Mar 6, 2009

At startup I want to know in AS3 if a DisplayObject has been mirrored in the X or Y-axis during artwork. Basically I want to know if a MovieClip got a negative scaleX or scaleY after using free-transforms.

myDisplayObject.scaleX and myDisplayObject.scaleY always starts out positive regardless any mirror actions during artwork.

The two functions I desire are:
function mirroredInXAxis(dpo:DisplayObject):Boolean;
function mirroredInYAxis(dpo:DisplayObject):Boolean;

View 5 Replies

ActionScript 3.0 :: Which DisplayObject Is Visible At Position X,y

Mar 3, 2009

I want to know which DisplayObject that is visible atposition x,y. Unfortunately, hitTestPoint returns true even ifanother DisplayObject lies above and blocks all visibility. Forexample:

View 7 Replies

ActionScript 3.0 :: DisplayObject Event.activate?

Dec 23, 2008

I have a class linked to a library MovieClip. Several public instance variables in the class point to other DisplayObject's which are children of the class.Is Event.ACTIVATE the correct event to indicate that all ofthe children have been instantiated?

View 1 Replies

ActionScript 3.0 :: DisplayObject.alpha On MouseEvent?

Mar 24, 2010

I have a button (VehiclesButton) which on rollover I want it to trigger a mouse event so an image(VehiclesCentral) to the side of it (I've just set the alpha to 0 so its invisble, but its on the stage) will have its alpha increased to 100 and become visible

VehiclesButton.addEventListener(MouseEvent.MOUSE_OVER,test);
function test(e:MouseEvent):void
{ VehiclesCentral.DisplayObject.alpha = 100 ();}

When I publish this though I get no compiler errors, only an error when I actually go onto it and rollover the button.I get the following error message: TypeError: Error #1006: value is not a function. at QualityPortal_fla::MainTimeline/test()

(Quality Protal_fla is the file name I am working on).

View 4 Replies

Flash :: DisplayObject Snapshot In Flex 3?

Jul 9, 2009

i'm creating a visual editor in flex and need to let users export thier projects into Image format. But i have one problem: size of the canvas is fixed and when user add element which is out of these sizes some scroll bars added. And user continue working on the project. but when he want to take snapshot of the canvas he just get the visible part ot the canvas with scrollbars. how to get image of the fullsize canvas?

The only solution i found is to check the positions and sizes of canvas child objects and rezise it to fit them. then take snap and resize back. But it hmmmm... too complicated i think. Is there some "easy methods"?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>

[Code].....

View 3 Replies

Flash :: Visible Property Of DisplayObject

Nov 6, 2009

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set

[Code]...

View 4 Replies

Flex :: Inheriting Properties From A DisplayObject?

Dec 21, 2009

In regards to as3 project: Is there a way to inherit the properties of a given DisplayObject? I am looking for a single method that will grab something like the x, y, width, height, color, etc. Whatever is involved in the common classes between the two display objects.

Edit:

I don't think I was clear enough... Let me give an example of the type of functionality I am looking for.

var sp1:Sprite = new Sprite();
sp1.x = 30;
sp1.y = 30;
sp1.width = 500;
sp1.height = 30;
var tf1:TextField = new TextField();
tf1.inheritTransform(sp1);

So, in this case I know that the method 'inheritTransform()' doesn't exist, but I am wondering if there is something similar. Or maybe I am missing the point of extending a class in some way? I don't see how the two would relate in such a case.

View 2 Replies

Actionscript 3 :: Looping DisplayObject Animation?

Oct 4, 2010

I have multiple object doing random movement with random speed. i wanted to repeat the animation.I tried to use onComplete to restart each object once the animation end, but how could I specifically target it to that object? Currently its overflow

private function lineAnimation (e:DisplayObject):void
{
TweenLite.to (e,randomTime, {x:randomX, onComplete: lineAnimation(e)});

[code]......

View 1 Replies

Flex :: Check What Parent Of A DisplayObject Is?

Oct 5, 2010

How can I check what the parent of a displayObject is? What is the parent of myObject for example.

View 1 Replies







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