ActionScript 3.0 :: Depth Sorting Function Starts Messing Up (sortchildren())
Jul 28, 2010
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.
View 8 Replies
Similar Posts:
Feb 5, 2012
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?
View 1 Replies
Jun 9, 2009
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?
View 2 Replies
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?
View 7 Replies
Oct 1, 2007
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?
View 2 Replies
Jul 31, 2009
I have a xml file(pretty big like 600kb) and I am extracting data from him in a function. I call that function in the first frame. The question is how can I preload that function or because is messing all my animations.
View 6 Replies
Aug 5, 2011
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).
View 2 Replies
Jun 6, 2011
I am trying to sort big array using actionscript 3. The problem is that i have to use custom sorting function which is painfully slow and leads to flash plugin crash.
Below is a sample code for custom function used to sort array by length of its members:
[Code]...
View 3 Replies
Jun 30, 2009
I'm trying to create a custom sort function. This function will sort the pegs in a certain row by their row number (0: lowest -- numRows - 1: highest)For context, here is Adobe's description for the Array sort method: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html#sort()
My array-building function:
Code:
public function getPegsInRow(row:int):Array
{
var pegRowArray:Array = new Array()
for(var i:int = 0; i < pegArray.length; i++)
[code]....
Unfortunately, the array does not get sorted correctly.
View 3 Replies
Oct 21, 2009
I am totally new to AS3.0 and OOP in general, so this is a very basic question I can't seem to figure out.I have a package.Inside that package is a class.
Inside that class is a function that initializes a timer called setTimer()
I am trying to run setTimer() when the program starts, but it seems that wherever I put the line setTimer(); in the program, I get an error.How and where can I run this function just once when the program starts, so I can initialize my timer?
View 3 Replies
Oct 21, 2009
I am totally new to AS3.0 and OOP in general, so this is a very basic question I can't seem to figure out. I have a package. Inside that package is a class. Inside that class is a function that initializes a timer called setTimer() I am trying to run setTimer() when the program starts, but it seems that wherever I put the line setTimer(); in the program, I get an error. How and where can I run this function just once when the program starts, so I can initialize my timer?
View 5 Replies
Nov 9, 2011
I have this fla file... 40 frames to be exact, each frame is a movie clip with AS3 code for a fade transition. I implemented to auto play with delay of 10 seconds on each frame, then next frame and so on. I also have implemented the next and prev button (next frame, prev Frame) and the arrow keys on keyboard function.
Now I need help on sorting out the play/pause function on the button (play>pause button) I did a code, it pause on the the frame when i click pause, but the as code on the mc clip on the frame proceeds and when i press the play button, it plays at current frame, but plays fast straight to the last frame.
[Code]...
View 7 Replies
Aug 25, 2009
I extended the DataGridColumn because I wanted to include a custom itemToLabel function (to be able to show nested data in the DataGrid. See this question.
Anyways, it also needs a custom sorting function. So I have written the sorting function like so:
private function mySortCompareFunction(obj1:Object, obj2:Object):int{
var currentData1:Object = obj1;
var currentData2:Object = obj2;
[Code].....
Whenever I try to sort the column, I get the error "Error: Find criteria must contain at least one sort field value."
When I debug and step through each step, I see that the first few times, the function is being called correctly, but towards the end, this error occurs.
View 4 Replies
Oct 11, 2009
I am creating a Datagrid in AS3, and adding a sort function to a column. However, this sort function does never get called. Any ideas?
dg_gruppenUebersicht = new NestedDataGrid;
dg_gruppenUebersicht.sortableColumns = true;
dg_gruppenUebersicht.dataProvider = arrCol_gruppenTnAkt;
[code]....
View 1 Replies
Jul 20, 2011
function createDatagrid():
//datagrid
var dp:DataProvider = new DataProvider();
//addin the entries
[Code]....
The above are my doubts for sorting a datagrid and a filter function for datagrid.
View 14 Replies
Nov 17, 2011
There appears to be a problem with the sort function when sorting the array contains several elements that are equal. I tried to illustrate this in the simplest form below:
[Code]....
View 5 Replies
Jul 21, 2009
I have a question regarding TweenMax and the way it tweens MovieClips. Here is what I have.
1. I have a rectangle movie clip on stage (width:20, height:20). When you click it, it expands (to width:650, height:350) and gets a 3-d function attached so it reacts to mouseXY position (like Lees 3-d photo tutorial). This part works fine.
2. I click it again and it retracts to its original small size (width:20, height:20). This also seems to work fine.
Problem: When I click it again it expands (to width:650, height:350), but when the 3-d function gets added it starts tween all weirdly shape and not the way it is intended.Here is my class
Code: Select allpackage
{
import flash.display.Sprite;[code].........
View 2 Replies
May 30, 2007
im having some trouble when trying to implement the swap depth function to movieclips that have the setmask function implimented to them. the problem is that i can get the swapdepth to work but when the setmask is implimented at the same time the movie clips will not swap depths.
the code that i am using to set the mask is _root.bgmasked.setMask(_root.dragger); this is on frame one in the action/code layer bgmasked is the imaged being masked by dragger.
[Code]...
View 2 Replies
Feb 29, 2004
I need a function to find the lowest available depth for use in attach movies and such. And I also wanted to ask if running a function like this a lot would be too intensive to be practical.
View 3 Replies
Apr 8, 2006
I've got a site that is using loadSound to play some mp3s and it works fine. however, the sound starts to stream, and then replays itself like a second later. my guess is that its playing faster than the load is going and when it gets to the point where it hasn't loaded enough, it starts to replay it, but i'm not sure that that is the exact problem. my code:
[Code]...
now, i tried making a playTrack function that i can call with setTimeout and i put that in the onLoad in place of track.start(), but that didn't work either (i was hoping to not start playing the track for 3 seconds to give it some time to buffer).
View 1 Replies
Sep 23, 2009
I'm completely useless at maths due to paying no attention whatsoever to it in school when I was a kid so forgive my lack of knowledge of basic terminology.I need a mathematical function that will return a number based on a graph that starts at 0, curves to (eg.) 100 and then curves back down to 0. I have a feeling it has something to do with Math.sin or somesuch wizardry but am not sure.Basically, I want to feed it a number between (eg.) 0 - 60 and for it to return a number on aforementioned curve. The purpose of this is to be applied as a lateral force on some basic ball physics. The idea of the 'curve' is that (depending on timing of the shot) there will be a 'sweetspot' in the timing.
View 5 Replies
Jul 31, 2010
I have a 3D field with many MovieClips in it, and seems like the one last added is the one that overlaps others and not the one with highest z value. Is there any property/function that sets z-index? (sorting children by z value seems too much like a hack). A 3D engine that can place MovieClips will be helpful(but not one that requires custom drawing). I'm using Flash CS5 with ActionScript 3
View 2 Replies
Aug 11, 2006
as always, I only drop by when *I* have a problem... I'm such a selfish bastard (is it allowed to even say "bastard" on here?) Anyways. I know that (in PHP) there's a way to use user-created functions to sort an Array (usort & uksort) by custom comparisons- you pass the Array and the name of your function and it uses your own function to "re-organize" the array.
Is something like that also available / possible in Actionscript? Or do I have to write my own function where it loops through the array entries and writes them into a new array? I need it relatively quick so setting up my own might take too long. The setup is pretty much this (just in case you're interested):
[Code]...
View 3 Replies
May 11, 2004
putting a movieclip into highest depth without knowing which clip is in the highest depth
View 2 Replies
Feb 25, 2009
I'm developing an AIR app using CS3. I had previously made one AIR app without much problems. So I start a new file and fill out the AIR settings (found under Commands). But the damn thing keeps screwing up settings. Some stay saved, some don't. It also keeps wanting to keep 2 files for inclusion that don't exist and are not even named correctly.
And now, after trying to fix some of the naming, it won't even create an AIR app anymore. It says there's a missing SWF file, but I published first, multiple times and yet, it doesn't see the swf.
View 1 Replies
Mar 18, 2009
I have a flash banner rotater and I have little squares at the bottom that are dynamically created which represent the slides in the banner, for example: if there are 4 slides in the banner there will be 4 little squares. Each little square is a button and if you click on a square it will take you to the slide that it represents. My problem is this: When I try to add numbers to each little square by dynamically creating a TextField then the text overlays the square so the button doesn't work.
View 2 Replies
Nov 15, 2009
hello everybody. I have a very weird problem. Recently my Flash IDE started to mess up dimensions. I mean when I create a new document or a rectangle for example, even if I set the height and width to the same value the height is always bigger than the width... I tried re-installing Flash CS4 again but that didn't solve the problem...
View 1 Replies
Jun 1, 2009
I am having trouble with unload an loading movies. Basically I am loading a movie into a container, which works a charm[code]...
Ideally I would like to add that second movie clip into a container so I can position it correctly, but when I try copying the code I use on the first it doesn't seem to work...is it to do with the "root" bit perhaps?
View 3 Replies
Aug 20, 2009
I've got a MovieClip with two frames for the UP and DOWN states with text on top of it. I've added MOUSE_DOWN and MOUSE_OUT event listeners, but the text gets in the way of the button reacting to the events.I tried fixing this by adding the text as a child of the button, but now the text and the button act like they're two separate buttons. Does anyone know of a clever way to make the text and the clip to act as one button?
View 2 Replies
Oct 4, 2009
So the MouseEvent.CLICK event works just fine when i don't have the setChildIndex, but when i do nothing happens anymore. Here is the code:
var kake:Kake = new Kake();
kake.x = 87.5;
kake.y = 358.5;
addChild(kake);
setChildIndex(kake,2);
[Code]...
View 3 Replies