Actionscript 3 :: Flex: Difference Between Defining Sprite's X - Y Coordinates And Painting Object In Some Location
Oct 14, 2009
I have a task: I need to place about 100 sprites on one canvas (with prepared grid on it). I need to place them as invisible (circles) stones, on the board, and make visible only on mouseover. The problem I come across is following, I can't place those objects accurately into the nodes on the grid.
[Code]...
View 2 Replies
Similar Posts:
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
May 23, 2010
What is the difference between a UIComponent and a Sprite in Flex.
View 1 Replies
Sep 23, 2011
Both of sprite.width and sprite.scaleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?
View 2 Replies
Jul 6, 2011
I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:
package
{
import flash.display.Sprite;
[Code]....
I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.
View 3 Replies
Apr 27, 2010
I think i am lost with basics itself. What is the difference between these two. String object is an instance of String Class.
[Code]...
View 3 Replies
Apr 27, 2009
I am trying to make an object tween from its starting location to the location of a mouse click. I have a script, but it has a very annoying ease to it.I would LIKE the object to mantain a certain speed during while traveling from its starting location to the mouse click location.
View 16 Replies
Nov 4, 2009
I have a simple Actionscript 3 project. The code is on the timeline:
ActionScript Code:
import pti.dmutility.layout.ConfigElement;
//this Class simply extends the fl.controls.Button with variables
Then I put some instances into the stage, and make them Drag&Drop. Here is the Dragging function. I want to remember the item's puck up position when clicked, I use ConfigElement's OldX and OldY properties:
ActionScript Code:
function dragStarterItem(e:MouseEvent):void{
var item = e.target;
item.OldX = item.x;
item.OldY = item.y;
item.startDrag();
item.addEventListener(MouseEvent.MOUSE_UP, dragStopperItem);
}
When I click on the item, the OldX and OldY gets the actual position of the item, BUT after dropping it somewhere else, and picking up it again, the OldX and OldY is still the same! Holds the initial position, and not changing to it's new location coordinates. Every instance remembers it's initial position only. Why not change every time I click? Why remembering the first click's position only?
View 7 Replies
May 30, 2010
I am trying to swapping a movie clip with another movie clip keeping the x y coordinates in the same location as the original. This is to be done within a case statement. [code]...
View 1 Replies
Oct 26, 2011
I have 2 possiblities. It looks like these are the same (or I'm wrong). Which is better and why?
var quest1:DisplayObject = FrameCanvas.baseCanvas.addChild(app.questionmark1); //
quest1.x = posX; //
quest1.y = posY; //
or
app.questionmark1.x = posX;
app.questionmark1.y = posY;
View 1 Replies
Mar 23, 2011
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at grid/ball_movement()// my function in enter frame event
The code I wrote in ENTER_FRAME is
[code].....
View 3 Replies
Mar 24, 2011
I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]
View 1 Replies
Oct 16, 2009
Is it possible to test if a sprite (or movieclip) is located at a set of coordinates? If a sprite is located at the coordinates, can you retrieve it's instance name? If no sprite is located at coordinates, can you output a value?
View 1 Replies
Apr 13, 2011
what is the difference between MovieClip and Sprite?
View 1 Replies
Apr 14, 2011
I'm kinda new to AS3, I would like to know the difference between Sprite and Bitmap classes??
View 6 Replies
May 25, 2011
What is the difference between a movieclip and a sprite. Why some programmers using sprite instead of a movieclip? What is the advantage of using sprite? Can we use sprite in the stage? Will the sprite reduce the space occupation than a mc?
View 3 Replies
Feb 28, 2011
I need tp set the y coordinate on a sprite's rightmost coordinate. That is, usually when we set the y coordinate that's the lefttmost side of the sprite, and the sprite starts there and goes to the right of that point. I need to reverse that. The reason is because I'm putting text into it and it's going to the rightmost side of a box, so it can't overflow to the right.
View 2 Replies
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
Dec 11, 2009
The idea is there are two buttons(Sprites), one on the left & one on the right, when either button is moused over a the script should start setting the alpha of the relevant visible element. (i'm not worried that they both would be fading out as the mouse moves left to right at this point)
ActionScript Code:
private function turnOnInterfaceHinting():void {
this.addEventListener(Event.ENTER_FRAME, InterfaceHinting);
}
[Code].....
View 3 Replies
Jan 22, 2010
How could I use string content to define new object in variable. Instead of[code]...
View 4 Replies
Nov 15, 2003
I'm facing a problem with defining objects. What I need to accomplish is this:
[Code]....
View 8 Replies
Jul 5, 2009
is ist still possible to use external parameters in defining an swf object in html?
[Code]...
View 3 Replies
Jul 23, 2011
I think I am on the right track here but if someone could help that would be great. I have a piece of code that loops ON_ENTER_FRAME and it is used to check if a pistolBullet is hitting a barrel.
The problem I have is that I can check for collision of a barrel, if I manually type the name 'barrel', 'barrel2' etc within this code:
[Code]...
View 5 Replies
Nov 15, 2003
What I need to accomplish is this:
Code:
var cnms = this.cNames.split("|");
myDP = new Array({cnms[0]:"Chris", cnms[1]:"Priceless"}, {cnms[0]:"Nigel", cnms[1]:"Cheap"});
Obviously, this doesn't work, otherwise I wouldn't be typing this right now. How do I define an object with variable properties ? I've tried eval(), but it doesn't work either.
View 8 Replies
Dec 16, 2010
By default, the iconFunction of List and Tree return only Class as the icon, which is for embeded images or iconUtility kindly provided by this site http:[url]...... It works very well with pre-created images.But what I really want is to accept a completely runtime generate sprite object, similar to what is done by Legend, with the color changes according to what the current status. I assume I could do something to make the ListBase to accept icon argument other than Class.
View 2 Replies
Sep 3, 2011
I want to know the difference between [object main timeline], [object Stage] and root in as3? I have read from the topic How stage, root, and MainTimeline Fit Together. But I didn't get clearly.
View 3 Replies
Dec 11, 2009
1) Is it true that every data type within as3 is a subtype of Object?
2) Is there any (ANY) difference between typing a variable or function argument or function return as Object versus *?
View 4 Replies
Jul 15, 2010
In my subclass, I call "super()" after setting an object's data. Whenever you set the object's data, "super()" sets it back to null. Meanwhile, if I define arrays before "super()", they do not get reset.
View 9 Replies
Oct 16, 2009
We have a client server architecture where a C++ server talks to Flash clients. I'm developing the server and would like to send through tcp an xy coord to simulate a button press where the receiving flash client would find the topmost visible object at that coord and send a mouse event to it such that we could simulate play without a human present. I'm told this is incredibly difficult, but it seems to me that there must be a way to do this. Am I off the mark? Or is there a mechanism in flash to iterate through all objects regardless of parent child relationships to find a visible button at an x, y coord and signal a press event?
View 2 Replies
Mar 28, 2011
if AS supports anything similar to hashes in perl (okay, it's been a long time since I've done any coding).If I want to get the x and y coordinates of an object I do it like this:
ActionScript Code:
thumbnails[0].getXY()[0]; // Get X
thumbnails[0].getXY()[1]; // Get Y
and I'd rather it look more like this:
ActionScript Code:
thumbnails[0].getXY(){"x"}; // Get X
thumbnails[0].getXY(){"y"}; // Get Y
View 3 Replies