ActionScript 3.0 :: Depth Sorting Based On Their Y Coordinate?
Aug 7, 2009
Im busy with a rpg graphics engine, while discovering as3 whilst doing it. So I made different classes for the world, tile managers and players, etc. But since I have a 45 degrees SNES rpg view on my world I need depth sorting based on their Y coordinate. At least my npc's and the middle tile layer need that. But all these objects are now all different classes now and the swapchilderen method is quite cumbersome. Do I need a whole messy cumbersome method to sort specific tiles and npc's based on their y coordinate or is there a simpler method to have proper depth sorting in as3?
I've been playing around with ActionScript 3. They have a new way of placing clips onto the stage, "addChild(clip)," which automatically places the clip onto the stage with it's own depth. So here's my problem, when making a tile based game, I have to constantly depth sort to make sure the object lower on the screen has the higher depth than an object higher on the screen. Pretty much, their depth depended on their y-coord. Does ActionScript 3 still let us play with depths?
With flash builder and away3d I have made a 3D building where you can walk through. When you start, you are outside the building and you can enter the building through a door. This building has an outside wall made of bricks and an inside wall. There is a little space between the inside wall and the outside wall (just as a cavity wall).
But when I walk outside the building, I can see sometimes parts of the inside wall through the outside wall (depth sorting problem). The same as I walk into the building, I see parts of the outside wall through the inside wall. Some of these depth sorting problems you can solve with pushfront and pushback, but not all. For example when you are outside the building, you can use pushfront for the outside wall.
You don't see the inside wall through the outside wall anymore. But when you walk into the building you see the outside wall through the inside wall (of course because you used pushfront for the outside wall). Actually it depends on your position in the 3D space for which wall you have to use pushback or pushfront. Is there a way to solve this kind of depth sorting problems?
I used to dabble with AS2 a while back, and never really liked it much. I mainly program in Django and Python, with some PHP on the side - Flash was never one of my strengths. However, due to a new project I am delving into AS3 which is a MUCH needed improvement over AS2.
But there also comes a learning curve (which is not too large because OOP languages are very similar). I am currently trying to get depth sorting to work in AS3.
The project I am doing is basically a complete clone of [URL].. and I am 90% finished. I have the sprites (alligators not penguins in this instance) moving, chatting, etc. via url requests to Django for the server. The only thing I am having problems with is where the sprites move towards the chat text mainly (look at penguinchat if your not sure what I mean). I would like the sprites to appear underneath the chat text, so the users can still read the text if somebody moves there.
I have the chat text, a room changer, a user manager, and input text movie clips all on the .fla stage, and have .AS files with code in them for all of the objects. I can easily take the movieclips off the stage and spawn them with actionscript if needed, but I would rather not (easier to design the interface this way IMO).
The sprites are added as children of the user manager MC, which is a sibling to the chat text MC. Everything would be solved if I could simply assign a number to the user manager MC (depth) that would be lower than the chat text MC. Or even having to assign a number lower to each sprite.
I have tried "addChildAt" when creating the sprites and specifying an index of "0" but this does not work. Is it because the chat text is on the stage and not spawned via actionscript?
I need the enemies to move around the obstacles on screen. I have tried several methods but it seems to screw up other functions in my game... For example the depth sorting function starts messing up (sortchildren()). I think its because i'm such an amateur.
In Flex/Actionscript.When writing an on mouseMove event on a Canvas control for example, how could I check to see what control if any is under the mouse pointer at a particular coordinate?
I have a list containing display objects from throughout the application (insertion order). I want to process the list either top-down (parent, child) or bottom up (child, parent). The only requirement is that either a parent is processed before any child or vice versa a child before its parent. What is a good approach? This question is not about sorting a list. It's about retrieving the depth of a particular display object.
Example Display list: A (root) B1 C1 C2 D1 B2 ......
My list: list = [E1, F4, A, B2, B1, C3, ..., N9, N8]
Bottom-up: N9, N8, F4, E1, C3, B2, B1, A
Top-down: A, B2, B1, C3, E1, F4, N9, N8 Does not matter if N9 before N8 or N8 before N9. Important is that any N is before M (first run) or any M before its children N* (second run).
I have been working on sorting Arraycollection like ascending , descending the numeric list. Total length of my collection will go up to 100. Now I want to preform sort to nested data like this
Data Structure
Name : String Categories : Array ["A","x or y or z","C"]
Categories array will have maximum 3 items , out of that three items the second item can have 3 different values either X or Y or Z. My result data looks like here
Quick Question, I just started learning the psuedo 3D methods in FP10, and as a sample I am creating a virtual rolodex. It is dynamically generated with a user inputted number of cards. The cards are then added to the stage and are rotated around a central axis using the function below.
[Code]....
After this is created I have an Enter Frame listener that rotates the cards around that axis based on mouse position. Problem is that they get depth sorted based on the order that they are created, cardArray[0] in back all the way up to whatever the number of cards is. I have tried a few of the simple Z sorting classes and noticed that my cards dont actually change there Z property, only their rotationX. I was just wondering if anyone might know of an easy way to depth sort these. Otherwise the best idea I can come up with is to check the rotation based on 360 degrees and assign a depth. That seems like a lot of ugly math though if you want to see what the swf looks like check here.
I have a question on coustom sort..I have a datagrid for which one coloum has a itemrenderer. I need to sort a coloum based on the value in the item renderer. In the dataprovider for the datagrid i have a numeric value. Based on the numeric value in dataprovider i have a String associated with that value which is shown in UI. I need to sort based on the statusLabel associated with the numeric value.
What I want is to sort a Vector array of objects(not primitive), based on a propery(Number). (think character.zDepth). Generally the same thing as the sortOn function of Arrays, except that we don't have that for Vectors. like myArray.sortOn(x, Array.NUMERIC) Dealing with Vector arrays of primitives not complex objects.
Code: moviclip.swapDepths(movieclip._y); and it worked perfectly.
but I decided that I wanted to continue the development of the game in AS3 (so that it will be more up to date and I could learn the new syntax), and I found the equivalent to swapDepths is setChildIndex. so I followed the new rules and came up with this code:Code: setChildIndex(character_mc, character_mc.y);but, sadly it does not work the same. the game becomes extremely laggy and almost unresponsive, but becomes normal again if I remove the code. So, my question is how can I add a similar code for this to work properly.
I'm looking to create a rotating set of images, simulated to look 3D... that can rotate either left or right, reactive to someones mouse location.
The path of the images would look like a flat oval, and as the images came to the forefront, they would be at full scale, have the lowest position (high _y), have the highest depth (appear in front of everything else) and be dead center _x.
As they slide left or right, they would reduce everything by a relative 50% to the final shift (scale, _y, and depth) until they got to the end, moving in an upward arc following the oval path. When they got to the end, and kept rotating beyond (move in the opposite _x. but appear to follow the flow of the arc), continuing to decrease in scale, _y, and depth.
I have 3 square. smallest square s3 is inside s2. s2 is in side s1. each is 10px larger [code]how can I find the coordinate of child in its parent's coordinate system?
how to reorder an array based on the information contained in another array. What my script is currently doing is detecting all the attached monitors I have and then ordering them based on their left bounds. However I then want to reorder the screens location in the array based on whether the user has selected that display or not. If the user has selected it, by clicking a button, the button movie clip will be on frame two, if they haven't been chosen it will be on frame one. So what I am doing is then creating two separate arrays, chosen screens and not chosen screens, and then combining them into one.
Code: if(displayButton.currentFrame==displayButton.totalFrames) { //sort the chosen ones into an array
[Code]....
My problem now is being able to reorder a separate array which contains all the screens, called screenArray, based off of that. screenArray currently returns [Object Screen], [Object Screen], [Object Screen], etc... and is in the order of 1,2,3,4,5,6. How do I take then and get it to be equal to the order of my displayButtonsChosen Array of 1,3,5,2,4,6?
I just discovered impure.com and was very impressed by what can be achieved in terms of visualizing data using their workspace. Although the platform is free to use, but not open source yet. This causes a few problems because the API section works with .com sites for eg. for ebay, so I cannot visualize ebay listings for regional sites such as ebay.in because the link to ebay.com is hardcoded.I searched around, but didn't find other projects that offer a similar way to work with site APIs and other data sources with the kind of user interface and detail that impure.com does in a realtime way within a browser window.This brings me to the questions:
-What technologies would be involved in creating a similar kind of project
-What are the open source tools that can help develop a fullscreen UI to render the workspace. Are there any alternatives to flash for this, and how do they compare
The goal would be to use standard python data structures, python scripts to do some processing on these data structures, scripts to gather data from csv, json and API sources such as google yahoo, wikipedia and flickr, and scripts to render graphs, tag clouds, network visualizations etc. Then bring them all together into a visual interface that supports drag drop and simple type checking.How would the python backend integrate with the UI.
I'm relatively new to AS3. There's one thing that I don't quite understand about Sprites. I'm making a tile based game, and all the tile graphics for a level are inside one movie clip in each frame. Would I be able to go about creating multiple sprites based on the frames in said movieclip's timeline I would I have to go through and make a separate library graphic for each.
i have a mapMC on the stage and 6 buttons. i need to be able to make the buttons move the mapMC to specified coordinates. the coordinates are set and will never change. i also need an easing from one location to the next. i guess i'll go ahead and throw in a bonus question for any of you aces out there. lets say location "A" is at x=200, y=400. i would like the mapMC to get there and scale 120%. so a button that gets pressed will go to its coordinates and scale acordingly. i can see that this could be script heavy, but for some reason not too difficult.
first have a look at this: [URL] It loads "auto" coordinates from php file, and makes the "auto" move after timeinterval. It is needed tht it could load infinate coordinates, but i fail to do it. If u change setProperty(auto, _x, kord ) to setProperty(auto, _x, x2 ) , it works, but as u can see only with one coordinate.
If you drag the map, it moves even beyond the edge of the map so the map eventually gets dragged off the screen. Is there any possible way to stop the map moving any furthur than its boundry?
When I use 3D rotation tool, there is an option called global transform, if it turned off, the object would rotate by its own axes, this is exactly what I want. How can I do rotatation like that with AS3 code? Is there any property if changed then rotationX/Y/Z would rotate object by its axes?
I've usually designed Flex applications myself but this time I'll need a designer to assist with skinning the application. I've worked with this designer for a while, and we could work well on an HTML/CSS environment. He can't code, he sends me sliced PSDs which I could convert to clean code. But I'm not sure how to have him assist me with Flex UI as he's not familiar with the components.How do you guys interface with designers for your applications?
I have a problem when one B.swf file is loaded to another A.swf file.A.swf file size is 400x400.B.swf file size is 100x100.B file has a movie clip (MC) which is animated and position of this movie can be from Y:-100 to Y:200. B file is loaded into the center (X:150, Y:150) of the A file.When B file is loaded, then animation starts. I have a problem: I can see animated movie clip B out of B screen scope (for example: when B.swf file movie clip has _y = -100 I still can see that movie clip in A.swf). I am expecting that movie clip will not be shown if Y position becomes negative